Automatic schema migration and version control for 51 schema languages and 248 programming languages
Project description
panproto
Python bindings for panproto, a schematic version-control system that treats every supported schema language (around 50, including ATProto, OpenAPI, AsyncAPI, Avro, Protobuf, JSON Schema, and Kubernetes CRDs) as views over a single graph format.
The bindings are built with PyO3 against the Rust core directly: no WASM runtime, no subprocess, no shelling out. The full panproto surface is available from Python, including the schema/migration/lens/VCS pipelines and the tree-sitter-driven parser for 259 programming languages.
Status
panproto is pre-1.0. The 0.x series carries arbitrary breaking changes
between minor versions; the panproto package version tracks the
workspace version on every release. Python 3.13+ is required (the
wheels are abi3 and forward-compatible across newer Python releases).
Installation
pip install panproto
Wheels are published on PyPI for Linux x86_64/aarch64, macOS arm64+x86_64, and Windows x86_64. No Rust toolchain is required to install.
Synopsis
import panproto
# Pick a built-in protocol, or define your own with `Protocol.from_theories`.
atproto = panproto.get_builtin_protocol("atproto")
# Build a schema using the fluent builder.
v1 = atproto.schema()
v1.vertex("post", "record", "app.bsky.feed.post")
v1.vertex("post:body", "object")
v1.vertex("post:body.text", "string")
v1.edge("post", "post:body", "record-schema")
v1.edge("post:body", "post:body.text", "prop", "text")
v1.constraint("post:body.text", "maxLength", "3000")
schema_v1 = v1.build()
# (build schema_v2 the same way, with the field renamed to `content` ...)
# Detect breaking changes.
report = panproto.diff_and_classify(schema_v1, schema_v2, atproto)
print(report.compatible) # True or False
print(report.report_text()) # human-readable summary
# Auto-generate a bidirectional converter.
lens, quality, _ = panproto.auto_generate_lens(schema_v1, schema_v2, atproto)
view, complement = lens.get(instance)
restored = lens.put(view, complement)
# Version-control schemas.
repo = panproto.Repository.init("/path/to/repo")
repo.add(schema_v1)
repo.commit("initial schema", "anonymous")
repo.create_and_checkout_branch("feature")
repo.merge("feature", "anonymous")
API overview
| Module / class | Purpose |
|---|---|
Schema, SchemaBuilder |
Fluent schema construction; Schema.validate(protocol) checks rules. |
Protocol |
Schema-language definition. Protocol.from_theories(...) builds one from a Theory. |
get_builtin_protocol(name) |
Load any of the ~50 builtin protocols by name. |
define_protocol(spec) |
Define a custom protocol from a dict. |
Theory, create_theory, TheoryBuilder |
GAT-level theory construction. Theory.from_nickel(src) / from_yaml(src) / from_json(src) / from_path(p) load theory-DSL documents; to_yaml() / from_dict_yaml(s) round-trip the flat panproto_gat::Theory shape (JSON pair already provided). |
diff_schemas, diff_and_classify |
Structural diff and breaking-change classification. |
auto_generate_lens |
Generate a bidirectional Lens from two schemas. |
Lens |
get(instance) -> (view, complement), put(view, complement) -> instance. |
ProtolensChain |
from_dsl_json(src, body_vertex) / from_dsl_yaml / from_dsl_nickel / from_dsl_path compile a panproto-lens-dsl document into a chain anchored at the named body vertex of the source schema. |
MigrationBuilder, compile_migration, compose_migrations |
Hand-rolled migration construction. |
Instance, IoRegistry |
Parse/emit data across the 50+ supported formats. |
Repository |
Filesystem-backed VCS: init, commit, branch, merge, log, blame, bisect, stash, tag, plus data versioning. |
AstParserRegistry, parse_source_file, ParseEmitLens |
Full-AST parsing across 259 languages via tree-sitter. AstParserRegistry.override_grammar(name, extensions, language_ptr, node_types, ...) swaps a registered grammar at runtime for dev-time grammar work. |
Schema.constraints_for, Schema.field_text |
Read every constraint on a vertex; pull the text of a tree-sitter field('<name>', anonymous-token) child via schema.field_text(vid, "name"). |
Expr, parse_expr, pretty_print_expr |
Embedded expression language. |
Companion grammar packs
The published panproto wheel ships only the 11 group-core tree-sitter grammars (Python, JavaScript, TypeScript, Java, C#, C++, PHP, Bash, C, Go, Rust). Beyond that, grammars are distributed as separately-installable companion wheels, one per language group:
| Wheel | Languages |
|---|---|
panproto-grammars-web |
HTML, CSS, JavaScript, TypeScript, TSX, JSON, Vue, Svelte, Astro, GraphQL |
panproto-grammars-systems |
C, C++, Rust, Go, Zig, D, Nim, Odin, V, Hare |
panproto-grammars-jvm |
Java, Kotlin, Scala, Groovy, Clojure |
panproto-grammars-scripting |
Python, Ruby, Lua, Bash, Perl, R, Julia, Nushell, Fish |
panproto-grammars-data |
JSON, TOML, XML, YAML, SQL, CSV, GraphQL, Protobuf |
panproto-grammars-functional |
Haskell, OCaml, Elm, Gleam, Erlang, Elixir, PureScript, F#, Clojure, Scheme, Racket |
panproto-grammars-devops |
Dockerfile, Terraform, HCL, Nix, Bash, YAML, TOML, Make, CMake |
panproto-grammars-mobile |
Swift, Kotlin, Dart, Java, Objective-C |
panproto-grammars-music |
SuperCollider, LilyPond, ABC, Csound, ChucK, Glicol, Tidal mini-notation, Strudel mini-notation |
panproto-grammars-all |
every grammar in panproto-grammars (259 languages) |
Install whichever group you need:
pip install panproto-grammars-functional
There is nothing to import from these packages. They register a panproto.grammars entry point on installation; panproto.AstParserRegistry() walks every such entry point and threads the discovered grammar metadata into the native registry on construction. The native class is reachable as panproto._native.AstParserRegistry() for callers who want only the group-core baseline.
How it works under the hood:
- Each companion is its own pyo3 cdylib depending on
panproto-grammarswith onegroup-*feature flag. - On
import, the companion'sgrammars_metadata()returns a list of dicts containing the tree-sitterLanguagepointer plus byte-slice pointer/length pairs (cast to integers for transport across cdylib boundaries). - The trust boundary lives on the panproto side, in
register_external_from_metadata(crates/panproto-py/src/parse.rs), which decodes the integers back into&'staticreferences and registers a fullLanguageParser. The companion's grammar bytes live in its.rodataand stay valid for the process lifetime. - A single broken grammar (e.g. an upstream
node-types.jsonwith a malformed entry) is skipped with aRuntimeWarningrather than aborting registration; mirrors the resilience of the built-in path.
Performance notes
- The
_nativeextension talks to the Rust core through PyO3's zero-copy pyclass slabs. Schemas, theories, and lenses are reference-counted Rust objects on the Python side; mutations go through dedicated builder types (SchemaBuilder,MigrationBuilder) that consume onbuild(), so you can't accidentally observe partial state. - Cross-thread sharing of these objects requires the GIL; for parallel
work, fan out at the data layer (e.g. parallelise
lens.getcalls withconcurrent.futures) and keep the schema/lens objects per worker. - Wheel-load cost is one-time; the import sets up the protocol registry lazily so cold-start is fast.
Contributing
Source: bindings/python. Issues and pull requests at github.com/panproto/panproto/issues.
The native extension lives at
crates/panproto-py
on the Rust side; bindings/python/src/panproto/__init__.py is the
pure-Python re-export layer that maturin ships alongside the
compiled extension.
License
MIT © 2026 Aaron Steven White.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file panproto-0.48.7-cp313-abi3-win_amd64.whl.
File metadata
- Download URL: panproto-0.48.7-cp313-abi3-win_amd64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.13+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e1eb1fb662bd5c04b71b61acb9306368b50a70bce55318c3200d8fb2f896212
|
|
| MD5 |
946148e5092b32924e84a1bf24c05334
|
|
| BLAKE2b-256 |
b0c1f7d8997d9578b75747c3644885518c054debb6420220f9f6c146a13cde62
|
Provenance
The following attestation bundles were made for panproto-0.48.7-cp313-abi3-win_amd64.whl:
Publisher:
python-wheels.yml on panproto/panproto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panproto-0.48.7-cp313-abi3-win_amd64.whl -
Subject digest:
7e1eb1fb662bd5c04b71b61acb9306368b50a70bce55318c3200d8fb2f896212 - Sigstore transparency entry: 1594608329
- Sigstore integration time:
-
Permalink:
panproto/panproto@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Branch / Tag:
refs/tags/v0.48.7 - Owner: https://github.com/panproto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panproto-0.48.7-cp313-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: panproto-0.48.7-cp313-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 12.5 MB
- Tags: CPython 3.13+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
661866cd3ff7c4847afcbe12bee45386da05180b4a175f08eecebe4d963db512
|
|
| MD5 |
b8e75b46af83ac25c28387dfebd49e00
|
|
| BLAKE2b-256 |
18d0f064e0e53e767257fcc004444b5a65f1cf29de63423ad6458a7deefc1b94
|
Provenance
The following attestation bundles were made for panproto-0.48.7-cp313-abi3-manylinux_2_28_x86_64.whl:
Publisher:
python-wheels.yml on panproto/panproto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panproto-0.48.7-cp313-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
661866cd3ff7c4847afcbe12bee45386da05180b4a175f08eecebe4d963db512 - Sigstore transparency entry: 1594608410
- Sigstore integration time:
-
Permalink:
panproto/panproto@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Branch / Tag:
refs/tags/v0.48.7 - Owner: https://github.com/panproto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panproto-0.48.7-cp313-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: panproto-0.48.7-cp313-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 12.0 MB
- Tags: CPython 3.13+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
136ac719677e811e6db93792b2c97de190a709a6e8a80cb32278723356c4be41
|
|
| MD5 |
ba44d3a5a84b8968ff2d595b235ce58d
|
|
| BLAKE2b-256 |
4ea80cd82c80195606b55aca9d3d71af2a4dd12ccfe75b00604d6dfdac7ca7b6
|
Provenance
The following attestation bundles were made for panproto-0.48.7-cp313-abi3-manylinux_2_28_aarch64.whl:
Publisher:
python-wheels.yml on panproto/panproto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panproto-0.48.7-cp313-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
136ac719677e811e6db93792b2c97de190a709a6e8a80cb32278723356c4be41 - Sigstore transparency entry: 1594608478
- Sigstore integration time:
-
Permalink:
panproto/panproto@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Branch / Tag:
refs/tags/v0.48.7 - Owner: https://github.com/panproto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panproto-0.48.7-cp313-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: panproto-0.48.7-cp313-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 11.4 MB
- Tags: CPython 3.13+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0d14b754a960e5bc398ee2c4b92269c385ff8216ad4b8fc8c00ce1e1792369b
|
|
| MD5 |
3126db9c50ea634f5b96ec5a42d18b23
|
|
| BLAKE2b-256 |
1e23ab57a6b36e92eea95c3b5f16ffc30a5fb72d2968bcddc647375890f61338
|
Provenance
The following attestation bundles were made for panproto-0.48.7-cp313-abi3-macosx_11_0_arm64.whl:
Publisher:
python-wheels.yml on panproto/panproto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panproto-0.48.7-cp313-abi3-macosx_11_0_arm64.whl -
Subject digest:
f0d14b754a960e5bc398ee2c4b92269c385ff8216ad4b8fc8c00ce1e1792369b - Sigstore transparency entry: 1594608561
- Sigstore integration time:
-
Permalink:
panproto/panproto@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Branch / Tag:
refs/tags/v0.48.7 - Owner: https://github.com/panproto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panproto-0.48.7-cp313-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: panproto-0.48.7-cp313-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 11.7 MB
- Tags: CPython 3.13+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79957edcd22e1bd25155e632ca657ec332cb1fb917d90da77e88206ac770951f
|
|
| MD5 |
97a475a5c4316a3aef3063c2cfcd0209
|
|
| BLAKE2b-256 |
fa5341cef7857557065c8516c391a2b5041e49e6de405a2aae10d2960b7a2a09
|
Provenance
The following attestation bundles were made for panproto-0.48.7-cp313-abi3-macosx_10_12_x86_64.whl:
Publisher:
python-wheels.yml on panproto/panproto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panproto-0.48.7-cp313-abi3-macosx_10_12_x86_64.whl -
Subject digest:
79957edcd22e1bd25155e632ca657ec332cb1fb917d90da77e88206ac770951f - Sigstore transparency entry: 1594608258
- Sigstore integration time:
-
Permalink:
panproto/panproto@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Branch / Tag:
refs/tags/v0.48.7 - Owner: https://github.com/panproto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@be9c0e095490a0f7166954316a20bfcf2c2b0635 -
Trigger Event:
push
-
Statement type: