Skip to main content

serpentine-lang

The Serpentine compiler and serp CLI. Serpentine compiles a statically typed, ownership-disciplined subset of Python ahead of time to native machine code with no garbage collector and no libpython, while the exact same file still runs under CPython.

Status: experimental (0.x). Good for tools, demos and internal services; see the readiness checklist before using it for internet-facing production work.

Requirements

  • Python 3.11+ (pip install serpentine-lang brings llvmlite, uv and serpentine-shim).
  • A Rust toolchain (rustc) from rustup.rs. On Windows also the MSVC C++ Build Tools; on Linux/macOS a C compiler (cc).

Quick start

pip install serpentine-lang
serp new myapp
cd myapp
serp run                 # build (LLVM, debug) + run
serp build main.py       # optimized native binary (release builds are re-validated by rustc)
serp add serp-json       # add a Serpentine library from PyPI (pinned in serp.lock)
serp check main.py       # type + ownership diagnostics only
from serpentine import Ref


def mean(xs: Ref[list[float]]) -> float:
    return sum(xs) / len(xs)


def main() -> None:
    temps: list[float] = [21.5, 23.0, 19.25]
    print(f"mean {mean(temps):.2f}")


if __name__ == "__main__":
    main()

int/float/str/bool need no annotations; list, dict and object parameters state a convention (Ref, Mut or Owned).

What compiles

Typed functions, dataclasses (single inheritance), unions/Optional, generics and protocols, exceptions, f-strings with format specs, comprehensions, lambdas, threads and asyncio. Untyped code, plain classes with super(), generators, *args/**kwargs and regular PyPI imports are refused with a hint. Use the serp-* libraries instead (serp-json, serp-re, serp-venom for FastAPI-style services, serp-molt for pydantic-style models, and more).

Commands

Command What it does
serp check FILE type and ownership checking (no build)
serp build FILE [-o OUT] [--backend llvm|rust] [--debug] native binary
serp run / serp test build and run the project entry / its test_*.py files
serp new NAME / serp init scaffold a project (serp.toml, main.py, .venv)
serp add PKG / serp remove PKG manage serp-* dependencies (pinned in serp.lock)
serp lsp language server (diagnostics) for editors

MIT licensed.

Metadata

Release files for serpentine-lang 0.7.4

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

Source distribution (sdist)

Source distribution for serpentine-lang 0.7.4
File Size Uploaded Provenance Actions
serpentine_lang-0.7.4.tar.gz 258.7 kB With provenance Details for serpentine_lang-0.7.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for serpentine-lang 0.7.4
File Interpreter ABI Platform Actions
serpentine_lang-0.7.4-py3-none-any.whl Python 3 none any Details for serpentine_lang-0.7.4-py3-none-any.whl

Total release size: 524.6 kB

Release files / serpentine_lang-0.7.4.tar.gz

Download URL serpentine_lang-0.7.4.tar.gz
Size 258.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0c705348a388c7fda7d4db44b57a6971ccc56eef3d0e0b27695b1d455931b693
BLAKE2b-256 checksum
How to use checksums
2e53db3f39a66da084ddb927297f290466f0785eb3ea73c247fa4422c91079f7
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 Oct 27, 2026.

Transparency log

Release files / serpentine_lang-0.7.4-py3-none-any.whl

Download URL serpentine_lang-0.7.4-py3-none-any.whl
Size 265.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
488715e966f34790e2538f6f489911d343aecba313f79f33b2309a50df875df7
BLAKE2b-256 checksum
How to use checksums
6d93dfe8413f42a9781dfb9f898893ca499063a01e4c5f7c22a38f7601c0ab96
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 Oct 27, 2026.

Transparency log

Security for serpentine-lang 0.7.4

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 serpentine_lang-0.7.4.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 Oct 27, 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