Skip to main content

Schematic version control with panproto (Python SDK)

Project description

panproto

PyPI Python MIT

Native Python bindings for panproto, a schema migration engine grounded in generalized algebraic theories. Built with PyO3 for zero-overhead access to the Rust core.

Requires Python 3.13+.

Installation

pip install panproto

Quick start

import panproto as pp

# List all 76+ built-in protocols
protocols = pp.list_builtin_protocols()

# Build a schema using the fluent builder
builder = pp.SchemaBuilder("atproto")
builder.vertex("post", "record", nsid="app.bsky.feed.post")
builder.vertex("post:body", "object")
builder.vertex("post:body.text", "string")
builder.edge("post", "post:body", "record-schema")
builder.edge("post:body", "post:body.text", "prop", name="text")
builder.constraint("post:body.text", "maxLength", "3000")
old_schema = builder.build()

# Auto-generate a lens between two schema versions
lens = pp.auto_generate_lens(old_schema, new_schema, protocol)
view, complement = lens.get(instance)
restored = lens.put(view, complement)

# Diff two schemas and classify changes
diff = pp.diff_schemas(old_schema, new_schema)
report = pp.diff_and_classify(old_schema, new_schema, protocol)

# Build and compile migrations
mig_builder = pp.MigrationBuilder()
mig_builder.map_vertex("post:body.text", "post:body.content")
migration = mig_builder.build()
compiled = pp.compile_migration(old_schema, new_schema, migration)

# Parse and emit data across protocols
io = pp.IoRegistry()
schema = io.parse_schema("json-schema", json_schema_str)
output = io.emit_schema("json-schema", schema)

# GAT operations
theory = pp.create_theory("MyTheory", sorts, operations, equations)
colimit = pp.colimit_theories(theory_a, theory_b, shared)

# Schematic version control
repo = pp.VcsRepository.init("/path/to/repo")
repo.add(schema)
repo.commit("add post schema", "author")

API overview

Schema and protocols

Function / Class Description
list_builtin_protocols() List all 76+ built-in protocol names
get_builtin_protocol(name) Get a protocol definition by name
define_protocol(...) Define a custom protocol
SchemaBuilder(protocol) Fluent schema construction (vertex, edge, constraint, hyper_edge)
Schema Immutable schema with vertex/edge/constraint access
Protocol Protocol definition with edge rules and feature flags

Migration and lenses

Function / Class Description
auto_generate_lens(src, tgt, protocol) Auto-generate a bidirectional lens between schemas
Lens Lens with get(instance) and put(view, complement)
Complement Data discarded during get, needed by put
MigrationBuilder Build migrations with vertex/edge mappings
compile_migration(src, tgt, migration) Compile a migration for application
compose_migrations(m1, m2) Compose two migrations sequentially
check_existence(src, tgt, migration, protocol) Validate migration existence conditions

Breaking change detection

Function / Class Description
diff_schemas(old, new) Structural diff between two schemas
diff_and_classify(old, new, protocol) Diff with breaking/non-breaking classification
SchemaDiff Diff result with added/removed/changed elements
CompatReport Compatibility report with breaking change details

Instance I/O

Function / Class Description
Instance W-type instance with from_json, to_json, validate
IoRegistry Parse/emit schemas and instances across all protocols

GAT engine

Function / Class Description
create_theory(name, sorts, ops, eqs) Create a GAT theory
Theory Theory with sort/operation/equation access
colimit_theories(t1, t2, shared) Compute theory pushout
check_morphism(morphism, domain, codomain) Verify a theory morphism
Model Model of a theory with carrier sets

Version control

Function / Class Description
VcsRepository.init(path) Initialize a panproto repository
VcsRepository.open(path) Open an existing repository
repo.add(schema) Stage a schema
repo.commit(message, author) Create a commit
repo.branch(name) Create a branch
repo.merge(branch, author) Merge a branch

Documentation

