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 yes
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, JSONata expressions, or Python callables
  • 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

Metadata

Release files for pyverge 0.13.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.13.0
File Size Uploaded Provenance
pyverge-0.13.0.tar.gz 632.1 kB With provenance Details

Built distribution (wheel)

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

Total release size: 764.2 kB

Release files / pyverge-0.13.0.tar.gz

Download URL pyverge-0.13.0.tar.gz
Size 632.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5eee1289aa1be6c7dd12bd15efd657a1d933ded4b5d084b8fc2c326e5453ebac
BLAKE2b-256 checksum
How to use checksums
9f90fb6fe1b86b1d9bf43a2212e4381f9e4b1ffbd41eb1c3fb5a7db60c5c7b84
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 22, 2026.

Transparency log

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

Download URL pyverge-0.13.0-py3-none-any.whl
Size 132.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a138abee4e3a1fa65aa3688a0eee6704e52f06336d843db804c6bb7bd116fa4f
BLAKE2b-256 checksum
How to use checksums
a8c7cc40ecce05bef9c3bdd457e22ef78faae8f35786854e7324856630912cc5
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 22, 2026.

Transparency log

Security for pyverge 0.13.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.13.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 22, 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