Skip to main content

uv-prune

Clean uv cache by removing non-hardlinked archive entries.

Problem

uv uses hard links to deduplicate package data across different Python versions and projects. When a package is no longer used by any project, its archive entry remains on disk but is no longer referenced by any other hard link.

uv-prune scans the archive-v0 directory in uv's cache and removes entries whose files have a link count of 1 — meaning they are no longer shared and can be safely deleted.

How it works

For each entry in archive-v0, uv-prune:

  1. Looks for a .dist-info subdirectory to identify the package name and version (e.g. anyio-4.0.0 from anyio-4.0.0.dist-info).
  2. Checks the link count of the METADATA file inside that directory — uv hard-links this file across all environments that share the package.
  3. If the link count is 1, the archive entry is no longer shared and is removed. If it is > 1, the entry is still in use and is kept.
  4. Entries without a .dist-info directory are only warned about by default; pass --include-no-dist-info to remove them too.

All entries are processed in parallel (via Rayon) and reported as a table sorted by package name and version.

Installation

From PyPI (pre-built binary)

Every tagged release publishes platform wheels to PyPI (the compiled binary ships inside a thin Python launcher package, so the bin directory gets a small launcher instead of a full copy of the executable), so install with any Python package manager:

uv tool install uv-prune   # recommended — managed by uv
pipx install uv-prune
pip install uv-prune       # then run `uv-prune`

From GitHub Releases

Pre-built binaries for Linux (x86_64 / aarch64, static musl), macOS (arm64 / x86_64) and Windows (x86_64 / arm64) are attached to each release as .tar.gz / .zip archives together with a SHA256SUMS checksum file.

From source

cargo install uv-prune

Or build manually:

git clone https://github.com/QiE2035/uv-prune
cd uv-prune
cargo build --release

Releases

Pushing a v* tag triggers the publish workflow, which:

  1. Builds release binaries for Linux (musl), macOS and Windows (see the platform table in the workflow).
  2. Creates (or updates) a GitHub Release with the archives and SHA256SUMS.
  3. Builds py3-none-{platform} wheels from those binaries and publishes them to PyPI — via trusted publishing (recommended), or the PYPI_API_TOKEN repository secret as fallback.
git tag v0.1.2
git push origin v0.1.2

The workflow can also be run manually via workflow_dispatch to smoke-test the build matrix without publishing.

--version reports build provenance: local development builds get +dev.<short-sha> (e.g. uv-prune 0.1.0+dev.a1b2c3d4), CI builds of main get +ci.<run-number>.<commit-sha-prefix> (e.g. uv-prune 0.1.0+ci.42.a1b2c3d4), and tagged releases stay clean (uv-prune 0.1.0).

Usage

# Prune with default cache path
uv-prune

# Dry-run — see what would be deleted without actually deleting
uv-prune --dry-run

# Verbose output
uv-prune --verbose

# Custom cache directory
uv-prune --cache-dir /path/to/uv/cache

# Also remove entries without .dist-info (default: warn only)
uv-prune --include-no-dist-info

# Disable timing measurement
uv-prune --no-timing

# Set number of parallel workers
uv-prune --jobs 4

Options

Option Short Description
--cache-dir <DIR> -c UV cache directory (overrides UV_CACHE_DIR env var)
--dry-run -d Show what would be deleted without actually deleting
--verbose -v Enable verbose (debug) output
--include-no-dist-info -i Also remove entries without a .dist-info directory
--jobs <N> -j Number of parallel workers (0 = auto-detect, default)
--no-timing -n Disable timing measurement

Exit Codes

Code Meaning
0 Success (even if entries were skipped/warned)
1 One or more errors occurred while pruning

Environment Variables

Variable Description
UV_CACHE_DIR Override the uv cache directory path
RUST_LOG Control log level (e.g., debug, info, warn, error)

Cache Directory Resolution

  1. --cache-dir CLI argument
  2. UV_CACHE_DIR environment variable
  3. Platform default:
    • Windows: %LOCALAPPDATA%\uv\cache
    • Linux / macOS: ~/.cache/uv (or $XDG_CACHE_HOME/uv)

Output Example