Full documentation at panproto.dev.

License

MIT

Project details


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.23.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

panproto-0.23.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl (6.2 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

panproto-0.23.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl (6.2 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

panproto-0.23.0-cp313-abi3-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.13+Windows x86-64

panproto-0.23.0-cp313-abi3-manylinux_2_28_aarch64.whl (6.2 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ ARM64

panproto-0.23.0-cp313-abi3-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.13+macOS 11.0+ ARM64

panproto-0.23.0-cp313-abi3-macosx_10_12_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.13+macOS 10.12+ x86-64

panproto-0.23.0-cp311-cp311-manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

File details

Details for the file panproto-0.23.0-py3-none-any.whl.

File metadata

  • Download URL: panproto-0.23.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for panproto-0.23.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f382c98c44b6270d60ab0c985f94ba8936ad0ab2f2c5be711e2b916324e17a22
MD5 cd4dd62578d490f1e71ecac7126181d4
BLAKE2b-256 d4fd77f189020368bfa1642faeb266fb91ebe3bab5742124d668ed99271075bc

See more details on using hashes here.

File details

Details for the file panproto-0.23.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for panproto-0.23.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d553049c595771dd896e0dffcc484cef7e239d4ebfdae8479ffb69cad7dd0d35
MD5 e37e1fed21b7a55f242598c32889f895
BLAKE2b-256 d9f36eaba6d00a31f7375a5b6e4cee19df0bf92f82e33fbca7899663c50a5748

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-pp310-pypy310_pp73-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.23.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for panproto-0.23.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f439d7b8e381259424785dff836a9280fafa0fdca65e8c62db2caf2b48ced601
MD5 815437e1682de5c49e63c0dc2aa3f852
BLAKE2b-256 5cbfe847954941d921f2c461389c52d1d3d180304c64f7236ffaa011c57273fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-pp39-pypy39_pp73-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.23.0-cp313-abi3-win_amd64.whl.

File metadata

  • Download URL: panproto-0.23.0-cp313-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: CPython 3.13+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panproto-0.23.0-cp313-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 70cace2c22d928058647dade72fa600e4685dae05ce82dd9361802348bbdb210
MD5 acb3eecba318e83f236501b8124d5c59
BLAKE2b-256 b6d70e5fb2d893bf8c073cd6dc77a21fa76123d895a5f98c083269d0261e6652

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-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.23.0-cp313-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for panproto-0.23.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8c46d82c54c0be7d70c8b11a2c5935082b47a6e6ff3a13b8cd721fd829edc317
MD5 3fedc848e70471f13feb2f207d54cc65
BLAKE2b-256 cfa2ca8439ebb8997fd7cf6cacf0a1b1b8087b1975bf3e1e46390f2a99697258

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-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.23.0-cp313-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for panproto-0.23.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b37d6402b1f7aeec60fffb7ff311d3c848c0e98eeca1c3b513599192b7375f0d
MD5 41c6ed4f2046ee973e25589a1ef71060
BLAKE2b-256 e75e41bdb86d1c4b36466558a38597d8b1ebe8dd37c50e08c8f3ec99873b1f90

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-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.23.0-cp313-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for panproto-0.23.0-cp313-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aedf0a96225f6de71776c49c08848e3affdb415a95d3b1e838d9470079461207
MD5 7be542cc608f51b24d7664c1c7b94c6c
BLAKE2b-256 56199b67c7152019ced6f6e59ac634b8883c687d66df384bb4451d4044b82f0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-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.

File details

Details for the file panproto-0.23.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for panproto-0.23.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 073e3017781c4c441d5a7d891e33970f4187dfa9d29ac1a4309bf31f97a892df
MD5 ee45985c9bef6ff20f7c221e259cbb37
BLAKE2b-256 3fbd613bf99acb930b0e38d08de23c0caff7d865b0c5f84865719e60c3ece537

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.23.0-cp311-cp311-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.

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