flake8-type-checking
A flake8 plugin for managing type-checking imports & forward references
Decision gist · record as of 2026-08-14
Yes. This is a focused, low-friction plugin that solves a real problem—unnecessary runtime import overhead and circular dependencies—with active maintenance, no security issues, and permissive licensing. Install it if you want automated guidance on moving type-only imports into TYPE_CHECKING blocks.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires flake8 to be installed and Python 3.10 or later.
- Low friction install with just two runtime dependencies (flake8 and classify-imports).
- The package is actively maintained with a recent release and supports current Python versions (3.10–3.14).
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is a permissive license with no restrictions on use, modification, or distribution in proprietary or open-source projects.
last release 2026-02-18 (177 days) · last repo commit 2026-02-18 · 128 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 109,061 downloads/mo, #12,529 on PyPI
Alternatives
Verify before relying
pip install flake8-type-checking
# Add to .flake8 config:
# [flake8]
# extend-select = TC, TC2
# Then run flake8 as usual; the plugin will flag imports to move- Whether the plugin's inference works correctly with all pydantic, fastapi, cattrs, and injector patterns in real codebases.
- Performance impact when running on large projects with many type-checking blocks.
What it is and what it does
This flake8 plugin analyzes your code to detect imports used only for type hints and suggests moving them into TYPE_CHECKING blocks. By guarding type-only imports behind TYPE_CHECKING, you eliminate their runtime overhead (important for large libraries like pandas), reduce circular import issues, and organize imports more cleanly. The plugin works by classifying imports as application, third-party, or built-in, then checking whether they're actually used at runtime or only in annotations.
It offers two strategies for handling forward references: TC100-range codes use postponed evaluation (from __future__ import annotations), while TC200-range codes use string literals. You configure which strategy suits your codebase and Python version target. The plugin includes special handling for frameworks like Pydantic and FastAPI, where class annotations are evaluated at runtime, and can be tuned with strict mode, exemptions, and custom typing module paths.
Use it for
- Reduce import overhead in libraries that use heavy dependencies only for type hints (e.g., pandas, numpy).
- Eliminate circular import errors by moving type-only imports into TYPE_CHECKING blocks.
- Enforce consistent forward-reference style across a codebase (either future annotations or string literals).
- Validate that Pydantic or FastAPI models don't incorrectly guard runtime-needed imports.
- Organize and lint type-checking imports as part of your standard flake8 checks.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a focused, low-friction plugin that solves a real problem—unnecessary runtime import overhead and circular dependencies—with active maintenance, no security issues, and permissive licensing. Install it if you want automated guidance on moving type-only imports into TYPE_CHECKING blocks.
Install
flake8-type-checking on PyPI
Before you install
Low friction install with just two runtime dependencies (flake8 and classify-imports). The package is actively maintained with a recent release and supports current Python versions (3.10–3.14).
Requires flake8 to be installed and Python 3.10 or later.
License in practice
BSD-3-Clause is a permissive license with no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install flake8-type-checking
# Add to .flake8 config:
# [flake8]
# extend-select = TC, TC2
# Then run flake8 as usual; the plugin will flag imports to move
Verify before relying
- Whether the plugin's inference works correctly with all pydantic, fastapi, cattrs, and injector patterns in real codebases.
- Performance impact when running on large projects with many type-checking blocks.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesclassify-importsflake8 |
| Maintenance | Actively maintained 177 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 109,061 / month, #12,529 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Quality AssuranceTyping :: Typed |
Evidence: flake8_type_checking-3.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “flake8 type checking imports”
- flake8-type-checkingA flake8 plugin that identifies which imports should be moved into or…
- flake8-typing-importsA flake8 plugin that detects unguarded typing imports and…
- flake8-isortIntegrates isort into flake8 linting, reporting import violations as…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also flake8-typing-imports · flake8-annotations · flake8-pyi · flake8-tidy-imports · flake8-annotations-complexity · flake8-pep585 · flake8-import-order · flake8-isort · flake8-print · flake8-use-fstring