Skip to main content

panproto

PyPI Python License: MIT

This package exposes panproto's Rust libraries to Python through PyO3. It does not start a subprocess or load the WebAssembly build. Python 3.13 or newer is required.

The package is pre-1.0. A minor release may change the Python API, and the package version follows the Rust workspace version.

Install

pip install panproto

Release workflows build wheels for Linux on x86-64 and AArch64, macOS on Apple Silicon and x86-64, and Windows on x86-64. A source build requires Rust and maturin.

Build and compare schemas

Protocol.schema() returns a mutable SchemaBuilder. Builder methods update the builder and return None; call build() after all changes have been added.

import panproto

atproto = panproto.get_builtin_protocol("atproto")

old_builder = atproto.schema()
old_builder.vertex("post", "record", "app.bsky.feed.post")
old_builder.vertex("post:body", "object")
old_builder.vertex("post:body.text", "string")
old_builder.edge("post", "post:body", "record-schema")
old_builder.edge("post:body", "post:body.text", "prop", "text")
old_schema = old_builder.build()

new_builder = atproto.schema()
new_builder.vertex("post", "record", "app.bsky.feed.post")
new_builder.vertex("post:body", "object")
new_builder.vertex("post:body.content", "string")
new_builder.edge("post", "post:body", "record-schema")
new_builder.edge("post:body", "post:body.content", "prop", "content")
new_schema = new_builder.build()

report = panproto.diff_and_classify(old_schema, new_schema, atproto)
print(report.classification)
print(report.report_text())

CompatReport.classification is one of "fully-compatible", "backward-compatible", or "breaking". The object also exposes compatible, breaking_changes, non_breaking_changes, report_json(), and to_dict().

Migrations and lenses

MigrationBuilder records a source-to-target vertex map. Compile the result against its source and target schemas:

builder = panproto.MigrationBuilder()
builder.map_vertex("post", "post")
builder.map_vertex("post:body", "post:body")
migration = builder.build()

compiled = panproto.compile_migration(migration, old_schema, new_schema)

CompiledMigration.lift(instance) constructs a target instance from the mapped part of a source instance. This operation is the library's source-to-target surviving-fragment transfer. The categorical transports are separate: Delta reindexes a target instance back to the source, while a general left Kan extension computes the source-to-target Sigma transport. The vocabulary in plain terms defines both.

CompiledMigration.get(instance) and Lens.get(instance) project a source instance to a target-shaped view and return an opaque complement. Their corresponding put(view, complement) methods reconstruct a source instance.

lens, quality, proposals = panproto.auto_generate_lens(
    old_schema, new_schema, atproto
)
view, complement = lens.get(source_instance)
restored_source = lens.put(view, complement)

find_morphisms() and find_best_morphism() search for total schema morphisms. find_best_morphism() returns None when none exists. find_span() instead returns a SchemaSpan in every no-overlap case, with an empty apex representing the absence of shared structure.

The ProtolensChain.from_dsl_*() constructors retain both the structural chain and the lens-DSL compiler's value-level field transforms. Instantiating the chain installs those transforms in the compiled migration. to_json() and from_json() preserve them in the optional field_transforms member.

Other API groups

API Current behavior
parse_schema_document, parse_schema_source, parse_schema_bundle Parse schema documents or source-language definitions through the registered Rust parsers.
IoRegistry Parse and emit instances. Use len(registry) or list_protocols() to inspect the codecs in the installed build.
Theory, TheoryBuilder, create_theory, colimit_theories Construct and combine generalized algebraic theories.
Repository Open or create a filesystem-backed .panproto repository with commits, branches, tags, merge, rebase, stash, blame, bisect, data tracking, and garbage collection.
VcsRepository A separate in-memory wrapper with only add() and list_refs(). It is not a Repository subclass.
ProjectBuilder, build_project, parse_project Assemble multi-file projects.
AstParserRegistry, parse_source_file, ParseEmitLens Parse source files with the tree-sitter grammars present in the build or supplied by companion packages.
Expr, parse_expr, pretty_print_expr Parse, inspect, and evaluate the expression language through methods on Expr.

The type stub at src/panproto/_native.pyi gives the complete public signatures.

Tree-sitter grammar packages

The default source build enables the 11 group-core grammars: Python, JavaScript, TypeScript, Java, C#, C++, PHP, Bash, C, Go, and Rust. Optional companion wheels register other grammar groups through the panproto.grammars Python entry-point group. panproto-grammars-all contains all 261 grammars currently declared by panproto-grammars.

pip install panproto-grammars-functional

Constructing panproto.AstParserRegistry() loads metadata from installed companions. panproto._native.AstParserRegistry() constructs only the native registry. A companion whose metadata cannot be registered produces a RuntimeWarning for that grammar and does not stop the other grammars from loading.

Object ownership

PyO3 classes own Rust values directly. Several classes share immutable schemas through Rust reference counting, and Python releases those values when their wrappers are collected. There is no numeric handle API and no manual free function.

References

License

MIT

Metadata

Release files for panproto 0.72.0

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

Built distributions (wheels)

