Automatically add missing dependencies found by deptry using uv.
Project description
deptry-auto
Scan a Python project with deptry and automatically add any missing runtime dependencies with uv add.
Installation
Install the package into the project you would like to manage (or into a dedicated tools environment):
uv add deptry-auto
ℹ️
deptry-autoexpectsuvto be available on yourPATH.
Usage
Run the CLI from the directory that contains the pyproject.toml, or pass the target path explicitly:
# Scan the current project and apply fixes
deptry-auto
# Scan another project from anywhere
deptry-auto path/to/other-project
# Preview the changes without modifying the project
deptry-auto --dry-run
# Wait up to 2 minutes per dependency install
deptry-auto --install-timeout 120
What happens:
deptryruns with JSON output enabled (usingpython -m deptry --json-output ...).- Any issues with code
DEP001(missing dependency) are collected, and packages that already live inside the project tree are ignored. - Each remaining missing package is added to the target project with
uv add <package>.
Special cases
- The installer automatically queries the PyPI XML-RPC API for likely package matches when an import name is missing (so
PILresolves toPillow,cv2toopencv-python, and similar cases work without manual overrides). - Imports that only exist on MicroPython builds (
machine,micropython,rp2,ucollections,ujson,uselect,ustruct,utime,neopixel) are skipped automatically. - Every
uv addcommand is capped by--install-timeout(default 300s). When the timeout is reached, deptry-auto stops that attempt, switches to the next candidate name, and ultimately reports the packages that still need manual attention. - If one installation fails,
deptry-autonow continues with the remaining packages, tries fallback names where applicable, and reports any failures at the end.
deptry exits with code 1 when it finds issues, so deptry-auto tolerates both 0 (clean) and 1 (issues) but still halts for any other failure. Use --dry-run when you only need a report of the missing dependencies.
Development
uv sync --group dev # install dependencies
uv run pre-commit install # install pre-commit hooks
uv run deptry-auto --dry-run .
The local pre-commit hook automatically bumps the patch version whenever a file under src/ is staged. The first
commit attempt will therefore fail after the hook updates pyproject.toml; stage the modified file and re-run git commit.
Run the CLI against a throwaway project if you want to observe uv add in action.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deptry_auto-0.2.11.tar.gz.
File metadata
- Download URL: deptry_auto-0.2.11.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
523cd77b4e314a826d23f9e00f00998b18b19c4cc3210e9c1f0ab98acab85f6c
|
|
| MD5 |
b6a7cec3f9eb4f4c803c3babbe4ed1b4
|
|
| BLAKE2b-256 |
b35652989a05de080ce94ed1a6a94020981ec90ac235fd373522ccabc0dc0b98
|
Provenance
The following attestation bundles were made for deptry_auto-0.2.11.tar.gz:
Publisher:
python-publish.yml on mwmuni/deptry-auto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deptry_auto-0.2.11.tar.gz -
Subject digest:
523cd77b4e314a826d23f9e00f00998b18b19c4cc3210e9c1f0ab98acab85f6c - Sigstore transparency entry: 708309038
- Sigstore integration time:
-
Permalink:
mwmuni/deptry-auto@7e61b41dcfe61aefa63bb40442fb3a2fc2919702 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mwmuni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7e61b41dcfe61aefa63bb40442fb3a2fc2919702 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deptry_auto-0.2.11-py3-none-any.whl.
File metadata
- Download URL: deptry_auto-0.2.11-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24fa931704e9966f02394634c06f087074525e10922329824276b9cbc353b76d
|
|
| MD5 |
75d52cc705ae085fc71ce1ef5de8b7cf
|
|
| BLAKE2b-256 |
99ff2829d338ddb860ecf9217da74d16148e4a6a04990353e9c88962d2397fb9
|
Provenance
The following attestation bundles were made for deptry_auto-0.2.11-py3-none-any.whl:
Publisher:
python-publish.yml on mwmuni/deptry-auto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deptry_auto-0.2.11-py3-none-any.whl -
Subject digest:
24fa931704e9966f02394634c06f087074525e10922329824276b9cbc353b76d - Sigstore transparency entry: 708309041
- Sigstore integration time:
-
Permalink:
mwmuni/deptry-auto@7e61b41dcfe61aefa63bb40442fb3a2fc2919702 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mwmuni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7e61b41dcfe61aefa63bb40442fb3a2fc2919702 -
Trigger Event:
push
-
Statement type: