Skip to main content
Published
Oct 15, 2024
2y ago
Total Downloads
484.9K
484,865

Install

dotnet add package CSnakes.Runtime --version 1.0.20-beta.100
ProductVersions
.NET
net8.0net9.0

README

CSnakes - a tool for embedding Python into .NET projects

This project is in prototype stage and the API is subject to change.

Documentation

NuGet Version

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

Architecture diagram of CSnakes

Features

Examples

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.

Changes from Previous Version

No structural changes between v1.0.20-beta.99 and v1.0.20-beta.100.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.