A command line utility to check for unused, missing and transitive dependencies in a Python project.
Project description
deptry is a command line tool to check for issues with dependencies in a Python project, such as unused or missing dependencies. It supports the following types of projects:
- Projects that use Poetry and a corresponding pyproject.toml file
- Projects that use PDM and a corresponding pyproject.toml file
- Projects that use any package manager that strictly follows PEP 621 dependency specification
- Projects that use a requirements.txt file according to the pip standards
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 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 section of the documentation..
Repository initiated with fpgmaas/cookiecutter-poetry.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for deptry-0.18.0-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57e09ca29e98c4782197dc959849498941b5c4fc53178e9fe1fa30025e608bfd |
|
MD5 | a31a257d636ce1cdb2ce9e04a1e008f8 |
|
BLAKE2b-256 | 9fca88914d58e72161dc5cd297ab53f62ec1b0d314f1cae2375fea381c1192e2 |
Hashes for deptry-0.18.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7590966832f5222d2277612e07e67285d92123ad96cf7713cda579d420d63d1 |
|
MD5 | cf23cd26f38532f4dcb3d223536caa98 |
|
BLAKE2b-256 | 01111416a7d2efcc94904e9fc53cfe489b56b6f7c7a1639383c7b109d166d5a5 |
Hashes for deptry-0.18.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdf6da66e31ef8bdace3bb34a86c4f066b5c5296776dd61b76802c72b0b3f5f4 |
|
MD5 | 8e67ef40d1e3ddd79f521c33c62cb0ea |
|
BLAKE2b-256 | 44d3e78d5392c4459aec719bdbfb102217dbd009fa884d95a449ad0110c84777 |
Hashes for deptry-0.18.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7343bb4948ad625ac1b3109279665004e6790ce01c8dc6a8a2ef1e4424c29773 |
|
MD5 | 6ee67897e6524eac65b7c17745003885 |
|
BLAKE2b-256 | 7bab5392fbb17f564220296cfb237cfd8216023057a04a8fe9ad80ab12801418 |
Hashes for deptry-0.18.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e73d5c2676a1f49a954baa59c248b56bc940ab87d6070cb164f1394c24e07cf3 |
|
MD5 | 1a927fcb1c6b144bd1c779570e5b1791 |
|
BLAKE2b-256 | ff2bd679320ecc84f068acb3c6fccab176a8306e41923c0c069f6f4b2fdb37fc |
Hashes for deptry-0.18.0-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d1b561a4477ab130e1cb277b3d3aa25743b3005e1bb60076031ec3926b47541 |
|
MD5 | eb30a01c9644ba1f08be384da89d7787 |
|
BLAKE2b-256 | 63a92dd4287cd31378febd3f78ed5408027acbe8c7e2cbd9a8cdd9f194d7b1f2 |
Hashes for deptry-0.18.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee0a916d78ba8db092a9454d5bc20fccbadb6ed0e8fb81fc020ba7e0df3578ed |
|
MD5 | 3339f034b6539b5eb3f803f9268caab1 |
|
BLAKE2b-256 | b3c00ce50820d7c3844ead9edfc42a18c93f8b951f754fb15b100269d87e7f58 |
Hashes for deptry-0.18.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5764d6b484d488ce0f7085dc1767d99069b476383857aafd3bbc912128892dd |
|
MD5 | 6c014073acdec36d56f933546ca5f86a |
|
BLAKE2b-256 | 32ac39dc921e0fca1a986309a553e16584f5ce54db023587ee2fcd122efabcce |
Hashes for deptry-0.18.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1440d2fab960e224b542726e6fcb0d3065635cfa8233c14f6c578faa2766e02 |
|
MD5 | 641a410f426917088891661faee6ed72 |
|
BLAKE2b-256 | 4a255eb6c4685a06022a31449190038beabe58ad2190e2df30261999a555ea43 |
Hashes for deptry-0.18.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aac16b9825c67887f84795d3fe3c5a676376cd6cc8555f6f7b57bfd45603e421 |
|
MD5 | 697ee058199372b59ec1a353a071ad90 |
|
BLAKE2b-256 | e276ebb0d294dc2f74d7e22c263134073487b5c9f9bb8607fb5269769f6f9cdd |