| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@koubaa I've added Python installation to CI. Please, rebase your branch. |
Sorry, something went wrong.
|
@koubaa Locally, you can go to project settings and set PATH environment variable in the Debug section. I personally just have a setup class in the test project, that I never commit: [SetUpFixture]
public class LocalTestConfig {
[OneTimeSetUp]
public void AssemblySetup()
{
Environment.SetEnvironmentVariable("PATH",
@"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\;"
+ Environment.GetEnvironmentVariable("PATH"));
PythonEngine.PythonHome =
@"C:\Users\USER\AppData\Local\Programs\Python\Python37";
}
} |
Sorry, something went wrong.
|
Hm, build still fails to find the library. Let me try to fix it. |
Sorry, something went wrong.
|
@lostmsu I can try what you did locally, but ideally this info can be in the wiki |
Sorry, something went wrong.
|
@lostmsu AssemblySetup didn't work, I debugged and my TestCallBacks SetUp function is called before AssemblySetup. I think the order NUnit runs these is not deterministic and since you can run individual tests from the test explorer I don't think It'll work in general even if it does run that setup first. I'll see if I can figure out how the pythonnet embedding tests sets up the python environment. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@koubaa you have to manually call TestsRuntimeConfig.Ensure(); in [SetUp] for your tests. |
Sorry, something went wrong.
|
@lostmsu done. tests fail due to the issue with the return value of the Func |
Sorry, something went wrong.
|
@lostmsu these changes are ready and tests pass locally. I don't know what happened to the CI: |
Sorry, something went wrong.
There was a problem hiding this comment.
I can not take this PR as is for two connected reasons:
If you have a very specific use case that this fullfills, I suggest to simply keep this codec in your private codebase. Otherwise, it really needs to be properly generalized.
As for the special handling I mentioned in 2., I recommend to create special delegate types, e.g.
delegate void VariadicAction(object[] args);or even
delegate void VariadicAction(PyObject[] args);and use them instead of the standard types for the scenario in 2.
Sorry, something went wrong.
|
@lostmsu I thought you said these were the reasons you couldn't take it in the pythonnet repo but you could take it in the codecs repo? |
Sorry, something went wrong.
|
@koubaa the reason not to take in the main repo is that conversion is lossy. E.g. decode followed by encode do not give an identical (or at least identically behaving) object back. I think genericity is not really necessary on its own, but "unintuitive meaning for standard C# delegate types" is a real problem. I just think making a generic solution is easy enough vs going the route of defining custom function types to circumvent "unintuitive meaning for standard C# delegate types", and forcing everyone to use them with this codec. |
Sorry, something went wrong.
|
@koubaa BTW, we can take this if you target it to custom delegate types instead of Func<object[], object> and other standard ones to avoid confusion. It should be enough for most use cases, users could then just have lambdas forwarding the custom delegate type to whatever type they need. E.g. delegate object PythonFunction(object[] args);
void Foo(PythonFunction pyFunc) {
Func<..., object> sharpFunc = (a,b,...) => pyFunc(new object[]{ a, b, ...});
// use sharpFunc normally
}In fact, you don't even need a PythonAction, because no return Python functions still return None. But I strongly suggest to try generalize this using Reflection and Reflection.Emit/LINQ expressions. |
Sorry, something went wrong.
|
@lostmsu I'll keep it my private repo then. I don't know how to accomplish what you're looking for |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
@lostmsu While running the test I get the exception "Could not load python37.dll". I wanted to push this first to get a preliminary review while I figure that out. It also appears that vs2019 is needed (for .net core 3.1). I don't mind but wasn't sure if this was intentional.