$ uv-prune --dry-run --verbose
[INFO  uv_prune] uv-prune v0.1.0 — cache: /home/user/.cache/uv
[INFO  uv_prune::prune] Pruning archive directory: /home/user/.cache/uv/archive-v0
[INFO  uv_prune::prune] Dry-run mode — no files will be deleted
[INFO  uv_prune::prune] [DRY-RUN] Action    ID                     Version   Name       Detail
[INFO  uv_prune::prune] [DRY-RUN] --------  ---------------------  --------  ---------  -----------------------------------------
[INFO  uv_prune::prune] [DRY-RUN] Deleting  abc123def456789abc     4.0.0     anyio
[DEBUG uv_prune::prune] [DRY-RUN] Keeping   ghi012jkl345mnopqr     2.31.0    requests
[WARN  uv_prune::prune] [DRY-RUN] Skipping  deadbeef               -         -          no .dist-info (use --include-no-dist-info to remove)
[INFO  uv_prune::prune] Done: 3 checked, 1 removed, 2 skipped, 1 no-dist-info, 0 errors
[INFO  uv_prune] Elapsed time: 15.2ms

The report is a table with the following columns:

  • Action — Deleting, Keeping, Skipping or Failed.
  • ID — the uv cache archive directory name; - when it could not be read.
  • Version / Name — parsed from the .dist-info directory name; - when there is no .dist-info.
  • Detail — the reason for Skipping / Failed entries, if any.

In dry-run mode every table line is prefixed with [DRY-RUN] and nothing is actually deleted. Keeping rows are logged at debug level, so pass --verbose to see them, and column widths adapt to the longest entry.

Platform Support

Platform Hard link detection
Windows GetFileInformationByHandle → nNumberOfLinks
Linux stat → st_nlink via std::os::unix::fs::MetadataExt
macOS stat → st_nlink via std::os::unix::fs::MetadataExt

Release files for uv-prune 0.1.2

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

Built distributions (wheels)

Table of built distributions (wheels) for uv-prune 0.1.2
File
uv_prune-0.1.2-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
uv_prune-0.1.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
uv_prune-0.1.2-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
uv_prune-0.1.2-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
uv_prune-0.1.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
uv_prune-0.1.2-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 4.2 MB

Release files / uv_prune-0.1.2-py3-none-win_arm64.whl

Download URL uv_prune-0.1.2-py3-none-win_arm64.whl
Size 603.1 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
0e346236a0ad33d1dd162ba6a91b159e1358980ae88d155b117201dd64738c52
BLAKE2b-256 checksum
How to use checksums
7297005d167b1d1c327a0069e5b7d1394c95ad6ca07d3043aa6ed5421b26aa50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / uv_prune-0.1.2-py3-none-win_amd64.whl

Download URL uv_prune-0.1.2-py3-none-win_amd64.whl
Size 659.2 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
c64e2b3dea459662254df7bb559a633a6895291699bec3d834eac1d4899d7fb0
BLAKE2b-256 checksum
How to use checksums
0b65b5aff7858a0ae43fc7e9d4f5761b3e07eb7cc137f72cba056b1c8de01289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / uv_prune-0.1.2-py3-none-musllinux_1_2_x86_64.whl

Download URL uv_prune-0.1.2-py3-none-musllinux_1_2_x86_64.whl
Size 819.3 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5b22e406e18673ba34493b13978b3e580e5313a1a9b91cf6ecbee5845fbe37d8
BLAKE2b-256 checksum
How to use checksums
0ea5c4546ebd87ef5b854d7ae3e7ce6c93c11c6c00d10169f4061da74369b595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / uv_prune-0.1.2-py3-none-musllinux_1_2_aarch64.whl

Download URL uv_prune-0.1.2-py3-none-musllinux_1_2_aarch64.whl
Size 740.3 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f9bebecd8e32205852172e0f03d2a74b075fb3aa718f47b0acdafe0601d1ea54
BLAKE2b-256 checksum
How to use checksums
43c40f8d75b6b10e54aefbc4bd30ddf4e9abf795fdb7f84aac608499eae2d1fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / uv_prune-0.1.2-py3-none-macosx_11_0_arm64.whl

Download URL uv_prune-0.1.2-py3-none-macosx_11_0_arm64.whl
Size 637.0 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
af76233a63e93cdbb680bad5e74fdf132567cb7d6d1d02aafb249d6f3f2fd74a
BLAKE2b-256 checksum
How to use checksums
f199baa7c6da470ea0459aeabee7275f05c87e2e282483382ac8b9b7413209f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / uv_prune-0.1.2-py3-none-macosx_10_12_x86_64.whl

Download URL uv_prune-0.1.2-py3-none-macosx_10_12_x86_64.whl
Size 720.7 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3faba83624ecf684f58d7f7fd2248fa7c7f9971218d2e501054ae3fefc8fa740
BLAKE2b-256 checksum
How to use checksums
0e95c65f51f083b857fe31f57abc3fad7672b6e21bb254c573572734451bfd51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

6 release files

0.1.1

6 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