Skip to main content

Automatic schema migration and version control for 51 schema languages and 248 programming languages

Project description

panproto

PyPI Python License: MIT

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 ~250 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")
repo.branch("feature")
repo.merge("feature")

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 GAT-level theory construction (sorts, ops, equations, directed_eqs).
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.
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 ~250 languages via tree-sitter.
Expr, parse_expr, pretty_print_expr Embedded expression language.

Performance notes

  • The _native extension 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 on build(), 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.get calls with concurrent.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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

panproto-0.43.1-cp313-abi3-win_amd64.whl (6.8 MB view details)

Uploaded CPython 3.13+Windows x86-64

panproto-0.43.1-cp313-abi3-manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ x86-64

panproto-0.43.1-cp313-abi3-manylinux_2_28_aarch64.whl (8.2 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ ARM64

panproto-0.43.1-cp313-abi3-macosx_11_0_arm64.whl (7.7 MB view details)

Uploaded CPython 3.13+macOS 11.0+ ARM64

panproto-0.43.1-cp313-abi3-macosx_10_12_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.13+macOS 10.12+ x86-64

File details

Details for the file panproto-0.43.1-cp313-abi3-win_amd64.whl.

File metadata

  • Download URL: panproto-0.43.1-cp313-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.8 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

Hashes for panproto-0.43.1-cp313-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 726d4754cc599d141a4f22f8be5fed64bc1023b3bcb0235e60e65daba4bb5ba4
MD5 982b831c63279eb42983d445d5dbb9ad
BLAKE2b-256 c431e560ecaa87f9a1c5e5d24a0fa31da1f227190868cccb98fcab294649ccec

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.43.1-cp313-abi3-win_amd64.whl:

Publisher: python-wheels.yml on panproto/panproto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panproto-0.43.1-cp313-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for panproto-0.43.1-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8090dd35669e4815e45c3ac4963fd621cdfeaf6250ea887c8edf2e7302918c5d
MD5 deadb155863a413e336cb16b85f7be1a
BLAKE2b-256 7c13caf939d7beec771e6ce4fd87120bfeb85ffb359aec628fd847125b9ff21d

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.43.1-cp313-abi3-manylinux_2_28_x86_64.whl:

Publisher: python-wheels.yml on panproto/panproto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panproto-0.43.1-cp313-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for panproto-0.43.1-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 685493a153ce957f9ec9e0d780d0c8c50e6c72ad92dc983e60dff47e26472903
MD5 5eda5aad0ebbda576983ceaa51c48940
BLAKE2b-256 70d9981d7e469e5db55e76ccbf2174762a11919f5be8b9de322d7683ee96729c

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.43.1-cp313-abi3-manylinux_2_28_aarch64.whl:

Publisher: python-wheels.yml on panproto/panproto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panproto-0.43.1-cp313-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panproto-0.43.1-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f72f35637f8b03ec23e3654fb67d7fae3941ba9ed8414f62e179c837d35cc314
MD5 eda69d11a9ab2f7119b3e010a6b94fdc
BLAKE2b-256 1bd02ecfa6598a11b41b418db2c60e41c277741f5bbf64d4ce69f1dc2915f132

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.43.1-cp313-abi3-macosx_11_0_arm64.whl:

Publisher: python-wheels.yml on panproto/panproto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panproto-0.43.1-cp313-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for panproto-0.43.1-cp313-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8bf5b163e56fa16fcec4076f4eadcbff12b837451cedf484e856296df6bbbe42
MD5 89cadfa69435d8202643b52a070536ce
BLAKE2b-256 e2aceec19f4dcb5e427b2fdc5bb3ce5776595ef410e0322a710e119995eeb69d

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.43.1-cp313-abi3-macosx_10_12_x86_64.whl:

Publisher: python-wheels.yml on panproto/panproto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page