osprey-oss/deptry

Find unused, missing and transitive dependencies in a Python project.

Python

1,493

1,401 commits

updated Oct 12, 2026

See the code

README

deptry logo

Release Build status Supported Python versions codecov PyPI - Downloads License

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.


Documentation - Contributing


Quickstart

Installation

To add deptry to your project, run one of the following commands:

# Install with uv
uv add --dev deptry

# Install with poetry
poetry add --dev deptry

# Install with pip
pip install deptry

Warning: When using pip to install deptry, make sure you install it within the virtual environment of your project. Installing deptry globally will not work, since it needs to have access to the metadata of the packages in the virtual environment.

Prerequisites

deptry should be run within the root directory of the project to be scanned, and the project should be running in its own dedicated virtual environment.

Usage

To scan your project for dependency issues, run:

deptry .

Example output could look as follows:

Scanning 2 files...

foo/bar.py:1:0: DEP004 'numpy' imported but declared as a dev dependency
foo/bar.py:2:0: DEP001 'matplotlib' imported but missing from the dependency definitions
pyproject.toml: DEP002 'pandas' defined as a dependency but not used in the codebase
Found 3 dependency issues.

Configuration

deptry can be configured by using additional command line arguments, or by adding a [tool.deptry] section in pyproject.toml. For more information, see the Usage and Configuration documentations.


Repository initiated with osprey-oss/cookiecutter-poetry.

cicd
dependencies
pep621
poetry
python
rust

osprey-oss/deptry

Find unused, missing and transitive dependencies in a Python project.

Python

1,493

1,401 commits

updated Oct 12, 2026

See the code

README

deptry logo

Release Build status Supported Python versions codecov PyPI - Downloads License

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.


Documentation - Contributing


Quickstart

Installation

To add deptry to your project, run one of the following commands:

# Install with uv
uv add --dev deptry

# Install with poetry
poetry add --dev deptry

# Install with pip
pip install deptry

Warning: When using pip to install deptry, make sure you install it within the virtual environment of your project. Installing deptry globally will not work, since it needs to have access to the metadata of the packages in the virtual environment.

Prerequisites

deptry should be run within the root directory of the project to be scanned, and the project should be running in its own dedicated virtual environment.

Usage

To scan your project for dependency issues, run:

deptry .

Example output could look as follows:

Scanning 2 files...

foo/bar.py:1:0: DEP004 'numpy' imported but declared as a dev dependency
foo/bar.py:2:0: DEP001 'matplotlib' imported but missing from the dependency definitions
pyproject.toml: DEP002 'pandas' defined as a dependency but not used in the codebase
Found 3 dependency issues.

Configuration

deptry can be configured by using additional command line arguments, or by adding a [tool.deptry] section in pyproject.toml. For more information, see the Usage and Configuration documentations.


Repository initiated with osprey-oss/cookiecutter-poetry.

cicd
dependencies
pep621
poetry
python
rust

Project health

PyPI

Latest release

0.25.1 · Mar 18, 2026

Releases this year

2

Significant stargazers

(top 24 of 45)

Omer Katz

376 followers · starred Dec 2022

Emil Ernerfeldt

8,202 followers · starred Mar 2024

Frost Ming

1,718 followers · starred Nov 2023

Colin Dean

260 followers · starred May 2023