Skip to content

Conversation

@gsalaz98
Copy link

What does this implement/fix? Explain your changes.

Migrates and adds support for .NET Core 3.0 for pythonnet. This is required for python algorithms to run in LEAN .NET Core

Does this close any currently open issues?

No

Any other comments?

I believe this might break backwards compatibility with .NET Framework 4.5.2 -- which is what LEAN currently runs on. Will have to do some testing for that.

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

AlexCatarinoand others added 30 commits July 23, 2018 22:24
Convertes System.Decimal to decimal.decimal and vice-versa
Converts System.DateTime and System.TimeSpan to datetime.datetime and datetime.timedelta and vice-versa
DECREF'ing datetime timezone argument when DateTimeKind is Unspecified was causing `Fatal Python error: deallocating None` because the object was set to `Runtime.PyNone`. Fixed the input to datetime constructor as we were passing milliseconds, where it should be microseconds.
…-none-datetime-timezone Do not include timezone if DateTimeKind is Unspecified
…sioning Sets the version to 1.0.5.12 to match QuantConnect's nuget one.
- C# decimal conversion will use C# double and python float due to the big performance impact of converting C# decimal to python decimal.
…ean-2825-decimal-csharp-to-python-float C# decimal to Python conversion
Convertes System.Decimal to decimal.decimal and vice-versa
Converts System.DateTime and System.TimeSpan to datetime.datetime and datetime.timedelta and vice-versa
DECREF'ing datetime timezone argument when DateTimeKind is Unspecified was causing `Fatal Python error: deallocating None` because the object was set to `Runtime.PyNone`. Fixed the input to datetime constructor as we were passing milliseconds, where it should be microseconds.
- C# decimal conversion will use C# double and python float due to the big performance impact of converting C# decimal to python decimal.
- Increasing minor version to 14 - Adding `UnsafeDispose()` for `PyObject` which does not require acquiring/releasing the lock - Adding check before calling `SetArgsAndCause` for the `ClrObject`, the call only makes sense when we are an exception and causes an overhead
…mprovements-dispose-clrobject Performance improvements ClrObject - Dispose PyObj
Martin-Molineroand others added 26 commits April 23, 2019 18:33
…when-shutting-down Fix deadlock when shuting down
This addresses the following scenario: 1. A C# object `a` is created and filled with some data. 2. `a` is passed via Python.NET to Python. To do that Python.NET creates a wrapper object `w`, and stores reference to `a` in one of its fields. 3. Python code later passes `w` back to C#, e.g. calls `SomeCSharpMethod(w)`. 4. Python.NET has to unwrap `w`, so it reads the reference to `a` from it. Prior to this change in 4. Python.NET had to determine what kind of an object `a` is. If it is an exception, a different offset needed to be used. That check was very expensive (up to 4 calls into Python interpreter). This change replaces that check with computing offset unconditionally by subtracting a constant from the object size (which is read from the wrapper), thus avoiding calls to Python interpreter.
Can load .NET Core into python Pass clr PyObject back to Python
Copy link
Author

@gsalaz98gsalaz98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an initial review. Expect more to come in the future

return;
}

if (!GetClrFilesAbsolutePath(pn_args->entry_path, "/home/gerry/dotnet/shared/Microsoft.NETCore.App/2.0.0", &pn_args->clr_path))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to figure out a way to remove the hard coded path from here. I believe that we can pass NULL as the parameter value and it'll try to determine the path automatically.

# http://stackoverflow.com/a/4792601/5208670
CONFIG = "Release" # Release or Debug
VERBOSITY = "minimal" # quiet, minimal, normal, detailed, diagnostic
VERBOSITY = "normal" # quiet, minimal, normal, detailed, diagnostic
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset verbosity back to "minimal"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a good reason to change it.

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file might not be needed

@Martin-Molinero
Copy link
Member

Closed in favor of #47

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@gsalaz98@Martin-Molinero@AlexCatarino@mchandschuh@jaredbroad@amos402@civilx64@lostmsu@Oceania2018