Skip to main content

Universal schema migration engine (Python SDK)

Project description

panproto

PyPI Python MIT

Universal schema migration engine for Python. Wraps the panproto WASM module via MessagePack IPC.

Requires Python 3.13+.

Installation

pip install panproto

Quick start

from panproto import Panproto

with Panproto.load() as pp:
    atproto = pp.protocol("atproto")
    schema = (
        atproto.schema()
        .vertex("post", "record", nsid="app.bsky.feed.post")
        .vertex("post:body", "object")
        .vertex("post:body.text", "string")
        .edge("post", "post:body", "record-schema")
        .edge("post:body", "post:body.text", "prop", name="text")
        .constraint("post:body.text", "maxLength", "3000")
        .build()
    )

    # Diff two schemas
    diff = pp.diff(old_schema, new_schema)

    # Compile and apply a migration
    migration = pp.migration(src, tgt).map("old_id", "new_id").compile()
    result = migration.lift(record)

    # Bidirectional lens
    view, complement = migration.get(record)
    restored = migration.put(modified_view, complement)

API

Class Description
Panproto Main entry point; call Panproto.load() to initialize
Protocol Protocol handle with schema builder factory
SchemaBuilder / BuiltSchema Fluent schema construction
MigrationBuilder / CompiledMigration Migration construction and compilation
Instance Instance wrapper with JSON conversion and validation
IoRegistry Protocol-aware parse/emit for all 76 formats
Repository Schematic version control (init, commit, branch, merge)
FullDiffReport / CompatReport Breaking change analysis
TheoryHandle / TheoryBuilder GAT theory construction

Documentation

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.6.0.tar.gz (35.1 kB view details)

Uploaded Source

Built Distribution

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

panproto-0.6.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for panproto-0.6.0.tar.gz
Algorithm Hash digest
SHA256 05b14d0d74b49bd3cd91ebf41dc1a3604596883d35d81036e8ef7dd8848f70f0
MD5 4f1ce3b2185a81cd0671899f4d690e2c
BLAKE2b-256 d86742b4f302d0f752838f5c2666501ebdf65fc5bb824f6256430468baa4fb82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: panproto-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd96c66e03894c15364a12bd381a0a603800104606027f68052780509889c36f
MD5 56dd2723478346a14baa846aba16147f
BLAKE2b-256 59353a279a4cd57a02de6d4f58fd9e8ce32b042a00ea50699d53b5bf7871c377

See more details on using hashes here.

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