• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 23805124382

31 Mar 2026 03:19PM UTC coverage: 92.903% (-0.02%) from 92.918%
23805124382

push

github

web-flow
An experimental uv-based PEX builder (#23197)

Add an experimental `[python].pex_builder` option that allows using
[uv](https://github.com/astral-sh/uv) to install dependencies when
building PEX files via `pants package`.

When set to `"uv"`, Pants:
1. Downloads the `uv` binary (as an `ExternalTool`).
2. Creates a virtual environment with `uv venv`.
3. Installs dependencies with `uv pip install`.
4. Passes the pre-populated venv to PEX via `--venv-repository`.

When a PEX-native lockfile is available, uv installs the exact pinned
versions with `--no-deps`, preserving reproducibility. Otherwise it
falls back to transitive resolution from requirement strings.

Builds that cannot use uv (internal-only, cross-platform, no local
interpreter) silently fall back to the default pip path.

## Benchmark

Raw `pip install` vs `uv pip install` for 11 packages (requests, boto3,
cryptography, aiohttp, sqlalchemy, pillow, etc.) measured with
[hyperfine](https://github.com/sharkdp/hyperfine):

| Condition | pip | uv | Speedup |
|-----------|-----|-----|---------|
| Cold cache | 6.3s | 4.1s | **1.6x faster** |
| Warm cache | 6.9s | 0.14s | **51x faster** |

Within Pants, the end-to-end improvement is smaller because scheduler
and bootstrap overhead dominates, but the dependency installation step
itself is significantly faster — especially with warm caches on
repeated builds.

## LLM Disclosure

Code was written by the author. Claude was used for code review,
catching edge cases, and verifying test coverage.

122 of 138 new or added lines in 5 files covered. (88.41%)

9 existing lines in 1 file now uncovered.

91642 of 98643 relevant lines covered (92.9%)

4.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.93
/src/python/pants/backend/python/util_rules/pex.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc