CSnakes.Runtime 1.2.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CSnakes.Runtime --version 1.2.1
                    
NuGet\Install-Package CSnakes.Runtime -Version 1.2.1
                    
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="CSnakes.Runtime" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSnakes.Runtime" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="CSnakes.Runtime" />
                    
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 CSnakes.Runtime --version 1.2.1
                    
#r "nuget: CSnakes.Runtime, 1.2.1"
                    
#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 CSnakes.Runtime@1.2.1
                    
#: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=CSnakes.Runtime&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=CSnakes.Runtime&version=1.2.1
                    
Install as a Cake Tool

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 was computed.  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.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on CSnakes.Runtime:

Package Downloads
Glidergun

Package Description

Harbour.NETCore.CSnakes

Harbour.NETCore.CSnakes

Evergine.Runtimes.USD

Package Description

TransformersSharp

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on CSnakes.Runtime:

Repository Stars
tonybaloney/TransformersSharp
A little wrapper for hugging face transformers in C#
Version Downloads Last Updated
2.0.0-beta.317 35 12/31/2025
2.0.0-beta.316 32 12/31/2025
2.0.0-beta.315 36 12/30/2025
2.0.0-beta.314 44 12/27/2025
2.0.0-beta.313 207 12/22/2025
2.0.0-beta.312 163 12/21/2025
2.0.0-beta.311 123 12/21/2025
2.0.0-beta.310 109 12/21/2025
2.0.0-beta.309 159 12/19/2025
2.0.0-beta.308 193 12/19/2025
2.0.0-beta.307 197 12/19/2025
2.0.0-beta.306 262 12/17/2025
2.0.0-beta.305 232 12/14/2025
2.0.0-beta.304 113 12/13/2025
2.0.0-beta.303 66 12/13/2025
2.0.0-beta.302 159 11/30/2025
2.0.0-beta.301 72 11/29/2025
2.0.0-beta.300 65 11/29/2025
2.0.0-beta.299 65 11/29/2025
2.0.0-beta.298 130 11/27/2025
2.0.0-beta.297 148 11/25/2025
2.0.0-beta.296 192 10/26/2025
2.0.0-beta.295 126 10/26/2025
2.0.0-beta.294 180 10/22/2025
2.0.0-beta.293 152 10/12/2025
2.0.0-beta.292 116 10/12/2025
2.0.0-beta.291 182 10/1/2025
2.0.0-beta.290 133 10/1/2025
2.0.0-beta.289 211 9/19/2025
2.0.0-beta.288 182 9/19/2025
2.0.0-beta.287 225 9/19/2025
2.0.0-beta.286 277 9/18/2025
2.0.0-beta.285 261 9/18/2025
2.0.0-beta.284 267 9/18/2025
2.0.0-beta.283 255 9/18/2025
2.0.0-beta.282 271 9/18/2025
2.0.0-beta.281 259 9/18/2025
2.0.0-beta.280 255 9/18/2025
2.0.0-beta.279 261 9/17/2025
2.0.0-beta.278 272 9/17/2025
2.0.0-beta.277 269 9/17/2025
2.0.0-beta.276 255 9/15/2025
2.0.0-beta.275 193 9/15/2025
2.0.0-beta.274 191 9/15/2025
2.0.0-beta.273 179 9/15/2025
2.0.0-beta.272 170 9/3/2025
2.0.0-beta.271 197 8/28/2025
2.0.0-beta.270 191 8/28/2025
2.0.0-beta.269 185 8/28/2025
2.0.0-beta.268 249 8/25/2025
2.0.0-beta.267 98 8/22/2025
2.0.0-beta.266 144 8/20/2025
2.0.0-beta.265 138 8/18/2025
2.0.0-beta.264 128 8/18/2025
2.0.0-beta.263 127 8/18/2025
2.0.0-beta.262 131 8/18/2025
2.0.0-beta.261 150 8/14/2025
2.0.0-beta.260 149 8/13/2025
2.0.0-beta.259 147 8/12/2025
2.0.0-beta.258 149 8/12/2025
1.2.1 19,415 8/8/2025
1.2.1-beta.257 136 8/12/2025
1.2.1-beta.256 153 8/12/2025
1.2.1-beta.255 131 8/9/2025
1.2.1-beta.254 195 8/8/2025
1.2.0 1,125 8/1/2025
1.2.0-beta.253 190 8/8/2025
1.2.0-beta.252 195 8/8/2025
1.2.0-beta.250 95 8/1/2025
1.1.0 9,821 6/24/2025
1.1.0-beta.249 99 8/1/2025
1.1.0-beta.246 481 7/24/2025
1.1.0-beta.245 486 7/24/2025
1.1.0-beta.244 527 7/23/2025
1.1.0-beta.243 532 7/22/2025
1.1.0-beta.242 523 7/22/2025
1.1.0-beta.241 143 7/15/2025
1.1.0-beta.240 131 7/14/2025
1.1.0-beta.239 143 7/9/2025
1.1.0-beta.238 144 7/8/2025
1.1.0-beta.237 146 6/25/2025
1.1.0-beta.236 144 6/24/2025
1.1.0-beta.235 145 6/24/2025
1.0.35 6,678 6/5/2025
1.0.35-beta.234 138 6/24/2025
1.0.35-beta.233 141 6/24/2025
1.0.35-beta.232 140 6/24/2025
1.0.35-beta.231 138 6/23/2025
1.0.35-beta.230 142 6/23/2025
1.0.35-beta.229 138 6/23/2025
1.0.35-beta.228 147 6/23/2025
1.0.35-beta.227 140 6/23/2025
1.0.35-beta.226 147 6/18/2025
1.0.35-beta.225 146 6/18/2025
1.0.35-beta.224 144 6/16/2025
1.0.35-beta.223 145 6/15/2025
1.0.35-beta.222 138 6/15/2025
1.0.35-beta.221 151 6/15/2025
1.0.35-beta.220 136 6/15/2025
1.0.35-beta.219 127 6/15/2025
1.0.35-beta.218 129 6/15/2025
1.0.35-beta.217 132 6/15/2025
1.0.35-beta.216 144 6/14/2025
1.0.35-beta.215 282 6/12/2025
1.0.35-beta.214 283 6/12/2025
1.0.35-beta.213 289 6/11/2025
1.0.35-beta.212 278 6/11/2025
1.0.35-beta.211 286 6/11/2025
1.0.35-beta.210 289 6/11/2025
1.0.35-beta.209 290 6/11/2025
1.0.35-beta.208 76 6/6/2025
1.0.35-beta.207 141 6/5/2025
1.0.34 2,469 5/25/2025
1.0.34-beta.206 149 6/5/2025
1.0.34-beta.205 142 6/4/2025
1.0.34-beta.204 145 6/4/2025
1.0.34-beta.203 141 6/4/2025
1.0.34-beta.202 139 6/4/2025
1.0.34-beta.201 143 6/4/2025
1.0.34-beta.200 140 6/3/2025
1.0.34-beta.199 145 6/2/2025
1.0.34-beta.198 149 6/2/2025
1.0.34-beta.197 142 6/2/2025
1.0.34-beta.196 107 5/25/2025
1.0.34-beta.195 107 5/25/2025
1.0.33 1,318 5/7/2025
1.0.33-beta.194 70 5/24/2025
1.0.33-beta.193 126 5/23/2025
1.0.33-beta.192 91 5/23/2025
1.0.33-beta.191 123 5/23/2025
1.0.33-beta.190 168 5/8/2025
1.0.33-beta.189 138 5/8/2025
1.0.33-beta.188 187 5/7/2025
1.0.32 751 4/29/2025
1.0.32-beta.187 171 5/7/2025
1.0.32-beta.186 141 5/6/2025
1.0.32-beta.185 145 5/5/2025
1.0.32-beta.184 168 5/5/2025
1.0.32-beta.183 176 4/30/2025
1.0.32-beta.182 189 4/30/2025
1.0.32-beta.181 148 4/30/2025
1.0.32-beta.180 162 4/29/2025
1.0.31 1,406 4/23/2025
1.0.31-beta.179 170 4/28/2025
1.0.31-beta.178 190 4/28/2025
1.0.31-beta.177 163 4/28/2025
1.0.31-beta.176 159 4/28/2025
1.0.31-beta.175 155 4/28/2025
1.0.31-beta.174 168 4/27/2025
1.0.31-beta.173 191 4/24/2025
1.0.31-beta.172 164 4/24/2025
1.0.31-beta.171 158 4/24/2025
1.0.31-beta.170 161 4/24/2025
1.0.31-beta.169 156 4/24/2025
1.0.31-beta.168 180 4/23/2025
1.0.31-beta.167 158 4/23/2025
1.0.31-beta.166 158 4/23/2025
1.0.31-beta.165 170 4/23/2025
1.0.30 4,131 3/26/2025
1.0.30-beta.164 163 4/23/2025
1.0.30-beta.163 155 4/22/2025
1.0.30-beta.162 179 4/22/2025
1.0.30-beta.161 158 4/18/2025
1.0.30-beta.160 190 4/17/2025
1.0.30-beta.159 184 4/6/2025
1.0.30-beta.158 164 4/6/2025
1.0.30-beta.157 189 4/4/2025
1.0.30-beta.156 156 4/3/2025
1.0.30-beta.155 152 4/3/2025
1.0.30-beta.154 160 4/3/2025
1.0.30-beta.153 164 4/3/2025
1.0.30-beta.152 182 3/30/2025
1.0.30-beta.151 475 3/26/2025
1.0.29 619 3/14/2025
1.0.29-beta.150 473 3/26/2025
1.0.29-beta.149 149 3/21/2025
1.0.29-beta.148 155 3/20/2025
1.0.29-beta.147 181 3/17/2025
1.0.29-beta.146 166 3/16/2025
1.0.29-beta.145 139 3/14/2025
1.0.28 265 3/12/2025
1.0.28-beta.144 144 3/14/2025
1.0.28-beta.143 200 3/12/2025
1.0.27 2,333 2/14/2025
1.0.27-beta.142 185 3/12/2025
1.0.27-beta.141 162 3/12/2025
1.0.27-beta.140 166 3/10/2025
1.0.27-beta.139 102 2/28/2025
1.0.27-beta.138 98 2/14/2025
1.0.26 6,905 1/27/2025
1.0.26-beta.137 99 2/14/2025
1.0.26-beta.136 102 2/10/2025
1.0.26-beta.135 136 1/27/2025
1.0.25 549 1/14/2025
1.0.25-beta.134 90 1/27/2025
1.0.25-beta.133 93 1/22/2025
1.0.25-beta.132 95 1/22/2025
1.0.25-beta.131 90 1/22/2025
1.0.25-beta.130 112 1/14/2025
1.0.25-beta.129 79 1/14/2025
1.0.25-beta.128 111 1/14/2025
1.0.24 238 1/13/2025
1.0.24-beta.127 81 1/13/2025
1.0.24-beta.126 89 1/13/2025
1.0.24-beta.125 89 1/13/2025
1.0.23 363 1/10/2025
1.0.23-beta.124 110 1/13/2025
1.0.23-beta.123 83 1/12/2025
1.0.23-beta.122 122 1/12/2025
1.0.23-beta.121 94 1/11/2025
1.0.23-beta.120 87 1/10/2025
1.0.22-beta.119 85 1/10/2025
1.0.21 3,297 10/15/2024
1.0.21-beta.118 82 1/10/2025
1.0.21-beta.117 113 1/8/2025
1.0.21-beta.116 88 1/8/2025
1.0.21-beta.115 124 11/2/2024
1.0.21-beta.114 116 10/30/2024
1.0.21-beta.113 100 10/29/2024
1.0.21-beta.112 98 10/29/2024
1.0.21-beta.111 97 10/29/2024
1.0.21-beta.110 94 10/29/2024
1.0.21-beta.109 119 10/22/2024
1.0.21-beta.108 123 10/20/2024
1.0.21-beta.107 121 10/20/2024
1.0.21-beta.106 115 10/20/2024
1.0.21-beta.105 137 10/18/2024
1.0.21-beta.104 91 10/17/2024
1.0.21-beta.103 96 10/17/2024
1.0.21-beta.102 84 10/15/2024
1.0.20 510 10/11/2024
1.0.20-beta.101 98 10/15/2024
1.0.20-beta.100 96 10/15/2024
1.0.20-beta.99 123 10/14/2024
1.0.20-beta.98 102 10/14/2024
1.0.20-beta.97 100 10/14/2024
1.0.20-beta.96 93 10/11/2024
1.0.19-beta.95 110 10/11/2024
1.0.19-beta.94 129 10/11/2024
1.0.19-beta.93 103 10/11/2024
1.0.19-beta.92 96 10/11/2024
1.0.19-beta.91 122 10/11/2024
1.0.19-beta.90 94 10/11/2024
1.0.19-beta.89 98 10/11/2024
1.0.18 1,173 9/23/2024
1.0.18-beta.88 99 10/11/2024
1.0.18-beta.87 88 10/10/2024
1.0.18-beta.86 108 10/7/2024
1.0.18-beta.85 101 10/6/2024
1.0.18-beta.84 96 10/6/2024
1.0.18-beta.83 109 9/25/2024
1.0.18-beta.82 96 9/24/2024
1.0.18-beta.80 99 9/23/2024
1.0.17 3,059 8/30/2024
1.0.17-beta.79 134 9/23/2024
1.0.17-beta.78 93 9/23/2024
1.0.17-beta.77 84 9/19/2024
1.0.17-beta.73 107 9/17/2024
1.0.17-beta.72 105 9/17/2024
1.0.17-beta.71 140 9/17/2024
1.0.17-beta.70 113 9/17/2024
1.0.17-beta.69 111 9/17/2024
1.0.17-beta.68 114 9/17/2024
1.0.17-beta.67 114 9/16/2024
1.0.17-beta.66 120 9/10/2024
1.0.17-beta.65 106 9/10/2024
1.0.17-beta.64 122 9/5/2024
1.0.17-beta.63 103 9/4/2024
1.0.17-beta.62 112 9/4/2024
1.0.17-beta.61 107 8/30/2024
1.0.17-beta.60 138 8/30/2024
1.0.16 779 8/21/2024
1.0.16-beta.59 145 8/30/2024
1.0.16-beta.58 125 8/29/2024
1.0.16-beta.57 106 8/28/2024
1.0.16-beta.56 111 8/28/2024
1.0.16-beta.55 110 8/28/2024
1.0.16-beta.54 160 8/23/2024
1.0.16-beta.53 131 8/23/2024
1.0.16-beta.52 165 8/22/2024
1.0.16-beta.51 124 8/21/2024
1.0.15-beta.50 129 8/21/2024
1.0.15-beta.49 148 8/21/2024
1.0.15-beta.48 143 8/21/2024
1.0.15-beta.47 168 8/21/2024
1.0.15-beta.46 118 8/21/2024
1.0.13 548 8/15/2024
1.0.13-beta.36 125 8/17/2024
1.0.13-beta.35 115 8/16/2024
1.0.13-beta.34 136 8/16/2024
1.0.13-beta.33 129 8/16/2024
1.0.13-beta.32 151 8/15/2024
1.0.13-beta.31 125 8/15/2024
1.0.11 266 8/14/2024
1.0.11-beta.30 133 8/15/2024
1.0.11-beta.29 139 8/15/2024
1.0.11-beta.28 119 8/14/2024
1.0.11-beta.27 118 8/14/2024
1.0.11-beta.26 132 8/14/2024
1.0.10 296 8/14/2024
1.0.10-beta.25 136 8/14/2024
1.0.10-beta.24 118 8/14/2024
1.0.9 267 8/14/2024
1.0.9-beta.23 132 8/14/2024
1.0.8 288 8/13/2024
1.0.8-beta.22 129 8/13/2024
1.0.8-beta.21 124 8/13/2024
1.0.8-beta.20 131 8/13/2024
1.0.8-beta.19 122 8/13/2024
1.0.8-beta.18 158 8/13/2024
1.0.8-beta.17 134 8/13/2024
1.0.7-beta.16 128 8/6/2024
1.0.6 270 8/5/2024
1.0.4-beta.14 104 8/3/2024
1.0.4-beta.13 99 8/3/2024
1.0.4-beta.12 118 8/3/2024
1.0.4-beta.11 119 8/1/2024
1.0.4-beta.10 114 8/1/2024
1.0.3-beta.8 104 8/1/2024
1.0.3-beta.7 121 8/1/2024
1.0.2 261 7/26/2024
1.0.1 272 7/26/2024
1.0.0 455 7/25/2024