Part of keeping codebase modernisation rolling rather than happening in bursts.
Every time a package drops an old Python, someone has to remember which
annotations and idioms the new floor makes obsolete. That should be the linter's
job.
UP (pyupgrade)
target-version is already declared, but without UP selected nothing checks that
the code matches it. Selecting UP makes the declared floor enforce itself, and
keeps doing so as the floor moves — rules for newer versions stay silent until
the floor reaches them, then activate on their own. It covers legacy typing
imports, Optional/Union, percent- and .format()-style string formatting,
quoted forward-reference annotations, stale encoding headers, and error aliases
that newer Pythons unified.
PYI (flake8-pyi)
PYI is mostly a stub-file ruleset and these packages ship no stubs, so only a
small subset applies — but it catches real bugs rather than style nits: chiefly
context-manager and constructor methods annotated as returning their own concrete
class instead of Self, which quietly breaks subclasses.
Missing mypy configuration
Separately, the mypy config pins no Python version, so type checking follows
whichever interpreter runs it and the floor is never actually verified. It should
match the declared minimum.
Not enabling FA (flake8-future-annotations)
Not enabling FA, so it doesn't get proposed again:
both its rules only police the from __future__ import annotations workaround
that older Pythons needed. On a modern floor they never fire, because UP rewrites
those annotations outright. Dead configuration.
Copied from dbfixtures/pytest-mysql#864
Part of keeping codebase modernisation rolling rather than happening in bursts.
Every time a package drops an old Python, someone has to remember which
annotations and idioms the new floor makes obsolete. That should be the linter's
job.
UP (pyupgrade)
target-versionis already declared, but without UP selected nothing checks thatthe code matches it. Selecting UP makes the declared floor enforce itself, and
keeps doing so as the floor moves — rules for newer versions stay silent until
the floor reaches them, then activate on their own. It covers legacy typing
imports,
Optional/Union, percent- and.format()-style string formatting,quoted forward-reference annotations, stale encoding headers, and error aliases
that newer Pythons unified.
PYI (flake8-pyi)
PYI is mostly a stub-file ruleset and these packages ship no stubs, so only a
small subset applies — but it catches real bugs rather than style nits: chiefly
context-manager and constructor methods annotated as returning their own concrete
class instead of
Self, which quietly breaks subclasses.Missing mypy configuration
Separately, the mypy config pins no Python version, so type checking follows
whichever interpreter runs it and the floor is never actually verified. It should
match the declared minimum.
Not enabling FA (flake8-future-annotations)
Not enabling FA, so it doesn't get proposed again:
both its rules only police the
from __future__ import annotationsworkaroundthat older Pythons needed. On a modern floor they never fire, because UP rewrites
those annotations outright. Dead configuration.
Copied from dbfixtures/pytest-mysql#864