Skip to main content

Pa logo

Pa

AI-native LLVM compiler for ultra-fast, zero-copy Python acceleration (--shared self-contained .so/.pyd modules, up to 530× faster) and effortless standalone execution (pac run, 1.7 MB peak RSS).
Website · Quickstart · Architecture · Changelog


Installation & Quickstart

Requires Linux x86-64, macOS, or Windows x64, CPython 3.11–3.13 (headers + shared Python library), and a C compiler (gcc, clang, or MSVC cl).

pip install pa-compiler        # installs `pac`
pac doctor                     # verify LLVM, C compiler, and Python headers
pac skill --install claude     # optional: install AI skills (also: cursor, codex, copilot, antigravity)

1. Instant Native Execution (pac run, zero leftover .exe / .dll)

Create hello.pa:

def sum_squares(n) -> int:
    total = 0
    for i in range(n):
        total += i * i
    return total

def main() -> int:
    print(sum_squares(100000))
    return 0

Run directly in one step:

pac run hello.pa               # dev mode (bounds checks, auto-cleanup)
pac run --mode prod hello.pa   # prod mode (LLVM -O2)

2. Zero-Copy Python Extension (pac build --shared)

Compile @export functions into a self-contained .so / .pyd module (zero ctypes, zero extra Windows DLLs) and import directly from Python:

pac build --shared --mode prod kernel.pa -o pa_kernel.so   # or pa_kernel.pyd on Windows

For .paw Python bridges, --relocatable bundles, pac doctor, and the full AI workflow, see https://palang.dev/quickstart.


Repository Layout

pa/
├── pa_lang/
│   ├── types.py, validator.py, infer.py   # Front-end: subset checks, bidirectional inference, escape analysis
│   ├── paw.py, diagnostics.py             # .paw header parser/linter & AI JSON repair tickets
│   ├── codegen.py, build.py               # LLVM IR emission (llvmlite), -O2 object build, gcc link, @export
│   ├── runtime_core.c, runtime_bridge.c   # RAII fault/print core & embedded CPython zero-copy .paw bridge
│   ├── cli.py, doctor.py, skills_cmd.py   # `pac` CLI: run, check, build, doctor, bundle, skill
│   ├── lsp_server.py                      # Auto-reloading LSP server (inlay hints, hover memory audit cards)
│   └── skills/                            # Bundled SKILL.md assets shipped inside the wheel
├── skills/                                # Source AI skills (pa-coder, py-to-pa, cpp-to-pa)
├── vscode-pa/                             # VS Code extension (TextMate grammar, LSP client, grammar tests)
├── examples/                              # pipeline_demo, hashlib_pa (Python port), raytracer (C++ port)
├── site/                                  # palang.dev static site (index, quickstart, architecture)
└── tests/                                 # Pytest suites (front-end, codegen, hardening, LSP, doctor, skill)

Building from Source & Testing

git clone https://github.com/cyyier/pa.git && cd pa
uv venv --python 3.12 .venv        # or any CPython 3.11–3.13 with Python.h + shared libpython
source .venv/bin/activate
pip install -e ".[dev]"

pac doctor                         # verify gcc, llvmlite, Python.h, shared libpython
pac check examples tests           # run Pa front-end checks
pytest -q                          # run full compiler, runtime, LSP, doctor, and CLI test suite
(cd vscode-pa && npm test)         # run VS Code TextMate grammar tests

Status & Roadmap

Current (v0.1.0 alpha):

  • Supported: Linux x86-64, macOS (arm64 / x86-64), Windows x64, CPython 3.11–3.13, gcc / clang / MSVC cl, LLVM via llvmlite.
  • Included: zero-annotation .pa compiler (int/uint/float/bool, explicit widths int32/uint8/uint32/uint64/float32 + short aliases i32/u8/u32/u64/f32, **, zero-copy str_view slicing, @struct, stack/RAII Vec, flat CSR Vec[Vec[T]], String, libm, multi-file .pa module imports via local dirs / -I / PA_PATH / pip packages), .paw zero-copy CPython bridge with two-way customs, --shared guarded C-ABI libraries, pac doctor / pac bundle (ELF / Mach-O / PE), pac skill, pac lsp, and VS Code extension.

Planned:

  • Growing the libpa ecosystem (levenshtein-pa, utm-pa, kdtree-pa, bm25-pa) for pre-compiled Python acceleration wheels and pure .pa libraries.
  • (Low priority) Nested Vec fields inside @struct with recursive RAII destructors (Pa recommends flat SoA arrays or CSR Vec[Vec[T]]).

Non-goals (won't do):

  • Static libpython linking for single-file self-contained binaries — standard Python distributions do not ship portable libpython.a (especially on Windows/macOS), and third-party Python C extensions (.pyd/.so such as NumPy) require dynamic libpython. Use pac build --bundle --with-stdlib for self-contained directory distribution.

License

MIT — see LICENSE. Release process: RELEASING.md.

Metadata

Release files for pa-compiler 0.1.1

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

Source distribution (sdist)

Source distribution for pa-compiler 0.1.1
File Size Uploaded Provenance Actions
pa_compiler-0.1.1.tar.gz 149.3 kB With provenance Details for pa_compiler-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pa-compiler 0.1.1
File Interpreter ABI Platform Actions
pa_compiler-0.1.1-py3-none-any.whl Python 3 none any Details for pa_compiler-0.1.1-py3-none-any.whl

Total release size: 254.9 kB

Release files / pa_compiler-0.1.1.tar.gz

Download URL pa_compiler-0.1.1.tar.gz
Size 149.3 kB
Tags Source
SHA-256 checksum
How to use checksums
57ec8ae11c1b794038b411faa9d3612005d5f0ad9aac4e078ab778711f07d754
BLAKE2b-256 checksum
How to use checksums
769219ecb4b8da666951e5fdf14eb726a28aa70b6d60079312f38007eb848979
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 24, 2026.

Transparency log

Release files / pa_compiler-0.1.1-py3-none-any.whl

Download URL pa_compiler-0.1.1-py3-none-any.whl
Size 105.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01f572a4ff309c4c4bc778eb40d30db283cce9dced77da1c0a97b4acdb25a92f
BLAKE2b-256 checksum
How to use checksums
58ab278de8449c5da1ec3a21e3bcfa577beb602081e1794fbc43fcd03005ae9c
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 24, 2026.

Transparency log

Security for pa-compiler 0.1.1

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 pa_compiler-0.1.1.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 24, 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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