--- id: deptry version: "0.25.1" license: MIT license_treatment: permissive maintenance: active --- # deptry — A command line utility to check for unused, missing and transitive dependencies in a Python project. License: permissive · Maintenance: active · Downloads: 8.8M/mo ## 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 above — 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 pip install deptry uv add deptry 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_current - Install friction: medium - Maintenance: active - Downloads: 8.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags unused dependency detection, missing dependency checker, python dependency analyzer, poetry pip pdm dependency audit, import vs requirements validator, transitive dependency issues, dev dependency scanner, dependency-audit, cli-tool, rust-backed [View on SkillFed](https://skillfed.io/packages/deptry) · [View on PyPI](https://pypi.org/project/deptry/)