-
Notifications
You must be signed in to change notification settings - Fork 15
Drop support of old Python version
For the most part, dropping support of old Python versions is the opposite of support new Python version, but with a few more checks.
As per our policy, we aim to support Python versions for at least 42 months (or 36 months if it's troublesome for some reason). In practice, we can probably support versions of Python for longer, b/c it does not cost us any extra CI time (b/c we choose versions randomly). If supporting an extra-old version of Python ever becomes a nuisance, or if we want new features available in the next Python version, then by all means drop support for it! It may also be interesting to look at download data to see usage of different versions.
- Remove
"py3x"
from[tool.black.target-version]
- Remove
"Programming Language :: Python :: 3.x",
from[project.classifiers]
- Remove unnecessary warning filters in
[tool.pytest.ini_options.filterwarnings]
- Update
[tool.ruff.target-version]
to next version, such as"py39"
- Update minimum dependency versions in
pyproject.toml
(dependencies
andoptional-dependencies
) to match what we test- (Optional) Also, removing support of a Python version is a natural time to remove supported versions of dependencies, which we may support for much longer than 24 months if it's trivial to do so.
- Remove
3.x
option from randompyver
(and its weight)
- Remove
3.x
option from randompyver
(and its weight) - Delete
if
branch under "Update env" task for this Python version- Note that this can, in effect, increase the minimum supported version of a dependency
- Update
args
ofpyupgrade
pre-commit, such asargs: [--py39-plus]
Update versions under python-version:
in e.g. CI scripts. Find them:
$ git grep 'python-version.*3.8'
As a sanity check, perform a search to see if there are any lingering items (you can also start with this step!)
$ git grep 3\.8
$ git grep py38
$ git grep MAINT
Update Python version in binder/environment.yml
and docs/env.yml
whenever.
Finally, be aware of any other new Python features that are now available to use
and whether any from __future__ import whatever
are no longer needed.
Sometimes, the linters as part of pre-commit will update or flag things for us.