Brief Summary
The speaker discusses their experience leading the Python 2 to 3 migration at Facebook (Meta). The migration was a large undertaking that took close to two years and involved technical challenges and convincing many people to migrate their code. The speaker used a marketing campaign with posters and stickers to encourage migration, and code modification tools to rewrite code into the new language.
- The migration was a challenging technical and people problem.
- Marketing campaigns were used to encourage people to migrate.
- Code modification tools were used to rewrite code into the new language.
Introduction
The speaker led the Python 2 to 3 migration for Facebook, a massive project that took nearly two years. Initially, they underestimated the complexity of the task, especially considering the extensive Python codebase at Meta and the number of people who needed to be convinced to migrate their code. The project presented both technical and interpersonal challenges.
Marketing Campaign
To encourage migration, a marketing campaign was launched, featuring posters highlighting the obsolescence of Python 2 and the need to switch to Python 3. These posters showcased F-strings, a popular new feature in Python 3. Stickers with a gravestone design were also created and distributed throughout the company to reinforce the message.
Migration Tools
Initially, there were limited tools available to convert Python 2 code to Python 3 due to incompatibility issues. Over time, the community developed tools like lib2to3, and the language became more backward compatible. Meta waited for these tools to mature and then developed its own suite of code modification tools to handle unique internal requirements. These tools automated the process of rewriting code into Python 3.
Migration Process
The migration process involved scanning the codebase to identify Python 2 code, determining its owner, and assigning them a ticket to migrate the code using the provided tools. This approach worked well for a significant portion of the codebase. However, more complex cases, particularly those involving Unicode, required additional tools, improved testing infrastructure, and manual code rewriting by experts.
Completion and Aftermath
After two years, the migration was completed and celebrated with posts and a happy hour. However, remnants of Python 2.7 persisted, with some individuals attempting to circumvent the system. The speaker still receives requests to support Python 2.7, which they consistently decline.