Skip to content
sigilcoPublic

About

Compile annotated Python to native binaries. Typed subset, opt-in CPython fallback.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

pyscriptc

pyscriptc

Compile annotated Python to a native binary.

PyPI PyPI downloads per month CI License

pyscriptc compiles typed Python to native executables. It uses Python's inferred types and type hints to generate machine code from supported code.

Quick start

# hello.py
def main() -> None:
    print("hello from a native binary")


if __name__ == "__main__":
    main()
pyscriptc run hello.py

Live per-module and per-library support status: the compat site.

pyscriptc is experimental, aims for CPython compatibility, and supports a subset of Python, its builtins and standard library, and selected PyPI packages. Code outside the subset stops the build with a diagnostic code (PSxxxx) that names the exact line, or runs through embedded CPython (fallback mode) when you opt in with --island or --fallback=cpython. Fallback mode links against the host CPython: it is not bundled, and a Python installation is expected on the machine.

Installation

macOS and Linux:

curl -LsSf https://raw.githubusercontent.com/sigilco/pyscriptc/master/docs/install.sh | sh

Windows:

powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/sigilco/pyscriptc/master/docs/install.ps1 | iex"

The script checks the prerequisites, installs what it can, installs pyscriptc and runs pyscriptc doctor. It never uses sudo or an admin shell.

Install with your coding agent

Paste this into your coding agent:

Install pyscriptc from https://pyscriptc.pages.dev/llms.txt, run `pyscriptc doctor`,
then compile and run a hello world with it.
Install with uv
uv tool install pyscriptc

Building a binary needs a clang (or zig) on your PATH; pyscriptc doctor checks. See Getting started for the full toolchain setup.

The examples above need no C toolchain; building a binary needs clang or zig on your PATH (pyscriptc doctor checks). Windows: the pyscriptc binary runs there (experimental) and coverage works. Emitted programs are experimental cross-compilation only: pyscriptc compile FILE --target x86_64-windows-gnu --driver zig builds a Windows binary from Linux or macOS, but no CI job runs the output and Windows semantics are unverified. Native Windows compiles are not supported yet.

Documentation

Documentation site, including the CLI reference, the Python subset and how pyscriptc compares with other tools.

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

Hello world

# hello.py
def main() -> None:
    print("hello from a native binary")


if __name__ == "__main__":
    main()

Run it directly, or build a binary:

pyscriptc run hello.py
pyscriptc compile hello.py --emit bin -o hello && ./hello

Benchmarks

Group Time Peak memory
Kernels (sum-squares, floor-sum, horner, repeat-len) 23.9x faster 5.8x smaller
Scripting 22.2x faster 6.0x smaller
Stdlib calls 14.4x faster 5.2x smaller

Compiled binary versus the same call under CPython 3.14.9, geometric mean per workload group, higher is better. Reference recorded 2026-10-15 on one Linux x86_64 host (8 CPUs, 5 runs per sample).

Source: benchmarks/baseline/reference.json. Fresh numbers are in the job summary of the latest nightly run. Reproduce with uv run python -m benchmarks.baseline.run --check.

What it does not do yet

Code outside the supported subset stops the build with a PSxxxx diagnostic that names the exact line, and a native binary has no interpreter inside it, so dynamic patterns that need one do not run. The concrete fences and their causes are in Diagnostics, the behavior differences from CPython are in Divergences from CPython, and the live per-module and per-library status is on the compat site.

Using PyPI packages

We keep track of the share of the top 100 PyPI libraries that compiles. Mind that the compiler requires typed code. Per-module and per-library support status is tracked on the compat site, fed by the nightly CI workflow, so it cannot go stale the way a page would.

Contributing

See Contributing for setup and conventions. Reported behavior is covered by the Code of Conduct.

License

Apache License 2.0. See LICENSE.

About

Compile annotated Python to native binaries. Typed subset, opt-in CPython fallback.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages