-
Notifications
You must be signed in to change notification settings - Fork 751
First chunk of modernisation changes #1109
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
- Move projects around and add clean project/solution files - Drop monoclr and clrmodule - Add stub clr module - Drop nuget config - Add test helper project - Drop PYTHON3 flag (default now) - Remove unneeded additional interop files - Make NETSTANDARD the default Drops also - Custom XDecref/XIncref (should be readded) - Remote object handling for .NET Framework - Remove Runtime._UCS dependency from CustomMarshaler - Stop using Runtime.IsPython2/3
3403bb6
to
52e4f15
Compare
- Swapped UCS2 in one place - Explicitly acquire GILState in InternalInitialize - Fix a few problems with short-ints by using larger numbers (`PyLongType`) or dropping the respective return (`AtExit`)
3862a0d
to
054b872
Compare
@koubaa @lostmsu I've gotten quite a bit further. The current state of this PR implements embedding in .NET Core and Mono on Linux (haven't tested yet on Windows, will not be able to test on OS X), I tested with the following script: import os
#os.environ["MONO_LOG_LEVEL"] = "debug"
#os.environ["MONO_LOG_MASK"] = "cfg,dll"
#os.environ["COREHOST_DEBUG"] = "1"
#os.environ["COREHOST_TRACE"] = "1"
#os.environ["COREHOST_TRACE_VERBOSITY"] = "4"
import pythonnet, clr_loader
import sys
if sys.argv[1] == "mono":
mono = clr_loader.get_mono()
rt = mono
elif sys.argv[1] == "core":
core = clr_loader.get_coreclr("/home/benedikt/git/clr-loader/example/out/example.runtimeconfig.json")
rt = core
pythonnet.set_runtime(rt)
pythonnet.load()
print("Loaded pythonnet")
import clr
from System import Console
Console.WriteLine("Success") Still crashes when I try to do this from IPython, but we're getting somewhere :) Next steps are:
|
@filmor this PR seems to accomplish a lot, I wish it could be staged so it would be easier to follow. For instance, does this also fix 857 and drop support for python2? Also the file renames I think should be done in a separate PR to better understand the scope. If you like I can take care of adding some of these easier stages. sidenote I totally agree with dropping remoting support. If someone wants that they should maintain a fork. |
This doesn't drop Python 2 support, yet, it merely defaults to Python 3 unless What I want to accomplish in the end here is:
|
@filmor I'll push up a PR with some things staged. I think the smaller and more incremental we can make this branch the easier it'll be to land (not to mention to allow users to bisect if it breaks anyone!) My first PR will be:
Which variants do we need to test on windows? I can also work on that + embedding. |
@koubaa Have a look at the other PR (#1015), it has much smaller grained commits. The reason I went for this larger variant is that I did some steps in the "wrong" order (first moving the files around, then modifying them). The parts you are suggesting may safely go against master, all steps that change the project structure can't. Please ensure that they are compatible with this branch, though. I don't understand what you mean by "variants". |
@filmor I am referring to a task in your comment 3 days ago: "Test on Windows in all variants" |
On Windows we can use all .NET runtimes, i.e. Framework, Core and Mono, so all of those should be tested. |
3d8416b
to
1adc2ff
Compare
try | ||
{ | ||
gilState = Runtime.PyGILState_Ensure(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be inside try
block?
<Project Sdk="Microsoft.NET.Test.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp3.0;net472</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
netcoreapp3.0 will soon be unsupported. We should use netcoreapp3.1 which is LTS
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetFramework) == 'net472'"> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think non-preview version of this package was released.
Drops also
What does this implement/fix? Explain your changes.
...
Does this close any currently open issues?
...
Any other comments?
...
Checklist
Check all those that are applicable and complete.
AUTHORS
CHANGELOG