Skip to main content

uv-override-prune

pypi python

Detect prunable override-dependencies / constraint-dependencies entries in uv projects.

Install

uv tool install uv-override-prune

Or run it without installing — useful for one-off checks:

uvx uv-override-prune

Usage

# Detect prunable entries (default)
uv-override-prune                          # checks ./pyproject.toml
uv-override-prune path/to/pyproject.toml   # checks given file

# Remove prunable entries in place
uv-override-prune --fix

Example output:

=== override-dependencies (3 entries) ===
[KEEP]  aiohttp>=3.13.5    3.13.3
[PRUNE] httpx>=0.1.0       0.28.1
[SKIP]  foo==1.0           (non-lower-bound)

Run with --fix to prune entries marked [PRUNE].

Exit codes:

Code Meaning
0 No prunable entries (or --fix succeeded)
1 Prunable entries found (without --fix)
2 pyproject.toml not found or malformed, or an entry marked [ERROR] (the audit is incomplete, even when other entries were pruned)

Why

uv lets you pin a transitive dependency version via [tool.uv] override-dependencies and constraint-dependencies.

A common reason to reach for these is CVE mitigation: a vulnerability is disclosed in a transitive package, and you force the patched minimum version while direct deps catch up.

Once they do, the entry is no longer doing anything — but it's easy to forget which ones are still load-bearing. Stale overrides become a judgment cost at every audit or upgrade ("is this still needed, or just history?").

uv-override-prune answers that mechanically: it checks whether each entry's lower bound is already satisfied by what uv lock would resolve without the override.

How it works

For each candidate entry, the tool removes it in a temp copy of pyproject.toml, runs uv lock there, and checks whether the resulting natural resolution still satisfies the entry's specifier. If yes, the entry is [PRUNE].

Scope

  • Targets entries in [tool.uv] override-dependencies and constraint-dependencies.
  • Only specifiers using >= and/or > are checked. Entries using ==, ~=, <, <=, != (alone or mixed) are skipped.
  • Entries with an environment marker (e.g. foo>=1.0; python_version >= "3.10") are skipped, since the natural uv lock resolution doesn't reflect the marker's intent.
  • An entry that repeats an earlier entry in the same section (same package and specifier, ignoring spelling) is reported as [PRUNE] with (duplicate). The first copy is evaluated with every copy removed, so its verdict reflects the natural resolution and --fix leaves exactly one copy.

Known limitations

  • Projects with a [build-system] section may fail to lock in the temp dir if they depend on source files (e.g. setuptools.packages.find, Hatch dynamic version from source). [tool.uv.sources] path deps, workspace members, and [project] readme are rewritten automatically; other build-backend-specific references are not.
  • One-at-a-time evaluation: if overrides interact (e.g. cascade redundancy, shared transitive deps), individual runs may miss some prunable entries. Re-run after applying removals to surface the next layer.

License

MIT

Metadata

Release files for uv-override-prune 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uv-override-prune 0.0.14
File Size Uploaded
uv_override_prune-0.0.14.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uv-override-prune 0.0.14
File Interpreter ABI Platform
uv_override_prune-0.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 31.7 kB

Release files / uv_override_prune-0.0.14.tar.gz

Download URL uv_override_prune-0.0.14.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7779152d239a09fb2005e6c5fcc708ea0e1e9066b1e6c7fecc7cd84c5965cc63
BLAKE2b-256 checksum
How to use checksums
1c353b968a4bba75303ff67df296a0b694cf7280921f6105267bbf3316f73602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / uv_override_prune-0.0.14-py3-none-any.whl

Download URL uv_override_prune-0.0.14-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1283ba42d88bc075befa5a126169d3f214a7ac1f4c69f42c33701e61f595e0b
BLAKE2b-256 checksum
How to use checksums
556ee7aad0470b8d3077b2ddf982b5305ff393330ff348cb8fbbe7f5627b8c08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

1.0.0

2 release files

0.0.15

2 release files

This release

0.0.14 This release

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page