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

Uploaded Python 3

File details

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

File metadata

  • Download URL: panproto-0.5.1.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.5.1.tar.gz
Algorithm Hash digest
SHA256 2bdf8797c7236a12142cbc019bbfea153520d96fbc5758c845b476731ee2f55f
MD5 f1d65ef88e213ae10ca52fa55651994a
BLAKE2b-256 1c3b55c59a65c7b1e4cc98d1c70cee27cf0ce33da09f878a5c147afd61639c9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: panproto-0.5.1-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.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8bf9ea85801e8232a909049611545e9f9e0622edd504a3063369358fc7883720
MD5 942a4815c057426296afe85fd8ec815d
BLAKE2b-256 4129999947bdec75514b793edd8f5efe336924303410f62766b556c9cf760597

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