To uv or not to uv
uv
is a blazing fast Python package manager that aims to displace pip
. It’s a really slick tool that lets you go from git clone
to executing code with all the dependencies seamlessly. All the standard accolades apply: written in Rust, beautiful terminal UI, well thought-out user ergonomics … all written by Astral, the same company that gave the Python community ruff
.
But what makes it so damn fast? Under the rusty hood, the magic is even more impressive. Charlie Marsh, the project lead, presented at Jane Street and revealed some of the inner workings. The whole talk is super interesting, but some standout highlights are:
uv
has it’s own SAT solver implementation to resolve dependency package versions much faster than e.g.pip
orconda
. (@16:09
)- Interesting tricks around implementing efficient representations of dependency metadata in Rust data structures to allow super-fast solves. The team effectively wrote their own package version number parser and represented them cleverly inside a single
u64
to enable fast dependency comparisons as scalar integer comparisons. (@25:47
) - Some very clever usage of HTTP Range Requests to heuristically slice into compressed PyPi
.zip
package archives to parse package metadata from package registries, without having to retrieve the entire.zip
from PyPi first. (@31:42
) - A very clever cache design to enable super fast ephemeral Python venv creation, with some Rust zero-copy serialisation magic. (
@34:49
,@37:27
)
So, to uv
or not to uv
? I’d definitely give uv
a try - it really makes Python feel like magic.