Upgrading Python

2021, Dec 17    

TL;DR: Always (try to) be on the latest version of Python.

State of Python 🐍

Python community has been asking everyone to upgrade for so long to make 2 to 3 happen. There’s still some Python 2 out there that is still used by some of the biggest companies. However, this post is not about 2 to 3. Those who are on 3 also have to keep up with the Python releases. Here’s the status of python branches as of today.

Branch Status First release End-of-life
main features 2022-10-03 2027-10
3.10 bugfix 2021-10-04 2026-10
3.9 bugfix 2020-10-05 2025-10
3.8 bugfix 2019-10-14 2024-10
3.7 bugfix 2018-06-27 2023-06-27
3.6 bugfix 2016-12-23 2021-12-23

So, 3.6 is almost out of date. It’s time to stop using Python 3.6!

Why Upgrade?


Security 🔐

With the recent log4shell vuln and the Equifax incident years back, even for large enterprises, it’s time to upgrade. Every newer version of the language brings in security patches and bug fixes.

Features ✨

Features is another reason you might wanna consider upgrading. Do you like f-strings? You couldn’t have used those if you were still using 3.5! Love pathlib? It came in 3.4. Just like these, you may not know what you’re missing until you upgrade! Here’s a reverse chronology of some Python features compiled by a Tall, Snarky Canadian.

Community Support 🌐

It’s not just the standard library. You also will have to consider the packages you depend on. Package maintainers wouldn’t be too keen on supporting older versions of Python. Latest Django supports 3.8, 3.9 and 3.10 while Flask is a bit more generous with 3.6 and newer but requires 3.7+ for async.

Another consideration is the app or cloud hosting services like Heroku and AWS. AWS and Azure currently supports Python runtime for Lambda till 3.9 only, not 3.10.


Though a detailed plan would highly depend on your organization’s usage of Python, here’s a high level suggestion of how you might go about it.


Understand every component that uses or depends on the Python version. Along the same lines, consider your frameworks like Django or Flask and their dependencies.You may also have custom scripts or utilities that use Python. This is also a good time to drop any unused or obsolete components for a little bit of cleanup.


Come up with a Testing plan for this list of components you will have to upgrade. Identify the stakeholders and send out a communication and gather any feedback.


Try out with a smallest set of components (perhaps one each from a group, say a lambda, a microsservice etc.) in a dev environment and see if you can get them to work. Document the issues you face and use that for the next batch of components. Repeat this process until you’re confident to move on to production.


Remember to document every key piece of learning and information so you will have more confidence in future upgrades.