Introduction
Deptry is a command-line tool designed to check for dependency issues in Python projects, such as unused or missing dependencies. It supports projects managed by Poetry, pip, PDM, uv, as well as any project that follows the PEP 621 specification.
Installing Deptry
You can easily install Deptry using Poetry:
poetry add deptry
Basic Usage
Run the following command in your project root directory to start analysis:
deptry .
Output example:
Scanning 6 files...
download.py:1:8: DEP003 'requests' imported but it is a transitive dependency
main.py:10:1: DEP003 'starlette' imported but it is a transitive dependency
pyproject.toml: DEP002 'deptry' defined as a dependency but not used in the codebase
pyproject.toml: DEP002 'jinja2' defined as a dependency but not used in the codebase
utils.py:7:8: DEP003 'redis' imported but it is a transitive dependency
Found 5 dependency issues.
For more information, see the documentation: https://deptry.com/
Feel free to follow my blog at www.bboy.app
Have Fun