Puerts.Python.NativeAssets.Linux 3.0.3

Prefix Reserved
dotnet add package Puerts.Python.NativeAssets.Linux --version 3.0.3
                    
NuGet\Install-Package Puerts.Python.NativeAssets.Linux -Version 3.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Puerts.Python.NativeAssets.Linux" Version="3.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Puerts.Python.NativeAssets.Linux" Version="3.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Puerts.Python.NativeAssets.Linux" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Puerts.Python.NativeAssets.Linux --version 3.0.3
                    
#r "nuget: Puerts.Python.NativeAssets.Linux, 3.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Puerts.Python.NativeAssets.Linux@3.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Puerts.Python.NativeAssets.Linux&version=3.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Puerts.Python.NativeAssets.Linux&version=3.0.3
                    
Install as a Cake Tool

PuerTS — Python for .NET

license Puerts.Python.Complete

PuerTS is a scripting solution that brings Python (CPython) to your .NET applications. It provides seamless C# interop — using the same unified ScriptEnv API as the JavaScript and Lua backends. Great for AI/ML integration, tooling, and rapid prototyping.

Features

  • 🐍 CPython Powered — Run real Python code with full CPython runtime.
  • 🔗 Seamless C# Interop — Call any .NET type directly from Python, and invoke Python functions from C#.
  • 🤖 AI/ML Ready — Ideal for integrating Python-based AI/ML libraries with .NET applications.
  • 🔄 Unified API — Same ScriptEnv architecture as JS and Lua backends — easy to switch or mix languages.

Installation

Install via NuGet. The Complete package includes core + native assets for all desktop platforms:

dotnet add package Puerts.Python.Complete

Or install components separately for finer control:

# Core library (required)
dotnet add package Puerts.Core

# Python backend
dotnet add package Puerts.Python

# Native assets per platform (choose what you need)
dotnet add package Puerts.Python.NativeAssets.Win32
dotnet add package Puerts.Python.NativeAssets.Linux
dotnet add package Puerts.Python.NativeAssets.macOS

Supported Platforms

.net8.0+, .netstandard2.1

Windows (x64) Linux (x64) macOS (arm64)
Python ✔️ ✔️ ✔️

Note: The macOS native assets currently support osx-arm64 only.

Note: AOT compilation is not currently supported.

Quick Start

using Puerts;

var env = new ScriptEnv(new BackendPython());

// Execute Python code
env.Eval("print('Hello from Python!')");

// Eval with return value
int result = env.Eval<int>("1 + 2");
Console.WriteLine($"Python result: {result}"); // output: 3

env.Dispose();

Multi-line Code

Python is indentation-sensitive. For multi-line code blocks, wrap with exec('''...'''):

var env = new ScriptEnv(new BackendPython());

env.Eval(@"
exec('''
def greet(name):
    print('Hello, ' + name + '!')

greet('PuerTS')
''')
");
// output: Hello, PuerTS!

env.Dispose();

Calling Python from C#

using Puerts;
using System;

var env = new ScriptEnv(new BackendPython());

// Get a Python lambda as a C# delegate
var add = env.Eval<Func<int, int, int>>("lambda a, b: a + b");
Console.WriteLine(add(10, 20)); // output: 30

// Define a function via exec, then retrieve it
env.Eval(@"
exec('''
def greet(name):
    print('Hello,' + name + '!')
''')
");
var greet = env.Eval<Action<string>>("greet");
greet("PuerTS"); // output: Hello,PuerTS!

env.Dispose();

Key Differences from JS/Lua

Feature JavaScript Lua Python
Environment creation new ScriptEnv(new BackendV8()) new ScriptEnv(new BackendLua()) new ScriptEnv(new BackendPython())
Console output console.log(...) print(...) print(...)
Multi-line code Write directly Write directly Wrap with exec('''...''')
Accessing C# types CS.Namespace.Class require('csharp') import Namespace.Class
Instance method calls obj.Method() obj:Method() obj.Method()
Null representation null / undefined nil None

Documentation

For full documentation, tutorials and API reference, visit: https://puerts.github.io/en

License

BSD 3-Clause

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Puerts.Python.NativeAssets.Linux:

Package Downloads
Puerts.Python.Complete

Puerts is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via V8/Nodejs/Quickjs) and Lua.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.3 183 9/5/2026
3.0.2 419 4/2/2026
3.0.1 423 3/4/2026
3.0.0-beta1 718 12/8/2025