Migrate Python 2 to Python 3 — beyond 2to3
Python 2 reached end-of-life in 2020, yet critical systems still run on it. The official 2to3 tool only handles mechanical syntax, leaving the hard parts — bytes/str semantics, integer division, iterator changes, dead stdlib modules — for you to find in production.
CodeShift migrates Python 2 codebases to idiomatic Python 3.12, not just syntactically valid Python 3. The engine understands the whole codebase, rewrites in dependency order, and modernizes as it goes: type hints, f-strings, pathlib, dataclasses where they fit. Every file is verified for behavior parity against the original — including the bytes/str and division semantics 2to3 silently gets wrong — and repaired automatically when a check fails.
Target stack: Python 3.12 + type hints
First migration on us · No credit card required
What actually gets modernized
print statements
print() and f-strings
Old-style classes
Modern classes & dataclasses
bytes/str ambiguity
Explicit str vs bytes handling
Integer division surprises
Correct / vs // semantics
Dead 2.x stdlib modules
Their 3.x replacements
No annotations
Full type hints (3.12)
How the migration engine works
Analyze
The whole repository is scanned: framework and version detected, every dependency mapped, risks flagged before a line is touched.
Plan
A dependency-aware migration plan orders files leaves-first, so everything a file imports is migrated before the file itself.
Rewrite
Each file is restructured into modern, idiomatic architecture — streamed live, with already-migrated symbols kept consistent across files.
Verify
Every file passes structural checks and an adversarial behavior-parity review; failures are repaired automatically before you see them.
Python 2 to Python 3: frequently asked questions
How is CodeShift better than 2to3 or futurize?+
2to3 does mechanical syntax fixes and ignores semantics — bytes/str boundaries, integer division, iterator behavior. CodeShift's AI engine reasons about what the code does, rewrites it as idiomatic Python 3.12 with type hints, and then verifies each file for behavior parity against the Python 2 original.
Does it handle the bytes vs str problem?+
Yes — that's precisely where AI migration beats rule-based tools. The engine infers whether each value is text or binary from how it's used and makes the encoding boundaries explicit in the Python 3 code.
Will my dependencies be updated too?+
The analysis phase flags Python-2-only packages and the migration swaps them for maintained Python 3 equivalents, with every substitution listed in the migration plan and final report.
Is the output tested?+
Every migration ships with an auto-generated test suite plus per-file verification results, confidence scores, and a side-by-side diff of old versus new.
Other supported migrations
Ready to modernize your Python 2 codebase?
Upload it or import from GitHub — analysis is free and takes minutes.