# tonybaloney/CSnakes

Embed Python in .NET

Repository: https://github.com/tonybaloney/CSnakes
Canonical: https://ross.abutalabs.com/products/csnakes
Homepage: https://tonybaloney.github.io/CSnakes/
Language: C#
License: MIT
License Family: permissive
Topics: csharp, dotnet, python
Last push: 2026-08-23T12:25:23+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 42, longevity 55
- inputs: {"age_days": 776, "days_push": 10, "days_rel": 390, "gap_med": 11.0, "n_releases_24m": 21}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1113, forks 72 (observed 2026-08-28T04:03:38.095704+00:00)

## What it is
CSnakes is a .NET source generator and runtime library for embedding Python code and libraries directly into C# .NET applications via the CPython C-API. It generates strongly-typed C# wrappers from Python type hints, enabling fast in-process interop without REST or microservices.

## Use cases
- call python code from c#
- embed python in a .net application
- use python libraries like numpy from c#
- interop between dotnet and python without http
- generate c# bindings from python type hints
- run python machine learning models inside a .net app

## When to choose
- you need high-performance, in-process Python/.NET interop without network overhead
- you want strongly-typed C# method signatures generated from Python type annotations
- you need to use Python packages with C extensions (like NumPy) from .NET

## When to avoid
- you need to call .NET code from Python rather than the other way around
- you want a language-agnostic RPC or microservice boundary between Python and .NET
- your Python code must run in a separate process for isolation or stability

## Facets
- artifact type: library
- maturity: active
- function: sdk, parser, developer-tools
- domain: developer-tools, cross-platform, machine-learning
- platform: dotnet, python, windows, cross-platform
- tags: python-interop, csharp-source-generator, cpython-c-api, interop, numpy, macos, linux

## Member repositories
- tonybaloney/CSnakes (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:38.095704+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:42:38.155098+00:00, confidence not recorded.
  - readme: https://github.com/tonybaloney/CSnakes (fetched 2026-08-28T04:03:38.095704+00:00, sha 46098d1ab407)
  - homepage: https://tonybaloney.github.io/CSnakes/ (fetched 2026-08-29T12:46:16.479211+00:00, sha 772d2cc74175)
- Data as of 2026-08-30T08:39:29.467469+00:00.
