Encoding-Safe Python 2 to Python 3 Migration Services

Find every text and bytes boundary before you move a line of code.

Your Python 2 code probably still runs. The interface script posts its files every night, the report lands in someone's inbox, the portal answers requests. What changed is the ground under it. The Python project ended support on January 1, 2020, and since that day nothing has been fixed in it, security problems included. The libraries it imports, the operating system image it sits in and the people who understand it have all kept moving.

Moves like this go wrong in predictable ways. An automatic converter produces code that runs but quietly changes what it outputs. A file written by the old version may not read cleanly in the new one. A library the code depends on was abandoned years ago. Or the team starts a hybrid that runs on both versions, never finishes it, and ends up maintaining two systems. Underneath most of these sits one difference: version 2 let text and bytes blur together, and version 3 does not.

Cabot starts with an inventory of the code, its libraries, containers, scheduled jobs and data files, and an assessment that can end in a plain recommendation to contain or retire a job instead of moving it. When a move is the right answer, we pin current behavior with tests, fix the text and bytes boundaries first, port the code and libraries, and run old and new side by side until the outputs match.

Tell us about your Python 2 application

Share what it does, which Python 2 version and libraries it uses, and where it runs. An engineer replies with the first scoping questions.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

No obligation. Your details stay private.

What moving from Python 2 to Python 3 actually involves

Python 2 to Python 3 migration is the move of Python 2 code, its libraries and the data it reads and writes to a Python 3 version that still receives fixes, in tested steps and without changing the behavior the business depends on.

That separates it from four things it is often confused with. Keeping the job running as it is, sometimes with paid extended support from a vendor, leaves the code alone and buys time, which can be a reasonable answer for something stable and isolated. An automatic converter changes syntax quickly, but it cannot tell which behavior the business relies on and it does not touch libraries, data files or the build. A hybrid that runs on both versions is a useful technique and a poor destination, because it doubles what the team has to maintain. A full rewrite starts from a blank page and has to rediscover every rule the old code enforced. A sound migration keeps what the code does and changes what it runs on.

In practice some parts move and some are rebuilt. Syntax and built in behavior change in well known ways: print becomes a function, dividing two integers returns a decimal, dictionary methods return views, and many functions that returned lists now return iterators. The hard part is text. Version 3 keeps text and bytes apart, so every place where the code reads a file, parses a message, calls a database or opens a network connection has to say which one it holds. Libraries are brought forward or replaced, and the build, containers and operating system image move with the code, because old code usually sits in an old image.

One change in the tooling matters. The 2to3 tool that many guides still recommend was deprecated in Python 3.11 and removed in Python 3.13, and the official porting guide has been discontinued since 3.11. Other rule based fixers and static analysis tools still exist, but the standard shortcut is gone, which is one more reason to treat the move as an engineering project with tests and not as a command to run.

The same method covers a second case. Python 3.9 reached its end of life in October 2025 and 3.10 in October 2026, so services that moved to Python 3 early now have to move again. The inventory, the tests and the side by side run are the same, and the work is usually smaller.

Migrating is not always the right call today. A batch job that runs once a month on an isolated server, behind controls and with an owner, can sometimes be contained for a time, and a job nobody uses can simply be retired. The case for moving builds when your auditor or security team flags the interpreter, when a library has no Python 3 release, when you cannot hire for the skill, when other systems now need to talk to it, or when every change feels risky. The assessment is built to tell you which case you are in, in writing.

Why Python 2 systems stall before they move

These are the six reasons technology and operations leaders give when the work slowed down or never started. Most of them are decided in the first weeks, before anyone writes code.

Two engineers working on laptops side by side in a modern office

The Python 2 to Python 3 migration services we deliver

Our services come in six parts, and most engagements use all of them in a sequence set by the assessment. Some organizations need the full path from inventory to retiring the old environment. Others need only the libraries brought forward, or only the images and pipeline cleaned up. We give you our recommendation and our reasoning before you commit to anything.

