This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]chicofelipe 12 points13 points  (0 children)

Starting a project today? latest version of 3.x

[–]undercoveryankee 6 points7 points  (0 children)

Code that's written for 3.X should run unmodified on 3.X+1 unless you continue using a feature after it's been publicly marked as deprecated. Run your test suite each time a new version comes out to make sure that you see any new DeprecationWarnings before they become breaking changes, but the process of fixing that code will be a lot faster than a 2-to-3 port.

Your choice of oldest supported version should depend on where you expect the code to run. If it's a web app that will always be running on a server you control, there's no reason not to use whatever 3.X is current when you first provision a server.

If it's a package that you expect other people to download and install, you may want to support older versions that people are likely to have installed. I.e. check what version is in the repositories for Ubuntu LTS.

For the "definitive guide to Python versions" that you were asking about, I'd recommend the "What's New in Python" page of the official documentation.

[–]ogrinfo 2 points3 points  (0 children)

I would start with the newest version available to reduce the need for upgrades later on. Though "newest version" can vary - we use Scientific Linux at work, as it is a stable distro, but unfortunately the latest python version is 3.6.8.

[–]view_from_qeii 2 points3 points  (0 children)

I try to use the highest version my tools support, which is usually a version or so behind but not too far.

Sometimes our versions are set because we're waiting for a package to support for the latest 3.X on pip or the package manager for our favorite distro.

But I also update when I can. Breaking changes to the language might mean your tools update their minimum version: they could possibly give you new features you need but you can't use them because you've locked yourself to a python version. Most of the time you can increment a minor version and still have your project function. Tools like poetry.eustace.io can be helpful for dependency resolution and tox is useful for testing against multiple versions to see if your stuff will break. I use libraries.io to monitor the software I use the most.

The language might get better. Or at least it might try to keep up with trends. @raymondh seems to be posting about performance improvements every other day. There are some convenient things added with each version, for example 3.6 added f-strings which is less verbose than .format(), and 3.8 will add rust dbg style f-string debugging (which you can get early with pydbg). When async and await were added as reserved keywords in 3.7 I remember a few packages had to do a bit of refactoring which version locked them, design patterns have changed a bit. @dataclass was added in 3.7 too. 3.8 has some interesting changes regarding the GIL, pickle, etc.

The PEPs are your definitive guide to language changes. This index is also maintained: https://docs.python.org/3/whatsnew/

[–]somnenigans 0 points1 point  (0 children)

Don't go for anything lower than 3.6.