Chow 0.2.0-preview
This is a prerelease version of Chow.
dotnet add package Chow --version 0.2.0-preview
NuGet\Install-Package Chow -Version 0.2.0-preview
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="Chow" Version="0.2.0-preview" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Chow" Version="0.2.0-preview" />
<PackageReference Include="Chow" />
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 Chow --version 0.2.0-preview
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Chow, 0.2.0-preview"
#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 Chow@0.2.0-preview
#: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=Chow&version=0.2.0-preview&prerelease
#tool nuget:?package=Chow&version=0.2.0-preview&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
.----------------. .----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. |
| | _/\_/\ | || | ____ ____ | || | ____ | || | _____ _____ | |
| | .' ___ | | || | |_ || _| | || | .' `. | || ||_ _||_ _|| |
| | / .' \_| | || | | |__| | | || | / .--. \ | || | | | /\ | | | |
| | | | | || | | __ | | || | | | | | | || | | |/ \| | | |
| | \ `.___.'\ | || | _| | | |_ | || | \ `--' / | || | | /\ | | |
| | `._____.' | || | |____||____| | || | `.____.' | || | |__/ \__| | |
| | | || | | || | | || | | |
| '--------------' || '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '----------------' '----------------'
--------------------------------------------------------------------------------
LANGUAGE INTERPRETER FOR .NET
--------------------------------------------------------------------------------
Chow
A Python sublanguage interpreter written entirely in C# for embedding in .NET projects. It provides a sandboxed scripting environment featuring OOP, LEGB-enforced scope, closures, and more. Chow targets .NET Standard 2.0 and has no external dependencies.
Use Cases
- Run safe, sandboxed Python code in your .NET application.
- Mix native .NET objects and functions with Chow code.
- Support scripting in .NET applications, allowing users to customize their applications using Chow (e.g., Unity/Godot games).
- Write frontend Python code for your Blazor applications.
- Add functionality to an application after it's already built using Chow scripts (even AOT-compiled applications).
Features
The following is a list of features already implemented in Chow:
API
- Inline Chow code execution.
- AOT compatibility.
- Interoperable .NET and Chow objects and variables.
- Sandboxed, managed Chow scopes (e.g., variables, functions, etc.).
- .NET delegate calls in Chow.
Data Types
- int, float, bool, str, None
- list, dict, range
- functions (first-class objects)
- classes and their instances
Literals
- Numbers: 42, 3.14
- Strings: "hello"
- F-strings: f"hi {name}"
- True, False, None
- List [1, 2, 3] and dict {"a": 1} literals
- Comments: # This is a comment
Operators
- Arithmetic: + - * / // % **
- Comparison: == != < ⇐ > >=
- Logical: and or not (short-circuit)
- Identity/membership: is, in, not in
- Dict merge: |
- Unary: -x, not x
Variables & Scope
- Assignment, function-level scoping (LEGB lookup)
- global and nonlocal declarations
Control Flow
- if / elif / else
- while loops
- for ... in ... loops
- break, continue, pass
Functions
- def with parameters and return
- Closures (capture enclosing variables live)
- First-class — pass and store functions as values
Classes
- class declarations with an
__init__constructor - instance fields assigned through
self - methods (
selfis an explicit first parameter, as in Python) - class-level variables, readable through the class or an instance
- Not supported: inheritance,
super(), decorators such as@classmethod/@staticmethod, and dunder dispatch (__str__,__eq__,__len__)
Lists
- Indexing, negative indices, slicing (a[1:5:2]), assignment, iteration
- Methods: append, insert, pop, remove, reverse, clear
- Membership (in), structural equality, len()
Dictionaries
- Key access/assignment, merge
- Methods: clear, copy, get, items, keys, pop, popitem, update, values
Ranges
- range(stop), range(start, stop), range(start, stop, step)
Built-in Functions
- print, input, clear, len, abs, round, min, max, range, and type constructors int, float, str, bool, list, and dict.
Getting Started
Install via NuGet:
dotnet add package Chow --prerelease
Run a snippet:
using Chow;
ChowObject result = ChowEngine.Run("1 + 2");
Console.WriteLine(result.ToString()); // 3
Pass variables in via a scope:
using Chow;
var scope = new ChowScope();
scope["name"] = "world";
ChowEngine.Run("greeting = f'Hello, {name}!'", scope);
ChowObject greeting = scope["greeting"];
Console.WriteLine(greeting.ToString()); // Hello, world!
Expose a .NET delegate to Chow code:
using Chow;
var scope = new ChowScope();
scope["greet"] = ChowObject.Create((object name) => $"Greetings {name}.");
ChowEngine.Run("print(greet(\"Linus\"))", scope); // Greetings Linus.
Handle errors:
using Chow;
try
{
ChowEngine.Run("x = 1 / 0");
}
catch (RuntimeException ex)
{
Console.WriteLine(ex.Message); // ZeroDivisionError: division by zero on line 1
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-preview | 65 | 8/29/2026 |
| 0.1.4-preview | 80 | 6/30/2026 |