Skip to main content

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-auto expects uv to be available on your PATH.

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:

  1. deptry runs with JSON output enabled (using python -m deptry --json-output ...).
  2. Any issues with code DEP001 (missing dependency) are collected, and packages that already live inside the project tree are ignored.
  3. 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 PIL resolves to Pillow, cv2 to opencv-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 add command 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-auto now 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deptry_auto-0.2.10.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deptry_auto-0.2.10-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file deptry_auto-0.2.10.tar.gz.

File metadata

  • Download URL: deptry_auto-0.2.10.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for deptry_auto-0.2.10.tar.gz
Algorithm Hash digest
SHA256 6138f6257a2e7a9c77310874f0d552ab5a263b0fe17db74b9ed8dbb7c36b3580
MD5 bd5287a98950f53a346cf0afa8ccb4ff
BLAKE2b-256 c98403471684a98f1b3df66fa4fc3f000ca8fab59b36607c1954dd24219b5576

See more details on using hashes here.

Provenance

The following attestation bundles were made for deptry_auto-0.2.10.tar.gz:

Publisher: python-publish.yml on mwmuni/deptry-auto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deptry_auto-0.2.10-py3-none-any.whl.

File metadata

  • Download URL: deptry_auto-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for deptry_auto-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 aac6426a662f2b3113802e4915c2f6a5c7ab57a81d1bbc7c1e50b65c1c79679c
MD5 e066ce6a9cfc720b1136dbd99c9eeb10
BLAKE2b-256 de1a013ec7b4ee675590e2a2c4c22ea2788de20dd01666dcf98933a94d1d3950

See more details on using hashes here.

Provenance

The following attestation bundles were made for deptry_auto-0.2.10-py3-none-any.whl:

Publisher: python-publish.yml on mwmuni/deptry-auto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page