Registry / testing / flake8-pep585

flake8-pep585

JSON →
library0.1.7pypypiunverified

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-pep585
INSTALL
IMPORT
SIG · FLAKE8-PEP585
F
flake8-pep585
testingpythonv0.1.7
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

flake8_pep585
Install via pip; no explicit import needed. Add '--require-plugins=flake8-pep585' to flake8 arguments if using flake8>=6.0.
from flake8_pep585 import *
The module name contains a hyphen and cannot be imported directly; it's a flake8 plugin.

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].

pip install flake8 flake8-pep585 cat > test.py <<EOF from typing import List def foo() -> List[int]: return [1, 2] EOF flake8 test.py
Debug
Known issues
gotchaThe plugin only works when flake8 is invoked with the '--require-plugins=flake8-pep585' flag or a compatible configuration if using flake8>=6.0.
fix
Run flake8 with '--require-plugins=flake8-pep585' or configure 'require_plugins = flake8-pep585' in setup.cfg or .flake8.
affects: >=6.0.0 of flake8
gotchaOn 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.
fix
Use '--pep585-activation=always' to force enable on Python 3.7/3.8, or add 'from __future__ import annotations' to files.
affects: 0.1.6+
Upgrade
Version history
0.1.7latest on PyPI · released Feb 26, 2023
Audit
Dependencies
flake8requiredThe plugin runs as a flake8 plugin
Agent activity
26 hits · last 30 days
node
20
OpenAI (training)
1
Resources
flake8-pep585 — pip install flake8-pep585 · libregistry