# Python 2 to 3: The Eleven-Year Migration | gen2.dev

> Python 3 shipped in 2008 as a deliberately incompatible release. Python 2 was not retired until 2020. Why the migration took eleven years, and what fixed it.

Source: https://gen2.dev/cases/python-2-to-3/

---

Case file 2

# Python 2 to 3: the eleven-year migration

Python 3 broke compatibility on purpose in 2008. The language survived and is better for it, but the community carried two versions for more than a decade.

![Slide: Python 2 and Python 3 as two timelines side by side for eleven years, from 3.0 on December 3, 2008 to the Python 2 sunset on January 1, 2020.](https://gen2.dev/img/case-python-2-to-3.png)

Most Gen 2 stories are about one company and one codebase. This one is about a programming language, which means the system being replaced was every Python program anyone had ever written.

## Gen 1

By the mid-2000s Python 2 was a mature, widely used language with some flaws its designers could not fix without breaking existing code. The largest was text. Python 2 let programs mix human-readable text and raw bytes freely, which worked until the data was not plain English, and then failed in ways that were hard to find.

Work on the successor started in 2006.

## The decision

Python 3.0 was released on December 3, 2008. Its own release notes describe it as "the first ever intentionally backwards incompatible Python release."

That was the design. Rather than carry the old mistakes forever, the core team fixed them in one release and accepted that existing code would have to change. The `print` statement became a function. Text and binary data became separate types that could no longer be mixed by accident. A long list of smaller inconsistencies was cleaned up at the same time.

The plan for the old version was a short overlap. In 2008 the team announced that Python 2 would be sunset in 2015.

## What happened

![Slide: five dates from Python 3.0 on December 3, 2008 to the last Python 2 release on April 20, 2020.](https://gen2.dev/img/python-timeline.png)

The overlap was not short.

Python 2.7 was released on July 3, 2010, as the final 2.x version, and it became the version much of the industry simply stayed on. In 2014, with the deadline a year away and large parts of the ecosystem not ported, the sunset was moved five years into the future, to 2020.

Python 2 was finally retired on January 1, 2020. The last release, 2.7.18, came out on April 20, 2020. Counting from the 3.0 release, the migration took eleven years.

## Why it took so long

**Nothing could move until everything below it moved.** An application could not switch to Python 3 until every library it depended on supported Python 3. Those libraries could not drop Python 2 while their users were still on it. For years the rational choice for each individual project was to wait.

**The benefit was real but not urgent.** For a working Python 2 program, Python 3 was mostly a cost: change the code, retest everything, and end up with the same program. Correct text handling matters enormously, but it does not appear on a roadmap.

**There was no way to do it gradually.** A file was either Python 2 or Python 3. Early on, the advice was to convert a whole codebase with an automated tool. Real projects could not stop to do that, and their libraries had to serve both versions at once.

**Gen 1 kept getting better.** Python 2.7 was good, stable and supported. Every year it stayed supported made staying easier to justify.

## What fixed it

The migration did not finish because people were told to migrate. It finished because the path got easier and the deadline got real.

-   **Gen 2 moved toward Gen 1.** Python 3.3 restored the `u''` text prefix from Python 2, purely so the same source file could run on both versions. Python 3.5 added `%` formatting back to bytes for the same reason. Neither change improved Python 3 on its own terms. Both were bridges.
-   **Code that ran on both.** Once one codebase could support both versions, a library could add Python 3 without abandoning Python 2 users, and the dependency deadlock started to break.
-   **A date that did not move again.** The 2020 sunset was announced in 2014 and held.
-   **Collective commitment.** Major scientific projects, including NumPy, pandas, Matplotlib, scikit-learn, TensorFlow and PyTorch, publicly pledged to drop Python 2.7 support no later than 2020. Once the libraries had a date, their users did too.

Large applications then did the unglamorous work. Dropbox began moving its desktop client to Python 3 in 2015 and reported the transition complete in September 2018.

## The verdict

By the measure that matters, Python 3 succeeded. The language is healthier and more widely used than it has ever been, and the text model that caused the break is one nobody wants to give back.

But the cost was a decade of the whole community paying a tax to support two versions, and the original plan missed its own deadline by five years. The lesson the Python community took from it is visible in how the language has changed since: in small, compatible steps.

## What to take from it

-   **A clean break moves the cost to your users.** If they have no urgent reason to pay it, they will wait, and you will be supporting Gen 1 for as long as they do.
-   **Design the bridge first.** The compatibility features that finally made migration practical arrived four and seven years after 3.0. Shipping them at the start would have changed the whole timeline.
-   **An overlap needs an end date that people believe.** The first date moved. The second one worked because it did not.
-   **Migrations move at the speed of dependencies.** If other people's code sits on top of yours, your schedule is theirs.

If your Gen 2 has other people's code depending on Gen 1's exact behavior, that is one of the strongest signals against a clean rewrite. It is question 12 in [Should we rewrite it?](https://gen2.dev/should-we-rewrite/) for exactly this reason.

## Common questions

### How long did the move from Python 2 to Python 3 take?

Eleven years. Python 3.0 was released on December 3, 2008, and Python 2 was retired on January 1, 2020.

### When did Python 2 support end?

On January 1, 2020. The last release, 2.7.18, came out on April 20, 2020.

### Why was the Python 2 deadline moved?

In 2014, with the deadline a year away and large parts of the ecosystem not ported, the sunset was moved five years into the future, to 2020.

## Sources

1.  [What's New In Python 3.0 - Python documentation](https://docs.python.org/3/whatsnew/3.0.html)
2.  [Sunsetting Python 2 - python.org](https://www.python.org/doc/sunset-python-2/)
3.  [PEP 373 - Python 2.7 Release Schedule](https://peps.python.org/pep-0373/)
4.  [PEP 414 - Explicit Unicode Literal for Python 3.3](https://peps.python.org/pep-0414/)
5.  [PEP 461 - Adding % formatting to bytes and bytearray](https://peps.python.org/pep-0461/)
6.  [Python 3 Statement](https://python3statement.github.io/)
7.  [Dropbox - How we rolled out one of the largest Python 3 migrations ever (September 25, 2018)](https://dropbox.tech/application/how-we-rolled-out-one-of-the-largest-python-3-migrations-ever)

Last updated November 28, 2026.

## Scorecard

Worked, slowly

Gen 1

Python 2, ending with 2.7 (released July 3, 2010)

Gen 2

Python 3, starting with 3.0 (released December 3, 2008)

Approach

A clean break in the language, with both versions maintained side by side

How long

Eleven years from 3.0 to the Python 2 sunset on January 1, 2020

Verdict

It worked, and almost nobody involved would choose to do it the same way again.

## More case files

-   [Netscape 6](https://gen2.dev/cases/netscape-6/)
-   [Firefox Quantum](https://gen2.dev/cases/firefox-quantum/)
-   [Perl 6 and Raku](https://gen2.dev/cases/perl-6-raku/)
-   [AngularJS to Angular](https://gen2.dev/cases/angularjs-to-angular/)
-   [Windows Longhorn](https://gen2.dev/cases/windows-longhorn/)
-   [Digg v4](https://gen2.dev/cases/digg-v4/)
-   [Twitter to the JVM](https://gen2.dev/cases/twitter-jvm/)
-   [Basecamp](https://gen2.dev/cases/basecamp/)
-   [IPv4 to IPv6](https://gen2.dev/cases/ipv6/)
-   [VB6 to VB.NET](https://gen2.dev/cases/vb6-to-vb-net/)
-   [HTTP/2 and HTTP/3](https://gen2.dev/cases/http-2-and-3/)
-   [K-12 browser rewrite](https://gen2.dev/cases/k12-browser-rewrite/)
-   [Mac OS X](https://gen2.dev/cases/mac-os-x/)
-   [Microsoft Edge](https://gen2.dev/cases/edge-chromium/)
-   [Winamp3](https://gen2.dev/cases/winamp3/)
-   [Slack desktop](https://gen2.dev/cases/slack-desktop/)
-   [Evernote 10](https://gen2.dev/cases/evernote/)
-   [Uber rider app](https://gen2.dev/cases/uber-rider-app/)
-   [HealthCare.gov](https://gen2.dev/cases/healthcare-gov/)
-   [Thunderbird Supernova](https://gen2.dev/cases/thunderbird-supernova/)
-   [Skype](https://gen2.dev/cases/skype-cloud/)
-   [Sonos app (2024)](https://gen2.dev/cases/sonos-app-2024/)
-   [FBI Virtual Case File](https://gen2.dev/cases/fbi-virtual-case-file/)
-   [LinkedIn Inversion](https://gen2.dev/cases/linkedin-project-inversion/)
-   [Netflix to AWS](https://gen2.dev/cases/netflix-cloud-migration/)
-   [TSB migration](https://gen2.dev/cases/tsb-migration/)
-   [Phoenix pay system](https://gen2.dev/cases/phoenix-pay/)
-   [Universal Credit](https://gen2.dev/cases/universal-credit/)
-   [Queensland Health payroll](https://gen2.dev/cases/queensland-health-payroll/)
-   [Facebook for iOS](https://gen2.dev/cases/facebook-native-ios/)
-   [New Microsoft Teams](https://gen2.dev/cases/microsoft-teams-2/)
-   [Dropbox to Python 3](https://gen2.dev/cases/dropbox-python-3/)
-   [Instagram to Python 3](https://gen2.dev/cases/instagram-python-3/)
-   [Discord Go to Rust](https://gen2.dev/cases/discord-go-to-rust/)
-   [Reddit Redesign](https://gen2.dev/cases/reddit-redesign/)
-   [GetPranks](https://gen2.dev/cases/getpranks/)
-   [All case files](https://gen2.dev/cases/)
