Swapping pip for uv halved my CI time
I added uv to a side project's GitHub Actions workflow for a packaging smoke test. Since it was there anyway, I swapped the dev install from pip to uv as well. It was a one-line change:
- run: pip install -e ".[dev]"
+ run: uv pip install --system -e ".[dev]"
The whole CI job dropped from 23 seconds to 11. The install step went from about 10 seconds to 1.2.
I wanted to know why, so I compared the install logs from the two runs:
| Phase | pip (≈10s) | uv (≈1.2s) |
|---|---|---|
| Set up an isolated build environment for the package | ~2s | Part of the ~1s "prepare" phase |
| Resolve dependencies | ~3s, fetching metadata for each package one after another | 0.19s |
| Download and build 25 packages | Downloads run one at a time | 1.0s, downloads run in parallel |
| Install | ~4s, unpacking and copying files | 0.017s, mostly links files from its cache |
My first guess was caching, but it wasn't that. By default, the setup-uv action doesn't cache downloaded packages, so all 25 were downloaded fresh. The difference comes down to three things:
- Parallel downloads and metadata fetching. pip handles packages one at a time. uv fetches them all at once, and it often reads just the metadata it needs instead of downloading whole packages.
- Native code. uv is written in Rust, so resolving dependencies is near-instant compared with pip's Python resolver.
- Linking instead of copying. uv unpacks each package once into its cache and links the files into the environment, which is why installing 25 packages took 17ms.
For a one-line change, halving CI time is a good return. I'll be reaching for uv by default from now on.