Skip to main content

flake8-annotations-complexity

Build Status PyPI version PyPI - Python Version

An extension for flake8 to report on too complex type annotations.

Complex type annotations often means bad annotations usage, wrong code decomposition or improper data structure choice. They are also hard to read and make code look java-like.

Annotation complexity is maximum annotation nesting level. So List[int] complexity is 2 and Tuple[List[Optional[str]], int] is 4.

The plugin checks annotations of every argument kind (positional-only, regular, *args, keyword-only and **kwargs), return types of both regular and async functions, and annotated assignments.

Checks

Code Description Option Default
TAE002 Annotation is too complex (nesting level) --max-annotations-complexity 3
TAE003 Annotation is too long (number of elements) --max-annotations-len 7

Requirements

Python 3.10 – 3.14.

Installation

pip install flake8-annotations-complexity

Example

Sample file:

# test.py


def foo() -> List[int]:
    return [1]

Usage:

$ flake8 --max-annotations-complexity=1 test.py
test.py:4:14: TAE002 too complex annotation (2 > 1)

Contributing

We would love you to contribute to our project. It's simple:

  1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
  2. Create a pull request. Make sure all checks are green.
  3. Fix review comments if any.
  4. Be awesome.

Here are useful tips:

  • The project uses uv. Run make install (or uv sync) to create the environment.
  • Install the git hooks once with uv run pre-commit install.
  • You can run all checks and tests with make check. Please do it before CI does.
  • We use BestDoctor python styleguide.
  • We respect Django CoC. Make soft, not bullshit.

Metadata

Release files for flake8-annotations-complexity 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-annotations-complexity 0.2.0
File Size Uploaded
flake8_annotations_complexity-0.2.0.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-annotations-complexity 0.2.0
File Interpreter ABI Platform
flake8_annotations_complexity-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / flake8_annotations_complexity-0.2.0.tar.gz

Download URL flake8_annotations_complexity-0.2.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
06d3b20aa6048642860b54dfcb74ec786e97a4f65d7548d9ab3f2b77ab60e1ec
BLAKE2b-256 checksum
How to use checksums
ac00105bd4fcc95e0b73873bf6cc7eb91f19ba8630953c116b6cababf3fe7543
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / flake8_annotations_complexity-0.2.0-py3-none-any.whl

Download URL flake8_annotations_complexity-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3b86dd5dbbf5eeb5b2ff5c0a68c7dddbcfc0766e057793734b5ccf2a75cf43f
BLAKE2b-256 checksum
How to use checksums
fe298160194a6275c1847ed0f426c79ac01e348d27930db12d6626af15e95905
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

1 release file

0.0.4

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page