flake8-requirements
Package requirements checker, plugin for flake8
What it is and what it does
flake8-requirements is a flake8 plugin that checks whether the packages you import in your code are actually declared as dependencies in your project's configuration. It reports I900 warnings when you use a package that isn't listed in your requirements, helping catch missing dependency declarations before deployment.
The plugin reads dependencies from setup.py (via eval), setup.cfg, pyproject.toml (PEP 621 or Poetry format), or requirements.txt. It includes a known mapping of package names to module names for common third-party packages, and allows custom mappings via flake8 configuration for private or renamed packages. A critical caveat: because it evaluates setup.py code to extract dependencies, you should only run it on projects you trust.
Use it for:
- Catch missing dependency declarations in CI/CD before publishing a package to PyPI.
- Validate that all imports in a codebase are covered by declared requirements during code review.
- Map custom or private package names to their module names so the checker recognizes them correctly.
- Scan installed packages in the host environment to validate requirements against what's actually available.
- Enforce dependency hygiene in monorepos or projects with complex, multi-level requirements files.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A flake8 plugin that validates whether imported packages are declared as project dependencies and reports missing or unused requirements.
Yes, if you want automated validation that your code's imports match your declared dependencies. The low install friction and permissive license make it a straightforward addition to flake8 workflows. However, the aging maintenance status (last release 356 days ago) and the security caveat around eval() of setup.py mean you should only use it on trusted codebases and monitor the project for updates.
Install
flake8-requirements on PyPI
pip
pip install flake8-requirementsuv
uv add flake8-requirementspoetry
poetry add flake8-requirementsInstalling flake8-requirements
Before you install
Low friction install with three lightweight runtime dependencies (flake8, tomli, packaging). Maintenance status is aging—last release was 356 days ago, though the repository remains active with a recent commit on 2025-12-01.
License in practice
Licensed under permissive terms (MIT), so you can use and modify freely in both open and closed projects.
Quickstart
pip install flake8-requirements
# Then run flake8 on your project:
flake8 your_project/
# Or configure in setup.cfg:
# [flake8]
# known-modules = my-lib:[mylib.drm,mylib.encryption]
Evaluates setup.py with eval() to extract dependencies—only use on code from trusted sources to avoid arbitrary code execution.
Verify before relying
- Whether I901 (unused requirement detection) is actually implemented, as the description marks it 'not implemented yet'
- Current state of support for modern Python versions beyond 3.8 and whether the aging maintenance status affects compatibility
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — flake8, tomli, packaging |
| Maintenance | aging — 356 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 196,184/month — #9,793 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_requirements-2.3.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pip-check-reqsAudits Python project imports against…
permissive · top 15,000 on PyPI
flake8-pep585A flake8 plugin that detects and flags…
copyleft · top 15,000 on PyPI
flake8-blackA flake8 plugin that runs black's code style…
permissive · top 15,000 on PyPI
flake8-unused-argumentsA flake8 plugin that detects unused function…
permissive · top 15,000 on PyPI
flake8-tidy-importsA flake8 plugin that detects and reports…
permissive · top 15,000 on PyPI
fawltydepsFawltydeps identifies undeclared dependencies…
permissive · top 15,000 on PyPI
flake8-annotationsA Flake8 plugin that enforces PEP 3107-style…
permissive · top 15,000 on PyPI
flake8-cognitive-complexityA flake8 extension that checks Python code for…
permissive · top 15,000 on PyPI
flake8-typing-importsA flake8 plugin that detects unguarded typing…
permissive · top 15,000 on PyPI
Flake8-pyprojectFlake8-pyproject enables Flake8 to read its…
permissive · top 5,000 on PyPI