CSnakes.Stage 2.0.0-beta.326

This is a prerelease version of CSnakes.Stage.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet tool install --global CSnakes.Stage --version 2.0.0-beta.326
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local CSnakes.Stage --version 2.0.0-beta.326
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CSnakes.Stage&version=2.0.0-beta.326&prerelease
                    
nuke :add-package CSnakes.Stage --version 2.0.0-beta.326
                    

CSnakes - a tool for embedding Python code into .NET projects

Documentation

NuGet Version

<img src="docs/res/logo.jpeg" alt="drawing" width="200"/>

CSnakes is a .NET Source Generator and Runtime that you can use to embed Python code and libraries into your C#.NET Solution at a performant, low-level without the need for REST, HTTP, or Microservices.

Check out the getting started guide or check out the demo solution to see more.

Features

Benefits

  • Uses native Python type hinting standards to produce clean, readable C# code with minimal boiler plate!
  • Integration between .NET and Python is done at the C-API, meaning strong compatibility between Python versions 3.8-3.13 and .NET 8-9.
  • Integration is low-level and high-performance.
  • CSnakes uses the CPython C-API and is compatible with all Python extensions.
  • Invocation of Python code and libraries is in the same process as .NET

<br />

CSnakes Demo Video

Click to watch the CSnakes demo video on YouTube

<br />

Example

CSnakes will generate a C#.NET class for any Python file in a project that is tagged as CSharp Analyzer Additional File (see Getting Started). All functions in that class with type annotations will be reflected to callable C# methods and an environment builder added to that module.

System diagram

Given the following Python file called example.py


def hello_world(name: str, age: int) -> str:
  return f"Hello {name}, you must be {age} years old!"

CSnakes will generate a static .NET class called Example with the function:

public class Example {
  public static string HelloWorld(string name, long age) {
    ...
  }
}

When called, HelloWorld() will invoke the Python function from example.py using Python's C-API and return native .NET types.

FAQ

See the FAQ for more information.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
2.0.0-beta.335 49 5/16/2026
2.0.0-beta.334 50 5/14/2026
2.0.0-beta.333 48 5/7/2026
2.0.0-beta.332 40 5/6/2026
2.0.0-beta.331 59 4/11/2026
2.0.0-beta.330 49 4/11/2026
2.0.0-beta.329 52 4/11/2026
2.0.0-beta.328 68 3/29/2026
2.0.0-beta.327 68 3/27/2026
2.0.0-beta.326 172 3/23/2026
2.0.0-beta.325 55 3/22/2026
2.0.0-beta.324 60 2/20/2026
2.0.0-beta.323 71 2/8/2026
2.0.0-beta.322 55 2/6/2026
2.0.0-beta.321 49 2/6/2026
2.0.0-beta.320 78 2/5/2026
2.0.0-beta.319 64 1/14/2026
2.0.0-beta.318 68 1/5/2026
2.0.0-beta.317 76 12/31/2025
1.2.1 9,749 8/8/2025
Loading failed