This release is a pre-release and may not be stable for production use.
Migration Agent (experimental alpha)
This is an experimental alpha release (
0.1.0a1). It is a research prototype for exploring evidence-backed dependency migration assistance. It does not perform fully autonomous migration of arbitrary repositories.
What it is
Migration Agent analyses a Python repository and assists with upgrading a pinned dependency from one major version to another. It walks a fixed, auditable pipeline:
MigrationSpec (discovery)
→ Migration Knowledge (static registry + dynamic web acquisition)
→ Affected-Code Discovery (AST-assisted usage search)
→ Planning (one action per usage, with an explicit strategy)
→ Transformation (mechanical edits in a working copy; original untouched)
→ Validation (syntax, residual old-usage, target-usage, test suite)
→ Completeness (every usage gets a disposition)
→ Report (evidence-preserving MigrationReport)
The package's only runtime requirement is the Python standard library.
Problem it addresses
Major-version upgrades (e.g. Pydantic 1.x → 2.x) rename, remove, or subtly change APIs. Doing such an upgrade by hand means: reading the migration guide, finding every affected call site, editing each one, and verifying nothing was missed. Migration Agent mechanises that loop while keeping every claim traceable to cited documentation.
Key ideas
- Dynamic migration knowledge acquisition. For version paths without a
built-in rule set, the agent searches the web for official migration
documentation (preferring authoritative sources), fetches the pages, and
extracts
MigrationChangeobjects from the page bodies. Search snippets are never used as evidence. - Evidence-backed migration changes. Every
MigrationChangecarries anEvidencerecord (document, section, verbatim excerpt, URL), preserved all the way through to the finalMigrationReport. - Safety behaviour. The original repository is never modified; edits
happen in a working copy. Unknown versions produce an explicit
unsupportedresult instead of fabricated knowledge. Ambiguous usages are planned asLLM_ASSISTEDand left pending rather than guessed at. - Completeness accounting. Every discovered usage receives a disposition
(
MIGRATED,NOT_MIGRATED,SKIPPED,FAILED,MANUAL_REVIEW) and the overall outcome (SUCCESS,PARTIALLY_MIGRATED,BLOCKED,FAILED,NO_MIGRATION_REQUIRED) is derived from those dispositions.
Capabilities (current)
- Repository discovery: finds
pyproject.toml,requirements.txt,requirements/*.txt,setup.py,setup.cfgdependency metadata. - Version evidence: exact pins (
==) determine the source version; non-exact constraints are reported as "unknown" rather than guessed. - Static evidence-backed knowledge for Pydantic 1.x → 2.x (a representative subset of the official migration guide).
- Dynamic web knowledge for other technology/version paths via a
standard-library search/fetch backend (injectable for tests via
set_backend()). - AST-assisted affected-usage discovery, per-usage planning, mechanical transformation of exact matches, syntax/residual/target/test validation, completeness verification, and report generation.
Current limitations (read before using)
- Knowledge-source verification still needs strengthening. The dynamic backend can accept documentation from a different project with a similar name when it ranks highly (observed: Django REST Framework release notes returned for a Django query). Cross-project results must be checked.
- Some transformations are deferred as
LLM_ASSISTED. Text-only (non-AST-confirmed) usages are deliberately left pending; the executor does not guess. Behaviour-only changes without exact code patterns are not discovered as usages. - Documented M3/M8 end-to-end limitations: multi-file migrations may be
partial; text matches inside strings/docstrings can be flagged as
candidate usages; exact-match transformation can fail on conflicting
patterns (see
E2E_TEST_SUMMARY.mdin the source repository). - Behavioural migration changes may require additional knowledge/extraction support beyond the current exact-pattern machinery.
Installation
pip install migration-agent
Requires Python 3.12 or newer. There are no runtime dependencies.
Minimal usage
The package exposes a library API (there is no command-line interface):
from pathlib import Path
from migration_agent import (
acquire_migration_knowledge,
create_migration_plan,
discover_affected_usages,
discover_migration,
execute_transformation_plan,
execute_validation,
generate_report,
verify_completeness,
)
repo = Path("./my-repo")
spec = discover_migration(repo, technology="pydantic", target_version="2")
print("source:", spec.source_version, "target:", spec.target_version)
knowledge = acquire_migration_knowledge(spec)
print("supported:", knowledge.supported)
if not knowledge.supported:
print("reason:", knowledge.reason)
else:
usages = discover_affected_usages(repo, knowledge.changes)
plan = create_migration_plan(spec, knowledge.changes, usages)
result = execute_transformation_plan(repo, plan)
validation = execute_validation(result.working_copy, usages, knowledge.changes)
completeness = verify_completeness(spec, usages, plan, result, validation)
report = generate_report(completeness)
print("outcome:", report.outcome)
For a fully worked offline example using a deterministic injected backend,
see examples/dynamic_knowledge_demo.py --mock in the source repository.
Metadata
Release files for migration-agent 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| migration_agent-0.1.0a1.tar.gz | 63.2 kB | With provenance | Details for migration_agent-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| migration_agent-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details for migration_agent-0.1.0a1-py3-none-any.whl |
Total release size: 111.8 kB
Release files / migration_agent-0.1.0a1.tar.gz
| Download URL | migration_agent-0.1.0a1.tar.gz |
|---|---|
| Size | 63.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c83c0728c2bf5b98169d91f5e84b3db797264b8959f938187d4c62138312b42f
|
|
BLAKE2b-256 checksum How to use checksums |
0f97657893b71ff9d0cc924bd955b7b251f021ce9064b09ccc48a0de99ad48c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 22, 2026.
Transparency logRelease files / migration_agent-0.1.0a1-py3-none-any.whl
| Download URL | migration_agent-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 48.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f01d7e101d5a3e28f3c22acde8b9b20ec1b94d1bed3a7aa91c862c6fc566322
|
|
BLAKE2b-256 checksum How to use checksums |
c40c580b268f174fe2336a3e812229094839e01e04bc40f4631cc4fcd23db44b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 22, 2026.
Transparency logSecurity for migration-agent 0.1.0a1
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.
Attestation for migration_agent-0.1.0a1.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 Sep 22, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.