skillfed

pythonnet

.NET and Mono integration for Python

pythonnet v3.1.0 3.6M downloads/30d#2,556 on PyPI5,508
Permissive license MIT Active released

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 pythonnet

uv

uv add pythonnet

poetry

poetry add pythonnet

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: C#Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

.NET integration from Pythoncall C# from PythonPython CLR interopembed Python in .NETMono integration PythonPython .NET bridgeCLR namespace access
interopdotnet-integrationclr-bridge

More Software Development packages