Compile a typed subset of Python to native code through LLVM
Pystachy compiles a typed subset of Python to native code through LLVM. Use it for CPU-bound work such as text processing, data repair, and simulation while keeping your code in Python. The compiler is self-hosting, and its JIT and AOT modes share the same typed intermediate representation.
Install the PyPI package in a Python 3.11+ virtual environment:
pip install pystachy The installation guide covers LLVM requirements and automatic toolchain setup. Native archives and Docker images are also available.
from fnmatch import fnmatchcase from functools import lru_cache @lru_cache(maxsize=256) def classify(name: str) -> str: return "api" if fnmatchcase(name, "api.*") else "other" print(classify("api.request"), classify("worker.done")) python3 demo.py # CPython reference pystachy run demo.py # Compile and run with JIT pystachy build demo.py -o demo # Build a native executable ./demo All three executions print api other. The executable runs without Python. The getting started guide walks through a diagnostic and shows how to measure compilation and execution separately.
Browse all examples for their purposes, checks and requirements. See the performance guide for measured workloads, startup and memory costs, and reproduction commands. On supported Linux native installs, run automatically reuses unchanged programs. PYSTACHY_PROGRAM_CACHE=0 forces compilation; build produces a standalone executable.
Pystachy is experimental. It supports typed containers, classes, generators and other common Python constructs. General multiple inheritance, async and match are outside the supported subset. Integers are checked 64-bit values by default. Promoting integers and dynamic Any are opt-in. Dynamic Any includes a bounded prototype for class values, type-keyed registries, generic calls and annotated factories.
Check the language guide and library support table for the features and APIs your code uses. The library includes bounded argparse, enum and experimental static ctypes declarations. Some packages compile from installed sources, and others need adaptations like the maintained ports. The optional CPython bridge lets native code call packages that need CPython at runtime.
Pystachy is focused on stronger type inference, broader library support backed by CPython comparisons, and lower compilation and execution costs.
Pystachy is MIT-licensed. See the third-party notices for licenses of adapted code.
Both files in this release have provenance metadata.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




