skillfed

flake8-requirements

Package requirements checker, plugin for flake8

flake8-requirements v2.3.0 196.2K downloads/30d#9,793 on PyPI37
Permissive license AGING released

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-requirements

uv

uv add flake8-requirements

poetry

poetry add flake8-requirements

Installing 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

Framework :: Flake8Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance

Tags

flake8 plugin dependency checkervalidate package requirementsmissing import requirementsflake8 import validationcheck declared dependenciesunused package detectionrequirement validation tool
flake8-plugindependency-validationcode-quality

More Python Modules packages