skillfed

deptry

A command line utility to check for unused, missing and transitive dependencies in a Python project.

deptry v0.25.1 8.8M downloads/30d#1,590 on PyPI1,459
Permissive license MIT Active released

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

Scans Python projects to detect unused, missing, and transitive dependency issues by analyzing imports and comparing them against declared dependencies in Poetry, pip, PDM, uv, or PEP 621 projects.

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

pip

pip install deptry

uv

uv add deptry

poetry

poetry add deptry

Installing deptry

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.

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

Must be installed in the project's own virtual environment and run from the project root directory; requires Python 3.10 or later.

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 — click, colorama, packaging, requirements-parser, tomli
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)

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

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

Tags

unused dependency detectionmissing dependency checkerpython dependency analyzerpoetry pip pdm dependency auditimport vs requirements validatortransitive dependency issuesdev dependency scanner
dependency-auditcli-toolrust-backed

More Python Modules packages