Flake8 Annotations Versions Save

Flake8 Type Annotation Checking

v3.0.1

1 year ago

[v3.0.1]

Changed

  • #155 Remove upper bound on Python constraint

v3.0.0

1 year ago

[v3.0.0]

Added

  • Add ANN402 for the presence of type comments

Changed

  • Python 3.8.1 is now the minimum supported version
  • Flake8 v5.0 is now the minimum supported version

Removed

v2.9.1

1 year ago

[v2.9.1]

Changed

  • #144 Unpin the version ceiling for attrs.

Fixed

v2.9.0

2 years ago

[v2.9.0]

Added

  • #135 Add --allow-star-arg-any to support suppression of ANN401 for *args and **kwargs.

v2.8.0

2 years ago

[v2.8.0]

Added

  • #131 Add the ANN4xx error level for opinionated warnings that are disabled by default.
  • #131 Add ANN401 for use of typing.Any as an argument annotation.

Changed

  • Python 3.7 is now the minimum supported version

v2.7.0

2 years ago

Changelog

[v2.7.0]

Added

  • #122 Add support for Flake8 v4.x

Fixed

  • #117 Stop including CHANGELOG.md when building wheels.

v2.6.2

3 years ago

Changelog

[v2.6.2]

Fixed

  • #107, #108 Change incorrect column index yielded for return annotation errors.

v2.6.1

3 years ago

Changelog

[v2.6.1]

Changed

  • Remove the explicitly pinned minor version ceiling for flake8.

v2.6.0

3 years ago

Changelog

[v2.6.0]

Added

  • #98 Add --dispatch-decorators to support suppression of all errors from functions decorated by decorators such as functools.singledispatch and functools.singledispatchmethod.
  • #99 Add --overload-decorators to support generic aliasing of the typing.overload decorator.

Fixed

  • #106 Fix incorrect parsing of multiline docstrings with less than two lines of content, causing incorrect line numbers for yielded errors in Python versions prior to 3.8

Additional Details

Generic Functions

Per #98, the functools.singledispatch and functools.singledispatchmethod decorators transform a function into a single-dispatch generic function.

For example:

import functools

@functools.singledispatch
def foo(a):
    print(a)

@foo.register
def _(a: list) -> None:
    for idx, thing in enumerate(a):
        print(idx, thing)

Is correctly annotated but would previously yield linting errors for foo. In the spirit of the purpose of these decorators, linting errors are now suppressed for functions decorated with these decorators. The --dispatch-decorators configuration option has been added, which specifies a comma-separated list of decorators to be considered as dispatch decorators.

Decorators are matched based on their attribute name. For example, "singledispatch" will match any of the following:

  • import functools; @functools.singledispatch
  • import functools as fnctls; @fnctls.singledispatch
  • from functools import singledispatch; @singledispatch

By default, linting errors are suppressed for functions decorated by singledispatch or singledispatchmethod.

typing.overload decorator aliasing

Per #99, handling of the typing.overload has been made generic, removing the caveat from the initial implementation. The --overload-decorators configuration option has been added, which specifies a comma-separated list of decorators to be considered as typing.overload decorators.

Decorators are now matched based on their attribute name. For example, "overload" will match any of the following:

  • import typing; @typing.overload
  • import typing as t; @t.overload
  • from typing import overload; @overload

By default, linting errors are suppressed for functions decorated by overload, which should be a transparent change from v2.4 (#97).

v2.5.0

3 years ago

Changelog

[v2.5.0]

Added

  • #103 add --allow-untyped-nested to suppress all errors from dynamically typted nested functions. A function is considered dynamically typed if it does not contain any type hints.

Additional Details

Per #102, nested functions can fall into an interesting spot semantically for a project. They're distinct enough from private/secret functions that one may not want to strictly enforce annotation (e.g. decorator definitions) but there does not exist a mechanism to do so without either noqa or just allowing all dynamically typed functions (via --allow-untyped-defs). The --allow-untyped-nested flag allows for this stricter subset of dynamic functions.