Table of built distributions (wheels) for panproto 0.72.0
File
panproto-0.72.0-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details
panproto-0.72.0-cp313-abi3-manylinux_2_28_x86_64.whl CPython 3.13 abi3 Linux glibc 2.28+ x86-64 Details
panproto-0.72.0-cp313-abi3-manylinux_2_28_aarch64.whl CPython 3.13 abi3 Linux glibc 2.28+ ARM64 Details
panproto-0.72.0-cp313-abi3-macosx_11_0_arm64.whl CPython 3.13 abi3 macOS 11.0+ ARM64 Details
panproto-0.72.0-cp313-abi3-macosx_10_12_x86_64.whl CPython 3.13 abi3 macOS 10.12+ x86-64 Details

Total release size: 58.9 MB

Release files / panproto-0.72.0-cp313-abi3-win_amd64.whl

Download URL panproto-0.72.0-cp313-abi3-win_amd64.whl
Size 13.1 MB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
781369ad0957f34122da62488f78133abccea36919995ff8a085bc971469935a
BLAKE2b-256 checksum
How to use checksums
50adcd392ff50fd707e2c4479c139bc51665f856ef9a4ca406eebb1c3a219be3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / panproto-0.72.0-cp313-abi3-manylinux_2_28_x86_64.whl

Download URL panproto-0.72.0-cp313-abi3-manylinux_2_28_x86_64.whl
Size 11.9 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
79fdc868d1fdd7b67a68874d272bd78f5f1ab82ffebacca7972dcf236cf17b4a
BLAKE2b-256 checksum
How to use checksums
0b449e4a670ac279acabe6117d4e4d7c72b6f2a82170201989fb3bc9dc22c7ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / panproto-0.72.0-cp313-abi3-manylinux_2_28_aarch64.whl

Download URL panproto-0.72.0-cp313-abi3-manylinux_2_28_aarch64.whl
Size 11.1 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
1fa39d27b5af87887bfd7fbe5b2f2d2cc7c1b5c7c13f9cb0a64ced9e6511522c
BLAKE2b-256 checksum
How to use checksums
a087d71ba624ea7e77b96e6694823b1b9add8dbb7570a97fc02587c61d3f129b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / panproto-0.72.0-cp313-abi3-macosx_11_0_arm64.whl

Download URL panproto-0.72.0-cp313-abi3-macosx_11_0_arm64.whl
Size 11.0 MB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fa23b19b0df8ee52d1bc6375cb5894b836d282eae8fdcf88da29f08eb0a8ce4f
BLAKE2b-256 checksum
How to use checksums
cf1be47e85b65a9b426bb64c3b60d9bcbeee445a5af562720dd3323d049b02aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release files / panproto-0.72.0-cp313-abi3-macosx_10_12_x86_64.whl

Download URL panproto-0.72.0-cp313-abi3-macosx_10_12_x86_64.whl
Size 11.7 MB
Tags CPython 3.13 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8872913fd2d1c2acbf7b34f6e596cbd49d57c6bee82583702c181cf8503554ac
BLAKE2b-256 checksum
How to use checksums
c27b8387ea0a71a3a9c5c7d53b1dbe1b659d6e85330cae1cdce29b24bcec20f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 25, 2026.

Transparency log

Release history Release notifications | RSS feed

0.74.4

5 release files

0.74.3

5 release files

0.74.2

5 release files

0.74.1

5 release files

0.74.0

5 release files

0.73.0

5 release files

This release

0.72.0 This release

5 release files

0.71.0

5 release files

0.70.1

5 release files

0.70.0

5 release files

0.69.1

5 release files

0.69.0

5 release files

0.68.0

5 release files

0.67.0

5 release files

0.66.0

5 release files

0.65.0

5 release files

0.64.0

5 release files

0.63.0

5 release files

0.62.0

5 release files

0.61.0

5 release files

0.60.0

5 release files

0.59.0

5 release files

0.58.0

5 release files

0.57.0

5 release files

0.56.1

5 release files

0.56.0

5 release files

0.55.0

5 release files

0.54.0

5 release files

0.53.0

5 release files

0.51.0

5 release files

0.50.9

5 release files

0.50.7

5 release files

0.50.6

5 release files

0.50.5

5 release files

0.50.4

5 release files

0.50.3

5 release files

0.50.2

5 release files

0.50.1

5 release files

0.50.0

5 release files

0.49.6

5 release files

0.49.5

5 release files

0.49.4

5 release files

0.49.3

5 release files

0.49.2

5 release files

0.49.1

5 release files

0.49.0

5 release files

0.48.8

5 release files

0.48.7

5 release files

0.48.6

5 release files

0.48.5

5 release files

0.48.4

5 release files

0.48.3

5 release files

0.48.2

5 release files

0.48.1

5 release files

0.48.0

5 release files

0.47.3

5 release files

0.47.2

5 release files

0.47.1

5 release files

0.47.0

5 release files

0.46.1

5 release files

0.42.0

5 release files

0.40.0

5 release files

0.39.0

5 release files

0.38.0

5 release files

0.37.0

5 release files

0.36.0

5 release files

0.35.0

5 release files

0.34.1

5 release files

0.34.0

5 release files

0.33.0

5 release files

0.32.0

5 release files

0.31.0

5 release files

0.30.1

5 release files

0.30.0

5 release files

0.29.1

5 release files

0.29.0

5 release files

0.28.0

5 release files

0.22.1

9 release files

0.22.0

9 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

1 release file

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

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