Every part produces something you can open and check: an inventory, a test suite that pins current behavior, a comparison report, a working build, a staged release. Testing and security run inside every part instead of sitting as separate lines.

What does Python 2 to 3 migration cost, and what moves the number?

Seven things set the cost: the number of lines and repositories, how many libraries need replacing, whether compiled extensions are involved, how much of the code has tests, the variety of data and encodings it handles, the number of integrations and scheduled jobs, and how mature the build pipeline is. Two applications of the same size can differ many times over, so any figure quoted before an assessment is a guess. Model a range in a few minutes, then tell us what you run and we will scope it properly. We would rather give you a narrow range you can plan around than a wide one that protects us.

What does a Python assessment tell you before you commit?

A short assessment answers the questions that sink most moves of this kind before any code changes. It runs in four parts, in this order, and it can end in a recommendation to contain or retire a job.

Scope your own application: send us a short description of what you run and we will tell you what the assessment would cover.

What does AI actually change in a Python migration?

It changes how fast the slow parts go and leaves the judgment where it was. Reading code that nobody documented, tracing which libraries it needs, finding constructs that changed between the versions, and drafting a plain language list of the rules the code enforces are all work a model can draft quickly. Deciding which behavior the business still needs, which was a workaround for limits that no longer exist and whether a job should survive at all is not.

The saving concentrates in three places. Discovery goes faster, because a model can summarize an unfamiliar codebase into rules and dependencies for an engineer to check. Test writing goes faster, because characterization tests that record current behavior can be drafted from the code and then run against real data. Repetitive edits go faster, because a model can propose the same change across hundreds of files for review, and can suggest type hints that let a type checker find text and bytes mistakes before anything runs.

Rule based fixers and static analyzers are part of the picture, and we treat them as one tool among several. They change many constructs reliably and leave the hard questions open: whether a value is text or bytes, which library replaces an abandoned one, and what the data layer should look like. The output is a draft that needs the same tests, review and side by side run as any other, and we would not hand it to you as finished work.

The risk runs the other way. The language is dynamic, so a model can describe a rule with confidence that the code does not implement, and it can miss behavior hidden in dynamic imports, configuration files or a database trigger. So every recovered rule is confirmed against real outputs and against the people who use the system before it counts.

AI shortens the slow parts of a migration. It does not decide which behavior survives, approve a merge or sign off a cutover. Those stay with senior engineers and with you, and where you need help choosing a model your policy allows, our AI development team is part of the conversation.

Three commitments hold on every engagement. Our process is model neutral, so we use the model your policy allows. A senior engineer reviews every change before it merges. And we never train any model on your code or data. Test data is synthetic or masked, so protected health information stays out of model prompts.

What we move your Python code onto, and the tools we use to move it

Three layers of tooling, chosen against your environment and your team's ability to run the result rather than against our preferences. The target version follows your libraries and what your security team will accept, and we recommend on evidence from the assessment. Our QA and testing practice builds the test suites that compare the new code with the old before anyone relies on it.

What we work in:

Target platforms

Python 3.13
Python 3.14
Django
Flask
FastAPI
SQLAlchemy

Data and hosting

PostgreSQL
MySQL
Docker
AWS
Azure
Redis

Delivery and AI tooling

pytest
mypy
tox
Ruff
GitHub Copilot
GitHub Actions

Where AI sits at each stage of the move, and where it does not

Each stage below has an output you can inspect and a person who approves it. Nothing an AI drafts reaches your data, your code or your production system without a named engineer accepting it first.

Migration stage What AI does What stays human Tools used
Assessment Reads the code and the dependency files and drafts a plain language list of changed constructs, library gaps, text and bytes risks and business rules Confirming which behavior the business still needs and which was a workaround GitHub Copilot, mypy, Ruff
Safety net Drafts characterization tests that record what the code does today, using real outputs as the reference Choosing which behaviors must never change and approving the tests GitHub Copilot, pytest
Port Proposes edits for changed behavior, library swaps and type hints, and drafts data conversion scripts for review Approving every merge and every data conversion GitHub Copilot, mypy, tox
Cutover Compares outputs from the old and new runs and summarizes the differences Accepting or rejecting each difference and approving each cutover pytest, GitHub Actions

