- Add pyupgrade to
.pre-commit-config.yaml
.
If supporting py35, use --py3-plus
instead of --py37-plus
.
- repo: https://github.com/asottile/pyupgrade
rev: ...latest version...
hooks:
- id: pyupgrade
args: [--py37-plus]
- Run pre-commit (usually
tox -e lint
in my projects). - Remove unnecessary
__future__
imports. - Update
setup.py
: remove classifiers and add/updatepython_requires
python_requires=">=3.7",
- Remove conditional installs e.g.
'flake8-bugbear==19.8.0; python_version >= "3.5"'
fromsetup.py
andpre-commit-config.yaml
. - Update
tox.ini
and CI config (azure-pipelines.yml
or.travis.yml
). - Update installation/requirements and contributing docs.
- Update pyproject.yml (black) if it exists.
- Remove compatibility code:
compat.py
,sys.version_info
checks,try:..except ImportError:
- Use keyword-only arguments where sensible.
- Update changelog.
Some things for this:
try/except
blocks for things like: