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.
So, 3.6 is almost out of date. It’s time to stop using Python 3.6!
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.
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.