The last column names the tools, so a security reviewer can see exactly what touched the work. Where your policy limits which tools can be used, the same stages run with the tools you allow and the same human review.

How a Cabot Python migration differs from a typical vendor's

These projects succeed or fail on the text and bytes boundaries, the libraries and the cutover, not on the choice of target version. Those are the places projects go wrong, so each row below is a moment where the approach changes the outcome.

Dimension Typical vendor Cabot
Starting point A quote after a short call A written inventory and assessment before you commit
Advice on whether to move Migration is always the answer, or a converter run sold as the whole job A written recommendation that can say contain or retire
Text and bytes handling Found in production after cutover Boundaries listed first and tested on real data
Libraries and extensions Left for later or replaced blindly Listed first, then each ported, replaced or retired on purpose
Testing Tests written after the build Characterization tests that pin current behavior first
Data comparison Spot checks on a few records Old and new run on the same real inputs and the outputs compared
Cutover method One weekend switch One job at a time, with old and new running side by side
Knowledge transfer A handover document at the end Your engineers in standups and reviews from week one

Ask any vendor when they would advise against migrating. A credible answer comes quickly and names the conditions. Ours is written into each assessment.

The healthcare systems we migrate Python code for

We deliver this work for three kinds of healthcare system. Each card says what we understand about that environment, rather than claiming coverage of it.

Across all three the pattern is the same: the code is important enough that a failed cutover is not an option, and old enough that few people hold the whole picture. Where the upgraded platform needs a rebuilt application around it, our healthcare application development practice carries the same discipline into the build.

Industries we already understand

volunteer_activism

Healthcare

shopping_cart

Ecommerce

paid

Fintech

apartment

Travel and Tourism

Client Success Stories

See all Cabot case studies

What migrated Python code has to prove before it goes live

Security leads every migration, because the move is your chance to close what the old interpreter never covered. We apply authentication and role based access, encrypt data in transit and at rest, replace string built queries with parameterized ones, log every change to an audit trail, hold secrets outside the code, and scan dependencies and container images and fix known vulnerable ones first. Protected health information stays out of test data and model prompts.

Where the system handles patient data, we map who can see what, scope the work to the safeguards your compliance team requires through our HIPAA compliance consulting practice, and document each control the migration touches. For each stage you receive evidence, not assurance: the test results, the comparison report, the list of changes with the engineer who approved each one and the plan for returning to the old environment.

Role based access
Authentication and session control
Encryption in transit and at rest
Parameterized queries
Audit logging of every change
Secrets management
Dependency and vulnerability scanning
Container image hygiene
HIPAA aligned controls

How does a Python 2 application move without the business stopping?

Six steps, each ending in a decision you make rather than a document you receive. Most engagements begin with the first two steps alone, so you can judge the plan and the working relationship before committing to the migration.

Start with step 01: tell us what the code does and we will scope the inventory.

Who owns each part of a Python migration at Cabot

Accountability is explicit from the first day. A solution architect owns the target design and the order of migration, and answers for choices that are expensive to reverse. A business analyst owns the recovered rules and confirms them with the people who use the system. A data engineer owns the data conversion and the comparison that proves it. Senior engineers own the language and library work and the merge reviews. A QA automation engineer owns the characterization tests and the comparison between old and new. A delivery lead owns the schedule and tells you plainly when something slips.

Our depth is greatest in four places: reading code nobody documented and finding every library and extension it needs, writing tests that pin down behavior before anything changes, handling text, bytes and encodings in files and messages, and moving data without losing integrity.

If you are searching for a Python developer who still knows version 2, you are probably trying to keep the system alive or to find someone who understands it. A single contractor leaves the same key person risk in place. Our answer is a team that recovers what the code knows, brings it to a supported version with a deep talent pool, and joins your standups and reviews from week one, so the knowledge stays with you. Where a larger group fits, we staff an embedded engineering pod inside your delivery cadence.

