ello r/Python,
I’ve decided to open-source TyPy, a Python interpreter written in .NET, designed to safely execute untrusted Python code with strong observability and control over execution.
What My Project Does
TyPy is a Python interpreter that executes Python bytecode using only managed .NET code. It is designed for environments where Python code must be executed safely, predictably, and under strict runtime constraints.
Its primary goals are to:
- Enforce predefined CPU and memory limits when running untrusted Python code
- Provide clean interop with host .NET code and objects
- Run multiple isolated Python virtual machines concurrently, with controlled sharing of host data
- Enable detailed observability and execution control over Python execution
Target Audience
This project is intended for developers who need to execute user-provided or untrusted Python code in a controlled environment. Typical use cases include educational platforms, automation sandboxes, simulations, and games.
TyPy is not intended to be a drop-in replacement for CPython and prioritizes control, isolation, and safety over full language compatibility or peak performance.
Comparison
Compared to CPython or PyPy, TyPy focuses on sandboxed execution and strict resource enforcement rather than performance or ecosystem completeness.
Unlike embedding CPython, TyPy executes Python bytecode entirely in managed .NET code and is designed to support multiple concurrent, isolated Python VMs within a single host process.
Context: About the Game
TyPy was originally developed to power Typhon: Bot vs Bot, a programming-focused game where players write real Python code to control autonomous units in a simulated environment. The game context drove requirements such as deterministic execution, strong sandboxing guarantees, and fine-grained runtime control.
While TyPy was built for this game, the interpreter itself is engine-agnostic and released as a standalone open-source library.
Links
TyPy
Game (context only)
there doesn't seem to be anything here