{"id":23739,"library":"flake8-pep585","title":"flake8-pep585","description":"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.","status":"active","version":"0.1.7","language":"python","source_language":"en","source_url":"https://github.com/decorator-factory/flake8-pep585","tags":["flake8","linting","type-hints","pep-585"],"install":[{"cmd":"pip install flake8-pep585","lang":"bash","label":"Install the plugin"}],"dependencies":[{"reason":"The plugin runs as a flake8 plugin","package":"flake8","optional":false}],"imports":[{"note":"The module name contains a hyphen and cannot be imported directly; it's a flake8 plugin.","wrong":"from flake8_pep585 import *","symbol":"flake8_pep585","correct":"Install via pip; no explicit import needed. Add '--require-plugins=flake8-pep585' to flake8 arguments if using flake8>=6.0."}],"quickstart":{"code":"pip install flake8 flake8-pep585\ncat > test.py <<EOF\nfrom typing import List\ndef foo() -> List[int]:\n    return [1, 2]\nEOF\nflake8 test.py","lang":"python","description":"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]."},"warnings":[{"fix":"Run flake8 with '--require-plugins=flake8-pep585' or configure 'require_plugins = flake8-pep585' in setup.cfg or .flake8.","message":"The plugin only works when flake8 is invoked with the '--require-plugins=flake8-pep585' flag or a compatible configuration if using flake8>=6.0.","severity":"gotcha","affected_versions":">=6.0.0 of flake8"},{"fix":"Use '--pep585-activation=always' to force enable on Python 3.7/3.8, or add 'from __future__ import annotations' to files.","message":"On Python 3.7 and 3.8, the plugin is disabled by default unless 'from __future__ import annotations' is used. This can be confusing when running CI on multiple Python versions.","severity":"gotcha","affected_versions":"0.1.6+"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Do not import flake8_pep585 directly; it is a flake8 plugin. Run flake8 with the plugin installed and ensure require-plugins is set.","cause":"The plugin is installed but users try to import it directly as a Python module.","error":"ModuleNotFoundError: No module named 'flake8_pep585'"},{"fix":"Change typing.List[int] to list[int], typing.Dict[str, int] to dict[str, int], etc.","cause":"The plugin correctly flags old-style type hints (e.g., typing.List) that should be replaced with built-in generics (e.g., list).","error":"PEP 585: Use new-style type hint '...' instead of 'typing...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}