Skip to main content

Pystachy

CI License: MIT

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.

Quick start

Follow the installation guide, then save this as demo.py:

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.

What you can build

Example What it shows
Event router Route logs and traces using pattern matching and memoization.
JSON repair Repair malformed JSON through a native CLI or a CPython extension.
Coding agent Run a typed tool loop and edit files from a native executable.
nanoGPT Run inference and training with native arrays and optional BLAS.

See the performance guide for measured workloads, startup and memory costs, and reproduction commands. run compiles the program on every invocation. build lets you reuse the executable.

Compatibility

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.

Check the language guide and library support table for the features and APIs your code uses. The library includes bounded argparse and enum support. 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.

Roadmap

Pystachy is focused on stronger type inference, broader library support backed by CPython comparisons, and lower compilation and execution costs.

Learn more

  • Documentation covers installation, packaging, interoperability and compiler internals.
  • Testing explains CPython comparisons, bootstrap checks and CI.
  • Contributing covers development setup, focused tests and submissions.

Pystachy is MIT-licensed. See the third-party notices for licenses of adapted code.

Metadata

Release files for pystachy 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pystachy 0.2.0
File Size Uploaded Provenance Actions
pystachy-0.2.0.tar.gz 1.7 MB With provenance Details for pystachy-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pystachy 0.2.0
File Interpreter ABI Platform Actions
pystachy-0.2.0-py3-none-any.whl Python 3 none any Details for pystachy-0.2.0-py3-none-any.whl

Total release size: 3.5 MB

Release files / pystachy-0.2.0.tar.gz

Download URL pystachy-0.2.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
2995cbafc9dabc3f459cb55c09facbf0b93f00c1e11bbfd15bc241d5d7d60fc7
BLAKE2b-256 checksum
How to use checksums
5e6f7a8056b46c43e78840bde268c7dab77158cfed17d3daf4cf372936a035a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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 Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / pystachy-0.2.0-py3-none-any.whl

Download URL pystachy-0.2.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
63bfaf76a8c94c53011938e8f1fea90fc9350b6662ce7bf4dd8a24aa4e83c742
BLAKE2b-256 checksum
How to use checksums
5873316b18a45d66cbda9d3f05b6b02a66e02c034469403abe4f02bb504ac8af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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 Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for pystachy 0.2.0

Provenance

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pystachy-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page