-
Notifications
You must be signed in to change notification settings - Fork 770
Added configurable Python.Runtime.dll loader. #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I like the idea in principle, but in order for it to work in all cases you would have to embed a lot of different runtimes (I think you only added x64 builds of 2.7 and 3.5). Don't forget that especially for linux people use versions of python with all sorts of different ABI flags, so it's not only the different python versions that have to be added. The binaries should not be checked in. I think they should be built before this new component each time instead. Including all the binaries adds a lot of bloat that some people won't want. Have you considered creating this as a separate repo (which could be under the pythonnet organization)? You could use CI to build it, picking up the latest pythonnet binaries from AppVeyor and travis (you have have to add some new builds to get the full set of binaries if you intend to support all python variants that are out there). |
|
Unfortunately i have no enough time to maintain "Binaries" repo project. I know that there are more than 10 actively used build variants for pythonnet. But I can maintain, update and publish only distributions that i will use in my commercial development. Probably someone else can do effort that mentioned by tonyroberts. Currently I work on Ubuntu 16 and Windows, this would be most portable platforms for the near future. I will maintain this reduced binary distribution in my fork. |
|
@dmitriyse would you like if I create a repository "pythonnetbin" in pythonnet for these bundled binaries? I see that you keep updating your bundles. Note that I'm also admin on chocolatey for pythonnet package and can add you there. After updating on chocolatey we need to add binaries on nuget. My first thought is that Linux and Windows can be separate bundles. Then we can also support manylinux wheels. I'm not sure if this conflicts with your deployment? Another idea is in the bootstrapper logic to check for all necessary flags (OS, python version, bitness, ABI flags) before loading the corresponding bundle or throwing error about unsupported combination of flags. I understand that you cannot spend much time on this, but just wanted to have official way of distributing these bundles, since this benefits everyone! |
|
@dmitriyse also do you agree to MIT license for your contribution once we transition to it? |
|
Hi!. Yes, it will be cool to migrate to MIT, so sure. |
|
I performed big research work and finally get it work : autodetection for ubuntu, ubuntu+miniconda, windows. Main use case of my distribution is to build-in python into some CrossPlatform C# .Net 4.5.1 application. Typical scenario will be:
namespace Python.Bootstrapper.Test
{
using System;
using System.IO;
using Runtime;
public class Program
{
static Program()
{
Console.WriteLine("Starting application...");
// Required to be placed in the static constructor for Mono.
var loadedLib = PythonRuntimeBootstrapper.DetectPythonAndRegisterRuntime();
Console.WriteLine($"{loadedLib} runtime loaded.");
}
static int Main(string[] args)
{
// Mono workaround required to fix AssemblyResolve + EntryPoint class bug.
// Classes that was referenced from EntryPoint class cannot use assemblies resolved through "AssemblyResolve"
Action monoWorkaround = () =>
{
try
{
PythonEngine.Initialize();
try
{
using (Py.GIL())
{
dynamic sysModule = Py.Import("sys");
Console.WriteLine("Python engine version:");
Console.WriteLine(sysModule.version);
}
}
finally
{
PythonEngine.Shutdown();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
};
monoWorkaround();
return 0;
}
}
}
|
a17b803 to
a98916e
Compare
|
@dmitriyse can you please let me know when is this ready for testing? |
|
I will publish RC bin distribution soon. I found floating bug in 2.2.0-Beta under Mono. Currently I am testing fixes. RC version should be mature enough for production use (at least our product will use it). |
|
RC release ready https://github.com/dmitriyse/pythonnet/releases/tag/v2.2.0-bin-RC |
|
@dmitriyse I create a pythonnet organization's repository called pythonnetbin for your binaries: |
|
Would it be an option to have this as a separate project and just merge the essential parts here? |
…ime for Linux and Windows targets Related: pythonnet#804 pythonnet#244
Added project that builds Python.Config.dll with different Python.Runtime.dll version stored in resources.
If you put bootstrap code:
to your project and switch off "copy local" property on Python.Runtime.dll assembly, then different version of Python.Runtime.dll will be loaded.
You also should put version into configuration file:
By using this approach great Python.Net library will be able to be linked thorugh nuget.
(See #165)