Deptry Dependency Checker
Deptry is a command-line utility for Python projects that identifies unused, missing, and transitive dependencies. Maintained by Astral (the team behind Ruff), it's actively developed with regular releases, often in sync with the broader Astral ecosystem.
Warnings
- breaking Deptry's ownership and repository moved from `s-weigand/deptry` to `astral-sh/deptry`. While the core CLI interface largely remained consistent, ensure you are installing the package from the official source and referring to the documentation at `deptry.astral.sh`. Older guides or references might point to the archived repository.
- breaking The `--requirements-txt` CLI flag was removed. Deptry now relies on auto-discovery of dependency files (e.g., `requirements.txt`, `pyproject.toml`) or explicit configuration within `pyproject.toml`.
- gotcha Deptry may sometimes report false positives (unused dependencies) or false negatives (missing dependencies). This can occur due to dynamic imports, specific project structures, or dependencies used only in non-source files (e.g., configurations, CI scripts).
- gotcha Deptry requires Python 3.10 or newer. Attempting to run it with older Python versions will result in an installation error or runtime failures.
Install
-
pip install deptry
Quickstart
deptry .