pythonnet
.NET and Mono integration for Python
What it is and what it does
pythonnet bridges Python and the .NET Common Language Runtime, enabling two-way integration: Python code can import and call .NET namespaces and assemblies as if they were Python packages, while .NET applications can initialize a Python engine and invoke Python modules dynamically. It treats CLR namespaces as Python packages and provides a clr module for loading assemblies and managing the runtime.
The package supports multiple runtimes—Mono on Linux/macOS and .NET Framework on Windows by default, with .NET Core available via environment variable or explicit load call. For embedding Python in .NET, it requires setting the Python DLL path and managing thread access through a GIL context manager. It is actively maintained, supports modern Python versions (3.10–3.14), and has no known security vulnerabilities.
Use it for:
- Call Windows Forms or WPF UI libraries from Python scripts to build GUI applications with .NET components.
- Embed Python in a C# application to allow dynamic scripting or plugin functionality without rewriting core logic.
- Access .NET data structures and business logic from Python data science or automation workflows.
- Prototype or test .NET libraries interactively from Python before integrating them into larger .NET projects.
- Migrate legacy Python code to .NET incrementally by calling existing Python modules from new C# code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pythonnet enables Python code to call .NET and Mono libraries directly, and allows .NET applications to embed and invoke Python code with full CLR interoperability.
Yes, if you need to integrate Python with .NET or Mono. The package is production-stable, actively maintained, has low install friction, carries a permissive MIT license, and has no known vulnerabilities. The main constraint is the requirement for a .NET runtime on the target system; verify that your deployment environment has the necessary .NET/Mono installation before committing.
Install
pythonnet on PyPI
pip
pip install pythonnetuv
uv add pythonnetpoetry
poetry add pythonnetInstalling pythonnet
Before you install
Low friction install with a single runtime dependency (clr_loader). Active maintenance with recent commits and production-stable status. Supports Python 3.10 through 3.14.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both commercial and open-source projects.
Quickstart
pip install pythonnet
import clr
clr.AddReference("System.Windows.Forms")
.NET Framework, .NET Core, or Mono must be installed on the system; on Linux/macOS, Mono is used by default unless PYTHONNET_RUNTIME=coreclr is set.
Verify before relying
- Performance overhead of CLR interop calls compared to native .NET or pure Python
- Completeness of type mapping between Python and CLR for complex generic types
- Thread-safety guarantees beyond the documented GIL usage pattern
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — clr_loader |
| Maintenance | actively maintained — 83 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,618,934/month — #2,556 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pythonnet-3.1.0-cp310.cp311.cp312.cp313.cp314-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
clr_loaderLoads and provides a generic interface to call…
unclear · top 5,000 on PyPI
dotnetcore2Bundles the .NET Core 3.1 runtime as a Python…
permissive · top 15,000 on PyPI
powerfxProvides a Python bridge to invoke C# Power Fx…
permissive · top 15,000 on PyPI
dnfileParses .NET executable files to extract and…
permissive · top 15,000 on PyPI
cffiCFFI enables Python code to call C functions…
permissive · top 100 on PyPI
dncildncil is a Python library for disassembling…
permissive · top 15,000 on PyPI
py4jPy4J enables Python programs to dynamically…
permissive · top 1,000 on PyPI
pyobjcPyObjC bridges Python and Objective-C, enabling…
permissive · top 15,000 on PyPI
pyobjc-corePyObjC-core provides the foundational bridge…
permissive · top 5,000 on PyPI
PyQtWebEnginePyQtWebEngine provides Python bindings to embed…
copyleft · top 15,000 on PyPI