Why Small Python
CPython is the official one; PyPy is a JIT. Jython is old. GraalPy needs the JVM. MicroPython is for chips. Pydantic Monty is… okay, the closest to what I need, but its subtle differences from CPython here and there are such a pain in the ass.
I want something super lean with the least surprises. Only the core Python language features and builtin functions are needed. Whatever CPython produces, Small Python produces too. For other capabilities, you register functions in your host language. It should also be metered, so that when the runtime runs LLM-generated code, it can abort, pause, or resume.
Small Python has a QuickJS-like architecture: one single spy.h/spy.c (35k LoC so far). I trimmed all the standard libraries away, leaving only sys, which can change the interpreter behavior (and it’s optional). So many PyPI packages, and uv, won’t work with Small Python as of now. But removing the libraries doesn’t mean it is weak. It opens a new door to a wider language ecosystem: you can totally build host functions in Rust/Go/C and link them into the program.
Code metering is something CPython would never have. If a piece of code reaches its budget, it should be halted. If the code is paused because a cloud worker was killed, the agent can resume it on another machine and keep executing. This is essential for a coding agent’s codemode to behave well, and Small Python is starting to support it. Since all executed Python code lives on the heap, with no recursive C, it’s safe to pause anywhere and resume later (on the roadmap 😄).
The performance outcome is amazing, though: it beats CPython’s speed (it runs in about 0.8x of CPython’s time) and only needs a tiny amount of memory.
Another feature I have always wanted over the past decades is compiling a Python app into a super small binary. None of the packaging tools can do that: you need to bundle Python, the packages, etc. Small Python can compile Python code together with Go/Rust/C. For example, a mini Minecraft clone built with the Small Python toolchain produces a binary of less than 3MB.
The roadmap going forward includes distributed sandboxing workers, coding agent integrations, tracking upstream Python, etc.
With all that said, small, fast, no surprises, and compilation are an unusual feature set in the Python world. And Small Python takes that tiny sweet spot.