Releases: PyCQA/flake8-pyi
Releases · PyCQA/flake8-pyi
26.5.0
Breaking Changes
- Previously, flake8-pyi monkey patched flake8's F821 (undefined name) check to
avoid false positives in stub files. This monkey patch has been removed.
Instead, we now recommend to disable F821 when running flake8 on stub files. - Remove the now unnecessary
--no-pyi-aware-file-checkeroption. - Y034 no longer triggers in protocol class definitions.
New Error Codes
- Y068: Don't use
@overridein stub files
Other changes
- Drop support for Python 3.9
25.5.0
New error codes:
- Introduce Y067: Don't use
Incomplete | None = None. - Introduce Y091: Protocol method parameters should not be positional-or-keyword.
Other changes:
- Y011/Y015 will now allow all defaults that include an attribute access, for example
math.infor enum members. - Development-only dependencies are now declared using dependency groups rather than optional dependencies.
- The plugin now exists as a
flake8_pyipackage rather than a singlepyi.pyfile. - Declare support for Python 3.14
24.9.0
Bugfixes:
- Don't emit Y053 for long strings inside
Literalslices or metadata strings insideAnnotatedslices.
Other changes:
flake8-pyino longer supports being run using Python 3.8. As a result, it not longer depends on the third-partyast_decompilerpackage.
24.6.0
Bugfixes
- Allow the use of
typing_extensions.TypeVarin stubs.typing_extensions.TypeVarhas the default parameter, which only exists on Python 3.13+ when usingtyping.TypeVar. - Reduce false positives from Y052 in relation to enum subclasses.
Other changes
- Declare support for Python 3.13
24.4.1
New error codes:
- Y066: When using if/else with
sys.version_info, put the code for new Python versions first.
24.4.0
Bugfixes:
- Fix Y026 false positive: allow simple assignment to
Nonein class scopes if the class is known to be an enum class.
24.3.1
New error codes:
- Y064: Use simpler syntax to define final literal types. For example, use
x: Final = 42instead ofx: Final[Literal[42]] - Y065: Don't use bare
Incompletein parameter and return annotations.
Bugfixes:
- Y090: Fix false positive for
tuple[Unpack[Ts]].
24.3.0
New error codes:
- Y063: Use PEP 570 syntax to mark positional-only arguments, rather than the older Python 3.7-compatible syntax described in PEP 484.
24.1.0
New error codes:
- Y062: Disallow duplicate elements inside
Literal[]slices.
Other features:
- Support flake8>=7.0.0
- Y061 is no longer emitted in situations where Y062 would also be emitted.
- Improve error message for Y060.
- Y023 now bans more imports from
typing_extensionsnow that typeshed has dropped support for Python 3.7.
Bugfixes:
- Y016: Fix false positive if a method had positional-only parameters using PEP 570 syntax and the first positional-or-keyword parameter following the positional-only parameters used a custom TypeVar (see #455).
- Y046: Fix false negative where an unused protocol would not be detected if the protocol was generic.
23.11.0
New error codes:
- Y058: Use
Iteratorrather thanGeneratoras the return value for simple__iter__methods, andAsyncIteratorrather thanAsyncGeneratoras the return value for simple__aiter__methods. - Y059:
Generic[]should always be the last base class, if it is present in the bases of a class. - Y060, which flags redundant inheritance from
Generic[]. - Y061: Do not use
Noneinside aLiteral[]slice. For example, useLiteral["foo"] | Noneinstead ofLiteral["foo", None].
Other changes:
- The undocumented
pyi.__version__andpyi.PyiTreeChecker.versionattributes has been removed. Useflake8 --versionfrom the command line, orimportlib.metadata.version("flake8_pyi")at runtime, to determine the version offlake8-pyiinstalled at runtime. - Y038 now flags
from typing_extensions import AbstractSetas well asfrom typing import AbstractSet. - Y022 and Y037 now flag more imports from
typing_extensions. - Y034 now attempts to avoid flagging methods inside classes that inherit from
builtins.type,abc.ABCMetaand/orenum.EnumMeta. Classes that have one or more of these as bases are metaclasses, and PEP 673 forbids the use oftyping(_extensions).Selffor metaclasses. While reliably determining whether a class is a metaclass in all cases would be impossible for flake8-pyi, the new heuristics should reduce the number of false positives from this check. - Attempting to import
typing_extensions.Textnow causes Y039 to be emitted rather than Y023. - Y053 will no longer be emitted for the argument to
@typing_extensions.deprecated.