Why healthcare technology leaders choose Cabot for encoding-safe Python 2 to Python 3 migration services

A move off an unsupported interpreter is easy to start and hard to finish well. These are the six reasons buyers give when they explain why the work sits with us.

Where to go next, depending on what you run

This move is one of several specific moves. Which page helps next depends on where your system sits today, and it is usually one of three.

Our Clients

Questions technology and operations leaders ask before starting

  1. How do you migrate Python 2 code to Python 3?
    We inventory the code, its libraries, images, jobs and data files, pin current behavior with tests, fix the text and bytes boundaries, and then port the code and libraries in small reviewed steps. Old and new run side by side on the same inputs until the outputs match, and each job is then cut over with a rehearsed rollback. Our method runs in stages, not as a one weekend switch.
  2. Is Python 2 still supported?
    No. The Python project ended support on January 1, 2020, and no new bug reports, fixes or changes have been made since. A last release, 2.7.18, came out in April 2020 and bundled only fixes made before that date. Some vendors sell paid extended support, which can buy time for a stable, isolated job while a plan is made, but it does not fix abandoned libraries or the operating system under them. We recommend a dated plan to move or retire, with controls around the system until then.
  3. Which Python 3 version should we move to?
    Usually the newest version your libraries support, because it gives the longest runway. As of November 2026 the Python project lists 3.15, released on October 9, 2026, and 3.14 as receiving bug fixes, and 3.13, 3.12 and 3.11 as receiving security fixes only. Each version is scheduled for about five years, so 3.11 ends in October 2027, 3.12 in October 2028, 3.13 in October 2029, 3.14 in October 2030 and 3.15 in October 2031. Python 3.9 reached its end of life in October 2025 and 3.10 in October 2026. These dates are scheduled and can move.
  4. Can 2to3 or an automatic converter do the whole migration?
    No. The 2to3 tool was deprecated in Python 3.11 and removed in Python 3.13, so a current interpreter does not ship it, and the official porting guide has been discontinued. Other rule based fixers and AI can change syntax and propose edits for review. None of them decides whether a value should be text or bytes, replaces an abandoned library, rebuilds an image or proves that the output is unchanged, so the result is a draft that still needs tests, review and a side by side run.
  5. What breaks most often when moving from Python 2 to Python 3?
    Text and bytes handling comes first. The new version keeps them apart, so code that read a file, parsed a message or built a database value without saying which one it held fails or, worse, produces wrong output on unusual characters. Next come integer division, which now returns a decimal, dictionary methods and functions that return views or iterators instead of lists, changed library names and data written by the old version, such as pickled files. Tests on real data find these early.
  6. Should we migrate, contain Python 2 for now, or retire the application?
    It depends on what the code does and what surrounds it. A job that is stable, isolated, behind controls and owned can sometimes be contained for a time. A job nobody uses should be retired. A job that handles patient data, faces other systems or blocks other work should move. The assessment gives you a written recommendation for each job, and it can say contain or retire.
  7. Can we migrate without freezing feature work or stopping the application?
    Yes. We run old and new side by side, keep shipping on the old code until each part moves, and write new code for the new version only. Hybrid code that runs on both versions is kept short and then removed, and each job is cut over on its own with a rehearsed rollback. The application keeps working throughout, and the old interpreter is removed from every image and server at the end.
  8. How long does a Python 2 to Python 3 migration take, and how much does it cost?
    Both follow the same drivers: the size of the code and the number of repositories, how many libraries need replacing, whether compiled extensions are involved, how much of the code has tests, the variety of data and encodings, the number of integrations and jobs, and the maturity of the build pipeline. We give a timeline and a cost range after the assessment, so you see numbers before you commit. The migration itself runs in staged releases, usually over months, with the old system working throughout. For a first view, use the cost calculator.