Quick Start
The fastest way to get started with CSnakes is to use the supplied template for a C# console project with the dotnet new
command.
Alternatively, you can install the Nuget package and setup CSnakes in your environment. See installation for more details.
Using Templates
The templates are installed by running the following command:
To create a C# console application project with the default options, run the following commands:
If you run the new application with:
It will print a greetings message from within a Python function that is invoked by C#! This may take a bit the first time you run it because CSnakes will download the Python runtime in a fully isolated environment for the application.
To explore the various options offered by the pyapp
template, run with the -h
flag:
What You Get
The template creates:
- A C# console application with CSnakes.Runtime package
- Example Python files with proper type annotations
- Configured project file with Python files marked for source generation
- A simple example demonstrating Python function calls from C#
Next Steps
- Learn about installation for manual setup
- Try the first example to understand the basics
- Explore templates for different project types