Skip to content

tonybaloney/CSnakes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

502f37d · Feb 14, 2025
Sep 19, 2024
Jan 13, 2025
Aug 15, 2024
Feb 14, 2025
Nov 29, 2024
Feb 14, 2025
Sep 17, 2024
Oct 18, 2024
Aug 13, 2024
Oct 2, 2024
Feb 14, 2025

Repository files navigation

CSnakes - a tool for embedding Python into .NET projects

Warning

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

Documentation

NuGet Version

drawing

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.