Registry / testing / flake8-type-checking

flake8-type-checking

JSON →
library3.2.0pypypi✓ verified 81d ago

A flake8 plugin for managing type-checking imports and forward references. Current version 3.2.0, requires Python >=3.10. Released irregularly with multiple minor versions per year.

pip install flake8-type-checking
INSTALL
IMPORT
SIG · FLAKE8-TYPE-CHECKI
F
flake8-type-checking
testingpythonv3.2.0
Install
1.9s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.2.0 · 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 · 19.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.9s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

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

flake8_type_checking
import flake8_type_checking
from flake8_type_checking import ...

Basic usage: install and configure flake8, then add ignore or error codes as needed. The plugin automatically detects TYPE_CHECKING blocks.

# file: setup.cfg or .flake8 [flake8] extend-ignore = TC001,TC002 # adjust as needed # file: example.py from typing import TYPE_CHECKING if TYPE_CHECKING: from foo import Bar # acceptable if only used in type hints def greet() -> None: # Use Bar here? Actually, only for type checking pass
flake8 --version
Debug
Known issues
breakingv3.0.0 broke detection of re-exported typing symbols like `cast` and `Annotated` from non-typing modules. You must configure `type-checking-typing-modules` if you re-export them.
fix
Add `type-checking-typing-modules = mymodule.typing` to your flake8 config, where `mymodule.typing` is the module that re-exports.
affects: >=3.0.0
gotchaThe plugin treats `TYPE_CHECKING` blocks specially; ordinary conditional imports (e.g., `if False:`) are not recognized. Only `from typing import TYPE_CHECKING` (or `typing.TYPE_CHECKING`) triggers the plugin's logic.
fix
Always import TYPE_CHECKING from typing, not from other modules.
affects: all
deprecatedPython 3.8 support dropped in v3.0.0; Python 3.10+ required.
fix
Upgrade to Python 3.10 or later.
affects: >=3.0.0
gotchaTC010 (invalid use of string literals with `|`) was added in v2.9.0. It flags union types as strings even when they are syntactically valid in Python 3.10+. This may cause false positives for type annotations that are not evaluated at runtime.
fix
Use `from __future__ import annotations` or convert string annotations to actual type hints, or disable TC010 with `extend-ignore = TC010`.
affects: >=2.9.0
Upgrade
Version history
3.2.0latest on PyPI · released Feb 18, 2026
Audit
Dependencies
flake8requiredPlugin runs as a flake8 extension
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
flake8-type-checking — pip install flake8-type-checking · libregistry