| name | deptry |
| description | Python dependency health checker. Use to audit Python projects for missing dependencies, unused imports, transitive dependencies, and other dependency-related issues. |
deptry — Python Dependency Checker
Basic Usage
deptry .
deptry ./src/my_package
deptry . --venv .venv
Common Options
deptry . --output-format json
deptry . --output-format table
deptry . --exclude .build,__pycache__,tests
deptry . --ignore numpy,pandas
What It Detects
| Issue | Description |
|---|
| Missing dependencies | Used in code but not in pyproject.toml/requirements.txt |
| Unused dependencies | In pyproject.toml but never imported |
| Transitive deps | Indirect dependencies that should be explicit |
| Importable packages | Packages importable but not in requirements |
When to Use
- Python dependency audit — check if pyproject.toml/requirements.txt is accurate
- Find "phantom" dependencies (used but not declared)
- Find dead dependencies (declared but never imported)
- Compare dependency quality against benchmark projects
Examples
deptry . --output-format json -o deptry.json
deptry . --venv .venv
deptry . --output-format json 2>/dev/null | jq '.issues'