Metadata-Version: 2.3
Name: deptry-auto
Version: 0.1.0
Summary: Automatically add missing dependencies found by deptry using uv.
Author: Matthew Muller
Author-email: Matthew Muller <matthew.muller@epiroc.com>
Requires-Dist: deptry>=0.24.0
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# deptry-auto

Scan a Python project with [deptry](https://deptry.com/) 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):

```bash
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:

```bash
# 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
```

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.
3. Each missing package is added to the target project with `uv add <package>`.

`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

```bash
uv sync            # install dependencies
uv run deptry-auto --dry-run .
```

Run the CLI against a throwaway project if you want to observe `uv add` in action.
