This article is written at 2021-03-22 so this conclusion will evolve as time passes.
Some of my articles are checked after 7 years, so be advised this choice will not be valid in a year. Although the reasoning and considerations to take in count will be the same.
I answer to the question: Why Carles, do you suggest to adopt Python 3.8, and not 3.9 or 3.7 for our Internal Automation Tools?.
Reliability and Maturity
If you look at page https://devguide.python.org/#status-of-python-branches you will see the next table:
So you can see that:
- Python 3.6 was released on 2016-12-23 and will get EOL on 2021-12-23.
- That’s EOL in 9 months. We don’t want to recommend that.
- Python 3.7 was released on 2018-06-27 and will get EOL 2023-06-27.
- That’s 2 years and 3 months from now. The Status of development is focus in Security bugfixes.
- Python 3.9 was released 2020-10-05 that’s 5 months approx from now.
- Honestly, I don’t recommend for Production a version of Software that has not been in the market for a year.
- Most of the bugs and security bugs appears before the first year.
- New features released, often are not widely fully tested , and bugs found and fixed, once a year has passed.
- Honestly, I don’t recommend for Production a version of Software that has not been in the market for a year.
- Python 3.8 was released on 2019-10-14.
- That means that the new features have been tested for a year and five months approximately.
- This is enough time to make appear most bugs.
- EOL is 2024-10, that is 3 years and 7 months from now. A good balance of EOL for the effort to standardize.
- Finally Python 3.8 is the Python mainline for Ubuntu 20.04 LTS.
- If our deploy strategy is synchronized, we want to use Long Time Support versions, of course.
So my recommendation would be, at least for your internal tools, to use containers based in Ubuntu 20.04 LTS with Python 3.8.
We know Docker images will be bigger using Ubuntu 20.04 LTS than using other images, but that disk space is really a small difference, and we get the advantage of being able to install additional packages in the Containers if we need to debug.
An Ubuntu 20.04 Image with Pyhton 3.8 and pytest, uses 540 MB.
This is a small amount of space nowadays. Even if very basic Alpine images can use 25MB only, when you install Python they start to grow close to Ubuntu, to 360MB. The difference is not much, and if you used Alpine and you have suffered from Community packages being updated and becoming incompatible with wheel and you lost hours fixing the dependencies, you’ll really appreciate using my Ubuntu LTS packages approach.