$${\color{#3c6491}(Py)}$$ dotnet $${\color{gray}|}$$ $${\color{#3c6491}Py\color{yellow}.\color{#693c91}NET}$$
pip install dotnet
-
$${\color{gray}PIP \space module \space name:}$$ dotnet
-
$${\color{gray}Repository \space name:}$$ PyDotnet
-
$${\color{gray}Open \space Source \space Release \space:}$$ 2016 on BitBucket -
$${\color{gray}Moved \space to \space GitHub \space in:}$$ March 2021
Direct interop between Python and .NET assemblies via Microsoft C++/CLR and Boost.Python.
This is regular module for native Python (CPython), and it uses .NET runtime library (mscoree.dll) to natively support .NET assemblies.
- Load into Python any .NET assembly
- Build .NET assembly directly in Python - no additional tools required!
- Experiment with .NET libraries
- Automate testing of .NET projects
- Build control panels using powerful .NET libraries, and flexibility of Python
PyDotnet only works on Windows due to integration with Microsoft .NET Framework (.NetCore C++/CLI for Linux and MacOS - Is not supported)
Works natively on Windows 64-Bit (x86), and also on Windows on ARM64 in AMD64 emulation mode.
Works well on Windows on ARM64 on Apple Silicon: Parallels® Desktop 18 for Mac
Haven't tested, but this might work: Windows-Docker-Machine
Stay tuned! More to come...
import dotnet.seamless
import System
from System.Collections.Generic import List
lst = List[Int32]()
lst.Add(1)
lst.Add(2)
lst.Add(3)
lst.AddRange([4,5,6])
lst.FindIndex(lambda x: x > 3)
Import .NET seamless integration for CPython shell
import dotnet.seamless
Import .NET namespace
import System
Import type from .NET namespace
from System.Collections.Generic import List
Create an instance of .NET type. This shows also how to specialize .NET generic type
lst = List[Int32]()
Call instance method of .NET type. This also converts Python int into .NET Int32
lst.Add(1)
lst.Add(2)
lst.Add(3)
Call instance method of .NET type. This also converts Python list into .NET IEnumerable
lst.AddRange([4,5,6])
Call instance method of .NET type. Here Python lambda gets converted into .NET Predicate. The invocation jumps from Python into .NET CLR and calls back to Python lambda
lst.FindIndex(lambda x: x > 3)
pip install dotnet
See https://github.com/sadhbh-c0d3/pydotnet/blob/main/SLIDES.md
See https://github.com/sadhbh-c0d3/pydotnet/blob/main/BUILD.md