How Facebook Engineered Its Massive Shift from Python 2 to Python 3
Jason Fried’s multi‑year effort to migrate Facebook’s massive codebase from Python 2.7 to Python 3 illustrates the technical, cultural, and organizational challenges of large‑scale language adoption and the concrete strategies that finally made Python 3 the default at the company.
Python 3 usage has grown noticeably in recent years, yet many large companies, including Facebook, still ran Python 2.7 on their infrastructure. At PyCon 2018, Facebook engineer Jason Fried recounted the four‑year journey that turned Python 3 from an obscure option into the company’s primary Python version.
Fried joined Facebook in 2011, quickly taught himself Python because it eased code reviews, and became a driving force behind Python 3 adoption. He was known for directly fixing problematic Python code, gaining influence within Facebook’s internal Python community.
Early attempts began in 2013 when Python 3.3 received tentative support, but the build system and internal libraries blocked progress. Lint tools imported future features to extend Python 2 code life, and the Apache Thrift framework, which only supported Python 2, became a major obstacle.
Inspired by Guido van Rossum’s talk on “Tulip” (later asyncio), Fried advocated for Thrift to support async I/O, leading to a roadmap that added Python 3 and Tulip support in early 2014, though adoption was initially slow.
In August 2014 Fried rewrote a service using Python 3 and gevent, confronting a broken build system, missing third‑party packages, and runtime failures. He rebuilt hundreds of packages to support both Python 2 and 3, and introduced Pyflakes into the build pipeline to enforce code quality across both versions.
He also helped train new hires, updating Python onboarding to emphasize the inevitable shift to Python 3 and encouraging developers to align with Facebook’s build system. By early 2016 the default Python version in the build system was switched to Python 3, a change that proceeded without negative impact.
Performance measurements in late 2016 showed Python 3 services ran up to 40 % faster and used half the memory compared to their Python 2 counterparts, dispelling myths about Python 3’s speed.
In early 2017, after Instagram completed its migration, Facebook reaped benefits such as new static typing and asyncio features, making Python development more enjoyable. By mid‑2018, over 55 % of Facebook’s service entry points ran on Python 3.
Fried emphasized that successful migration required hands‑on leadership, leveraging lint tools and unit tests, training newcomers, and celebrating small wins to motivate broader adoption.
Original English article: https://lwn.net/Articles/758159/ Translator: Qian Lipeng
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
