pyscriptc

pyscriptc

pyscriptc

Compile annotated Python to a native binary.

Get started · GitHub · PyPI

For agents: llms.txt, llms-full.txt

What it does

  • Type-first: pyscriptc compiles a Python subset that follows strict rules: typed, with no shims or dynamic runtime emulation for untyped Python.
  • Native output: Python code is compiled to machine code via LLVM. The result has no interpreter inside. Ship a single file and cross-compile to your target platform.
  • Gradual adoption: code that doesn’t fit in the subset can be wrapped in an in-process embedded CPython island (libpython). You can also integrate compiled code via bindings.
  • Clear debugging: anything the subset does not prove is a fence with a diagnostic code (PSxxxx).

Try it now

uv tool install pyscriptc
pyscriptc compile examples/sum_squares.py --run --call sum_squares --args '[10]' -o /tmp/sum_squares

That prints 285, the same value CPython returns, from a native binary.