A command line utility to check for unused, missing and transitive dependencies in a Python project.
Maintained. Last release 8 months ago, commits in 22 of the last 26 weeks. Weaker on release cadence and contributor spread.
pip install deptry
deptry is a command line tool to check for issues with dependencies in a Python project, such as unused or missing dependencies. It supports projects using Poetry, pip, PDM, uv, and more generally any project supporting PEP 621 specification.
Dependency issues are detected by scanning for imported modules within all Python files in a directory and its subdirectories, and comparing those to the dependencies listed in the project's requirements.
Quickstart
Installation
To add deptry to your project, run one of the following commands:
# Install with poetry
poetry add --group dev deptry
# Install with pip
pip install deptry
Warning: When using pip to install , make sure you install it within the virtual environment of your project. Installing globally will not work, since it needs to have access to the metadata of the packages in the virtual environment.