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 Distribution

panproto-0.22.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distributions

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

panproto-0.22.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

panproto-0.22.1-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl (6.1 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

panproto-0.22.1-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl (6.1 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

panproto-0.22.1-cp313-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.13+Windows x86-64

panproto-0.22.1-cp313-abi3-manylinux_2_28_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ ARM64

panproto-0.22.1-cp313-abi3-macosx_11_0_arm64.whl (5.6 MB view details)

Uploaded CPython 3.13+macOS 11.0+ ARM64

panproto-0.22.1-cp313-abi3-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13+macOS 10.12+ x86-64

panproto-0.22.1-cp311-cp311-manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

File details

Details for the file panproto-0.22.1.tar.gz.

File metadata

  • Download URL: panproto-0.22.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for panproto-0.22.1.tar.gz
Algorithm Hash digest
SHA256 90d1829707610fcb94348887b9e3b6d258553dd7f05eec7baf30ed3de5a8aa1a
MD5 f122589b0ccb94ee1d2cd77dac49a1af
BLAKE2b-256 c1398d1d49bfc494abec99d91f5dc56d468c56be6a8eadeb415fdd95d992bae9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: panproto-0.22.1-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.9.13

File hashes

Hashes for panproto-0.22.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c944648675510bd91d2272a3f12cedcf0083540583a324347862be8058c7ebe
MD5 899db14f8583cb436ce2cb4890cac0eb
BLAKE2b-256 99ff8272a0ef60aa889df894d354bdbb6eb63698a02cca6e05fe7b6865661b5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for panproto-0.22.1-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56f57c808eb7315fc0c0071532b29e620ab0b4c2eb05436e6a5f622380bb9cac
MD5 f053d262bbfefb105dd28ae530de7adf
BLAKE2b-256 3a98a5dd36dd9fac33b5ff5b1eb3837561963516ac3eebb1b47b0f594464fba8

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.22.1-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.22.1-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for panproto-0.22.1-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4739f68065f8b4ec8f1d7336cd1c55b4e799da5ba79b6f92a5f2c57d7803296e
MD5 9a6fc7129e1d8e27b1624f3a95158148
BLAKE2b-256 8fe76b59340e2de62b5b2c2afec3b7271c2e38494560c6552ae56d530dc0ef2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for panproto-0.22.1-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.22.1-cp313-abi3-win_amd64.whl.

File metadata

  • Download URL: panproto-0.22.1-cp313-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.5 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.22.1-cp313-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 484f2aefdefb3acdc10a193e630000387bedc6981809ad34500d2e4d2ccf57a3
MD5 2be61bbd99291bd2d0b64b1161e0a14c
BLAKE2b-256 72cd88d1dc489fbd6391a41f7a0ea90cf5abd231c68ec4a12338bce502f55608

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panproto-0.22.1-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 edc287fa529c9d6f86655a696a564f134ff7f86c5f3928d2402b609bb49ebe1b
MD5 7e99e125933360a74ad57630159dcc65
BLAKE2b-256 ff478ae4ccd1a273ce54f1b2e21ccd3572b9f2de3b6d701c072a935a32aef307

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panproto-0.22.1-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41ab09c3578b7bcb32154165dbddf8a6fd978391da2704b36833377a6b4a7b4b
MD5 c84f1e1e0318dc6e156f591f2710e5ad
BLAKE2b-256 acdbdae75c646513244843ae5928c93b0582aa6ead06a581fd86516a723caf08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for panproto-0.22.1-cp313-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 11f616e97b4f5c23a83279fdfbfa95750391409b4ab3020694090b776865e583
MD5 aeb2cf40a2acd8dd1f6d71d60027e672
BLAKE2b-256 741e2f5199ca094db14113b7272eb13f1e4af40087a1be43a4577f4288a3e2cc

See more details on using hashes here.

Provenance

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

File details

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

File metadata

File hashes

Hashes for panproto-0.22.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ee8ba0fe6ab715d73c9a15e716c43d5fca522aab6f6028f10c918d125151114
MD5 d09e7f83f6447c19e1c315788eae597b
BLAKE2b-256 f15418802e55db8ffa0eafe056c3024f56b92a5962cf8791e32d15624c6ff136

See more details on using hashes here.

Provenance

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