# How to keep uv dependencies updated with Dependabot

Configure Dependabot to open pull requests that update your [uv](https://pydevtools.com/handbook/reference/uv.md) dependencies. This setup checks weekly and groups minor and patch updates into one pull request.

## Prerequisites

- A GitHub repository with `pyproject.toml` and a committed [`uv.lock`](https://pydevtools.com/handbook/how-to/how-to-use-a-uv-lockfile-for-reproducible-python-environments.md).
- Write access to the repository.
- CI checks that install from the lockfile and test pull requests before merge.
- Dependabot security updates enabled under **Settings → Advanced Security** if the repository should open pull requests for known vulnerabilities.

## Add the Dependabot configuration

Create `.github/dependabot.yml` with this complete configuration:

```yaml {filename=".github/dependabot.yml"}
version: 2
updates:
  - package-ecosystem: "uv"
    directory: "/"
    schedule:
      interval: "weekly"
    cooldown:
      default-days: 7
    versioning-strategy: "increase-if-necessary"
    groups:
      minor-and-patch:
        patterns:
          - "*"
        update-types:
          - "minor"
          - "patch"
```

`package-ecosystem: "uv"` tells Dependabot to update the project's manifest and lockfile. The `minor-and-patch` group combines routine upgrades into one pull request; major releases remain separate for review.

The seven-day `cooldown` makes scheduled version updates wait until a release is at least seven days old; security updates bypass it. If the project sets uv's `exclude-newer`, use the same delay in both places so Dependabot does not select a release that uv refuses to lock.

`increase-if-necessary` keeps an existing requirement unchanged when it already permits the selected release. If the requirement excludes that release, Dependabot widens it and updates the lockfile.

For example, `>=1.0,<2.0` already permits version 1.5, so that update can leave the requirement in `pyproject.toml` unchanged while updating `uv.lock`. Updating to version 2.0 requires changing the requirement too.

## Merge the configuration into the default branch

Commit the file through the project's normal pull-request process. Dependabot reads configuration from the default branch, then checks the root `pyproject.toml` and `uv.lock` on the weekly schedule.

After merge, open **Insights → Dependency graph → Dependabot**. Repository administrators can verify the setup without waiting for the weekly schedule: click **Recent update jobs**, then **Check for updates**. When the job finishes, open **view logs** and confirm that it completed without a configuration error.

If updates are available, expect one grouped pull request for eligible minor and patch releases plus separate pull requests for major releases. A successful check may open no pull request if dependencies are current or newer releases are still within the seven-day cooldown.

Review changes to both `pyproject.toml` and `uv.lock`, then merge only after the project's CI checks pass. The lockfile diff can include indirect dependencies that changed to satisfy the direct update.

## Change the versioning strategy only for a specific need

Keep `increase-if-necessary` when the project should accept updates outside its current ranges. Use `lockfile-only` only when `pyproject.toml` already permits every update that Dependabot should make; it cannot cross a real version ceiling.

A ceiling can therefore prevent a security fix under `lockfile-only`. [Keep capped dependencies from blocking Dependabot security updates](https://pydevtools.com/handbook/how-to/how-to-keep-a-capped-dependency-from-blocking-dependabot-security-updates.md) before choosing that strategy.
