A flake8 plugin that enforces the use of new-style type hints as specified in PEP 585 (e.g., list[str] instead of typing.List[str]). Current version 0.1.7 supports Python 3.7+ with configurable activation on older versions. Released periodically.
pip install flake8-pep585Verified import paths — ran on the pinned version, not inferred.
Install the plugin and run flake8 on a file with an old-style type hint. The plugin will emit an error (PE P585) suggesting to use list[int] instead of List[int].
Run flake8 with '--require-plugins=flake8-pep585' or configure 'require_plugins = flake8-pep585' in setup.cfg or .flake8.
Use '--pep585-activation=always' to force enable on Python 3.7/3.8, or add 'from __future__ import annotations' to files.