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.
pip install deptryNo compatibility data collected yet for this library.
Run Deptry on the current directory to check for dependency issues. This will scan source files and project configuration to identify unused, missing, or transitive dependencies. Configure via `pyproject.toml` for more specific checks.
Verify your `pip install` command (it should be `pip install deptry`) and documentation sources. The current official `deptry` is maintained by Astral.
Remove the `--requirements-txt` flag from your commands. Deptry will automatically detect common dependency files. For explicit control, configure `dependency_file_paths` in `[tool.deptry]` within your `pyproject.toml`.
Configure `ignore_unused`, `ignore_missing`, `ignore_transitive`, and `exclude` paths in your `pyproject.toml` under `[tool.deptry]` to fine-tune the analysis for your project's specific needs. Use comments to explain ignores for future maintainers.
Ensure your project's Python environment and the environment where Deptry is installed is 3.10 or higher. Upgrade Python if necessary.
Activate your project's virtual environment, then install deptry using `pip install deptry`, `poetry add --group dev deptry`, or `uv add --dev deptry`.
Add the corresponding package as a direct dependency to your `pyproject.toml` or `requirements.txt`. If it's a first-party module, configure `deptry` to recognize it using `known_first_party` in your `pyproject.toml` (e.g., `[tool.deptry] known_first_party = ['your_local_module']`).
If the dependency is genuinely unused, remove it from your project's dependencies. If it is used in a way deptry doesn't detect (e.g., dynamic imports, CLI tools), you can ignore the specific rule for that package (`deptry --per-rule-ignores DEP002=some_package`) or exclude relevant files/directories (`deptry --exclude 'path/to/files/*'`). Ensure development dependencies are correctly categorized.
Add the `some_transitive_module`'s corresponding package as a direct dependency to your `pyproject.toml` or `requirements.txt` to explicitly declare its usage. Alternatively, you can ignore this specific violation using `--ignore DEP003` or `--per-rule-ignores DEP003=some_transitive_package` if you understand and accept the implications.
No dependency data recorded yet.