Skip to content

23.6.0

Compare
Choose a tag to compare
@AlexWaygood AlexWaygood released this 28 Jun 12:56
· 67 commits to main since this release
dc1eb0c

Features:

  • Support Python 3.12
  • Support PEP 695 syntax for declaring type aliases
  • Correctly emit Y019 errors for PEP-695 methods that are generic around a TypeVar instead of returning typing_extensions.Self
  • Introduce Y057: Do not use typing.ByteString or collections.abc.ByteString. These types have unclear semantics, and are deprecated; use typing_extensions.Buffer or a union such as bytes | bytearray | memoryview instead. See PEP 688 for more details.
  • The way in which flake8-pyi modifies pyflakes runs has been improved:
    • When flake8-pyi is installed, pyflakes will now complain about forward references in default values for function and method parameters (the same as pyflakes does when it checks .py files). Unlike in .py files, forward references in default values are legal in stub files. However, they are never necessary, and are considered bad style. (Forward references for parameter annotations are still allowed.)

      Contributed by tomasr8.

    • When flake8-pyi is installed, pyflakes's F822 check now produces many fewer false positives when flake8 is run on .pyi files. It now understands that x: int in a stub file is sufficient for x to be considered "bound", and that "x" can therefore be included in __all__.

Bugfixes:

  • Y018, Y046, Y047 and Y049 previously failed to detect unused TypeVars/ParamSpecs/TypeAliases/TypedDicts/Protocols if the object in question had multiple definitions in the same file (e.g. across two branches of an if sys.version_info >= (3, 10) check). This bug has now been fixed.
  • Y020 was previously not emitted if quoted annotations were used in TypeVar constraints. This bug has now been fixed.

Other changes:

  • flake8-pyi no longer supports being run on Python 3.7, which has reached its end of life.
  • flake8-pyi no longer supports being run with flake8 <v6.