Skip to main content

pyverge

PyPI version PyPI downloads Python versions

Schema evolution and migrations for versioned data. Register model versions, define migrations between them, and converge payloads to a target schema at runtime. The engine is provider-agnostic; Pydantic and JSON Schema adapters ship today.

Installation

pip install pyverge                 # core library
pip install "pyverge[cli]"          # CLI
pip install "pyverge[fastmcp]"      # MCP tool server
pip install "pyverge[faststream]"   # messaging adapter

Development: uv sync --group dev.

Quick start

from typing import Literal

import semver
from pydantic import BaseModel

from pyverge import Manager
from pyverge.migration import MigrationSettings, PydanticModelAdapter

UserManager = Manager[semver.Version].configure(
    MigrationSettings(),
    PydanticModelAdapter(),
)


@UserManager.model()
class UserV1(BaseModel):
    kind: Literal["User"] = "User"
    version: Literal["1.0.0"] = "1.0.0"
    name: str
    email: str


@UserManager.model()
class UserV2(BaseModel):
    kind: Literal["User"] = "User"
    version: Literal["2.0.0"] = "2.0.0"
    name: str
    email: str
    age: int | None = None


@UserManager.migration("User", "1.0.0", "2.0.0")
def add_age(data: dict, context=None) -> dict:
    return {**data, "age": None}


migrated = UserManager().migrate(
    {"kind": "User", "version": "1.0.0", "name": "Alice", "email": "a@b.com"}
)
# {"kind": "User", "version": "2.0.0", "name": "Alice", "email": "a@b.com", "age": None}

Async and prepared runs

result = await manager.amigrate(payload)

run = manager.delegate(payload)
first = run.run(context={"tenant_id": "tenant_a"})
second = run.run(context={"tenant_id": "tenant_b"})

migrate/amigrate execute immediately. delegate and prepare return a reusable MigrationRun. Execution policy comes from settings:

MigrationSettings(execution_mode="async", parallel_workers=4)

Migration formats

Format Use when Context
JSON Patch structural changes no
JSONata declarative expressions planned
Python callable imperative logic yes

CLI

pyverge init                                       # scaffold project
pyverge doctor --manager myapp.models:UserManager  # registry health
pyverge validate data.json --manager myapp.models:UserManager \
  --schema User --version 1.0.0
pyverge migrate data.json --manager myapp.models:UserManager --target latest
pyverge migrate data.json --manager myapp.models:UserManager --check
pyverge compat --manager myapp.models:UserManager --fail-on-breaking
pyverge manifest --manager myapp.models:UserManager > manifest.json
pyverge diff --manager myapp.models:UserManager --from 1.0.0 --to 2.0.0
pyverge export --manager myapp.models:UserManager
pyverge info --manager myapp.models:UserManager

Managers are module:object_path and may be an instance, configured subclass, or zero-arg factory. Runtime schemas require a factory that builds the manager from their source.

manifest is a CLI-only contract: it emits a JGF v2 graph envelope with node schema hashes, migration hashes, and a content hash. Lifespan/startup does not write it. CI commands (doctor, validate, migrate --check, compat) return non-zero on failure. Config auto-discovery is not wired yet.

See CLI Reference.

Features

  • Versioned registry — semver or ISO date versions, decorator registration
  • Convergent engine — graph-driven migration of nested versioned entries
  • Declarative migrations — JSON Patch or Python callables; JSONata planned
  • Runtime context — shared read-only bindings across every step
  • Sync/async executors — sequential or level-parallel; prepared runs
  • Reflection — reconstruct missing models or propose migrations from diffs
  • Compatibility — CompatibilityReport, breaking-change checks, JSON Patch rendering
  • Graph manifest — JGF v2 snapshot with stable hashes for CI divergence checks
  • Adapters — FastMCP tools/prompts/resources and FastStream messages
  • Hooks — before/after/error callbacks, async-aware, OpenTelemetry hook

Documentation

Plan

  • Additional model adapters: dataclasses, attrs, marshmallow, MessagePack
  • Real-source showcase drivers: MongoDB, Kafka, RabbitMQ, MQTT
  • Generated API reference once the SDK surface stabilizes

Metadata

Release files for pyverge 0.12.0

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

Source distribution (sdist)

Source distribution for pyverge 0.12.0
File Size Uploaded Provenance
pyverge-0.12.0.tar.gz 630.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyverge 0.12.0
File Interpreter ABI Platform
pyverge-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 760.6 kB

Release files / pyverge-0.12.0.tar.gz

Download URL pyverge-0.12.0.tar.gz
Size 630.3 kB
Tags Source
SHA-256 checksum
How to use checksums
edaaa665cbd2b5324c078085dce2049349f901a5a4c979770f7b7ce26ed03027
BLAKE2b-256 checksum
How to use checksums
d5f3d768c4550fcbb50355ac5be62440664d69ba0f6ba99e6843dd5c127b7da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / pyverge-0.12.0-py3-none-any.whl

Download URL pyverge-0.12.0-py3-none-any.whl
Size 130.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
958857cdd956142aae250d373eaa383a824017b6826c4124c8b6861ca7f662da
BLAKE2b-256 checksum
How to use checksums
27357f99d7fc32bd4b6fb9c3d00d065bfc3cc0f7cbdf1af8297bd3d9041b4981
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Security for pyverge 0.12.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyverge-0.12.0.tar.gz

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 Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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