The Python Migration That Took Years | Behind Meta’s tech transition

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.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the Apple Store
Get it on Google Play

Transcript

Full transcript of “The Python Migration That Took Years | Behind Meta’s tech transition”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.

0:00 I led the Python 2 to3 migration for Facebook. Uh it was a massive undertaking. I think it took close to two years to complete. I was a bit naive uh going into it. Honestly, I thought it would be a little bit easier than than what it was. At Meta, there is so much Python code. This was a large number of people that I had to convince to migrate and a lot of people had to chip in to move their code and get their code tested. Um, so it was a challenging technical problem as well as a challenging people problem. Yeah. So we did a whole marketing campaign uh to try to tell people that they have to migrate. So we got these posters made up. It's using something called an F string,

0:46 which is new in Python 3 and something people were really excited about. Uh, so it's telling you, you know, Python 2 is dead. You have to move your code to Python 3. We had posters hung up all over the place. I had these stickers made of the little gravestone. Uh, it was a whole marketing campaign blanketing the company to make sure people knew you have to migrate. I ended up getting them printed way too big. I wanted them way smaller and they ended up huge. They're like three inch. So when Python 3 came out originally, there really wasn't a way to convert your Python 2 code to Python 3. The tools didn't exist. It wasn't backwards compatible. There were some real fundamental differences that were hard to square between the two versions. Over the years,

1:34 that changed. the community contributed stuff like lib 2 to3 um and other migration tools came out the language itself became a little more backwards compatible actually uh over time the way that we as meta approached it is one we waited a bit we didn't switch right when three came out we waited for these tools to become available and then we added to our own suite of tools for unique bespoke stuff that we had internally that needed to be migrated and essentially those tools were what got the job done. Uh we call them code mod tools. They're code modification tools and you can run them across a piece of code and it rewrites the code into the new language basically and then we

2:24 farmed out this work across the whole company. Um so we had some tools to identify what code was Python 2. So, we had scanners that would scan our codebase, find everything that was Python 2, try to guess who wrote it or who the owner of that code was, and then assign them a ticket that said, "Hey, run this tool to migrate your code to Python 3, and if it doesn't work, talk to me or, you know, post in a group or ask a question." That worked pretty well for the most part. Uh, we were able to migrate huge amounts of code just with that basic process. Uh and then there were all of the code bases that that didn't work for uh for variety of reasons, Unicode being primary

3:11 among them. And so we had to build more tools on top of it or better testing infrastructure or like I would have to go into the codebase with my expertise and rewrite other people's code to make it work for the new codebase. Yeah, it took me a couple of years to get it all done. It was a big accomplishment. Um, we had, you know, lots of, uh, lots of celebratory posts and like a happy hour and stuff like that to say we finally did it. And then, of course, I still found like trailing Python 2.7 around for years, people trying to still utilize it and and sort of cheat the system to get it in there. And I even still get angry messages sometimes from people who are like, "My code needs Python 2.7. you need to provide it and I tell them no.

Share

More video summaries