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
# Auto-detect build environment and set up if needed, then scan and install
deptry-auto --auto-bootstrap
# Prefer a specific build system (msvc, cmake, ninja, meson)
deptry-auto --build-pref ninja
# Prefer specific build system with auto-bootstrap
deptry-auto --build-pref cmake --auto-bootstrap --install-timeout 600
Building Packages from Source
Some packages (like scikit-image, opencv-python) may need to be compiled on Windows if pre-built wheels aren't available for your Python version (especially Python 3.14).
The easiest way to handle this is with the --auto-bootstrap flag:
# Auto-detect build environment and set up if needed, then scan and install
deptry-auto --auto-bootstrap --install-timeout 600
For more details on manual setup, see the Bootstrap Guide below.
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>. - If batch installation fails, the tool falls back to installing packages individually.
- Platform constraints and build environment issues are detected and reported.
Special cases
- 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.
Bootstrap Guide
When packages like scikit-image or opencv-python don't have pre-built wheels for your platform or Python version, they need to be compiled from source. This requires build tools.
Automatic Build Environment Detection
deptry-auto can automatically detect your build environment and set it up:
# Auto-detect build environment and install missing tools, then scan and install dependencies
deptry-auto --auto-bootstrap
# Or with longer timeout for compilation
deptry-auto --auto-bootstrap --install-timeout 600
This will:
- Check for MSVC, CMake, Ninja, Meson, and NumPy
- Automatically install pip-based tools (CMake, Ninja, Meson, NumPy) if missing
- Detect Visual Studio installations and provide activation instructions
- Proceed to scan and install missing dependencies
Build System Preferences
By default, deptry-auto will use the first available build system it finds. You can specify a preference:
# Prefer Ninja as the build system
deptry-auto --build-pref ninja
# Prefer CMake with auto-bootstrap
deptry-auto --build-pref cmake --auto-bootstrap
# Strategy: tries local tools first, falls back to alternatives if preferred unavailable
deptry-auto --build-pref msvc # Will use MSVC if available, otherwise tries other tools
Available build systems: msvc, cmake, ninja, meson
The resolution strategy:
- Find available local tools on your system
- If preferred is specified, use it if available
- Otherwise use first available tool (fails gracefully if none available)
- With
--auto-bootstrap, missing tools are installed automatically
If auto-bootstrap doesn't work or you prefer manual control:
This installs:
- CMake - Build system generator
- Ninja - Fast C++ build system
- Meson - Modern build system (used by scikit-image, etc.)
- NumPy - Dependency for scientific packages
What You Still Need Manually
Microsoft Visual C++ Compiler (MSVC) - Cannot be installed via pip, requires:
-
Download Visual Studio Community Edition (free)
-
Run installer and select "Desktop development with C++"
-
After installation, activate MSVC in your terminal:
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
Alternative: Use Older Python
If you're on Python 3.14, consider using Python 3.13 or 3.12 which have more pre-built wheels:
# Check what's available for your Python version
uv run python tests/test_imports.py
Alternative: Use Conda
Conda has pre-built wheels for scientific packages:
conda install scikit-image opencv-python easyocr
Testing
Verify your setup works:
# Test imports and build environment
uv run python tests/test_imports.py
This checks:
- Python version and platform
- Available build tools (MSVC, CMake, Ninja)
- Installed packages
- Specifically tests scikit-image
See tests/README.md for more details.
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.
Metadata
Release files for deptry-auto 0.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deptry_auto-0.3.9.tar.gz | 17.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deptry_auto-0.3.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.5 kB
Release files / deptry_auto-0.3.9.tar.gz
| Download URL | deptry_auto-0.3.9.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f329ee558b1e77596988311b5df6fb1c82e2ce58884519c4d0902b99150ff82
|
|
BLAKE2b-256 checksum How to use checksums |
3d5ac01c51b9944db94f33b84d113c1019366da4236893305779ac591b3aa19a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.
Transparency logRelease files / deptry_auto-0.3.9-py3-none-any.whl
| Download URL | deptry_auto-0.3.9-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44166598e283a1966ebb29d940bd832f538af5438f9bf8d8cd22cb78de0c0165
|
|
BLAKE2b-256 checksum How to use checksums |
5d75a5de264f5e824b97cbd8f6689a1c6472e420acf7ab63c02becae6906907d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.
Transparency log