deptry
A command line utility to check for unused, missing and transitive dependencies in a Python project.
Decision gist · record as of 2026-08-14
Yes. Deptry solves a real problem—dependency drift—that most Python projects accumulate over time. It's actively maintained, has no known vulnerabilities, uses a permissive license, and the medium install friction (Python 3.10+ requirement, virtual-environment-only) is a reasonable trade-off for a development tool. Install it as a dev dependency and run it in CI.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Must be installed in the project's own virtual environment and run from the project root directory; requires Python 3.10 or later.
- Medium install friction: requires Python 3.10+ and must be installed in the project's own virtual environment, not globally.
- Prebuilt wheels available for CPython and PyPy across common platforms.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute deptry freely provided you include the license notice.
last release 2026-03-18 (149 days) · last repo commit 2026-08-12 · 1,459 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 8,838,663 downloads/mo, #1,590 on PyPI
Alternatives
Verify before relying
pip install deptry
# Then from your project root:
deptry .
# Output shows issues like:
# foo/bar.py:1:0: DEP004 'numpy' imported but declared as a dev dependency- Accuracy of import detection across different Python syntax patterns and dynamic imports
- Performance characteristics on large codebases with thousands of files
- Support scope for less common dependency declaration formats beyond the listed tools
What it is and what it does
Deptry is a command-line tool that audits Python project dependencies by scanning source code for actual imports and comparing them against what your project declares. It works with Poetry, pip, PDM, uv, and any project following PEP 621, identifying three main problems: dependencies you've declared but never use, dependencies you import but forgot to declare, and transitive dependencies that may cause issues. You run it from your project root within its virtual environment, and it reports each issue with a file location and error code.
The tool is written in Rust for performance and distributed as prebuilt wheels for most platforms. It's actively maintained, supports Python 3.10 through 3.14, and can be configured via command-line flags or a `[tool.deptry]` section in pyproject.toml. Its main dependencies are lightweight CLI and parsing libraries (click, colorama, packaging, requirements-parser, tomli).
Use it for
- Enforce clean dependency hygiene in CI/CD pipelines by catching unused or missing declarations before merge
- Audit existing projects to identify and remove bloated or forgotten dependencies that slow installation
- Validate that dev-only dependencies (like test frameworks) aren't accidentally imported in production code
- Detect missing transitive dependencies that could break if an intermediate package changes its exports
- Integrate into pre-commit hooks to catch dependency issues during local development
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Deptry solves a real problem—dependency drift—that most Python projects accumulate over time. It's actively maintained, has no known vulnerabilities, uses a permissive license, and the medium install friction (Python 3.10+ requirement, virtual-environment-only) is a reasonable trade-off for a development tool. Install it as a dev dependency and run it in CI.
Install
deptry on PyPI
Before you install
Medium install friction: requires Python 3.10+ and must be installed in the project's own virtual environment, not globally. Prebuilt wheels available for CPython and PyPy across common platforms. Active maintenance with recent releases.
Must be installed in the project's own virtual environment and run from the project root directory; requires Python 3.10 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute deptry freely provided you include the license notice.
Quickstart
pip install deptry
# Then from your project root:
deptry .
# Output shows issues like:
# foo/bar.py:1:0: DEP004 'numpy' imported but declared as a dev dependency
Verify before relying
- Accuracy of import detection across different Python syntax patterns and dynamic imports
- Performance characteristics on large codebases with thousands of files
- Support scope for less common dependency declaration formats beyond the listed tools
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 5 packagesclickcoloramapackagingrequirements-parsertomli |
| Maintenance | Actively maintained 149 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,838,663 / month, #1,590 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: RustTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance |
Evidence: deptry-0.25.1-cp310-abi3-macosx_10_12_x86_64.whl; deptry-0.25.1-cp310-abi3-macosx_11_0_arm64.whl; deptry-0.25.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; deptry-0.25.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; deptry-0.25.1-cp310-abi3-musllinux_1_1_aarch64.whl; deptry-0.25.1-cp310-abi3-musllinux_1_1_x86_64.whl; deptry-0.25.1-cp310-abi3-win_amd64.whl; deptry-0.25.1-cp310-abi3-win_arm64.whl; deptry-0.25.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl; deptry-0.25.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl; deptry-0.25.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; deptry-0.25.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; deptry-0.25.1-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl; deptry-0.25.1-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl; deptry-0.25.1-pp311-pypy311_pp73-win_amd64.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 › “unused dependency detection”
- deptryScans Python projects to detect unused, missing, and transitive…
- flake8-requirementsA flake8 plugin that validates whether imported packages are declared…
- uncalledDetects unused functions in Python projects using regular expressions…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also fawltydeps · pip-check-reqs · cppclean · pdm · creosote · flawfinder · flake8-requirements · pysentry-rs · rootpath · dependency-groups