Documentation: https://docs.astral.sh/uv/ Repository: https://github.com/astral-sh/uv
uv
uv is an advanced Python package and project manager developed in Rust by Astral, designed as a modern, high-performance alternative to pip. While pip’s primary focus is installing packages, uv unifies package management, virtual environment handling, Python version control, lockfile maintenance, and project workspace support into a single, cohesive tool. Unlike pip, uv delivers 10 to 100 times faster dependency resolution and installation, leverages a universal lockfile for guaranteed reproducibility, and offers advanced workspace features, making it especially well-suited for monorepos or complex projects. Its familiar CLI assures a smooth migration for pip users, while significantly improving performance, scalability, and developer experience.
For comparison, with pip, setting up a typical project often requires several steps and auxiliary tools:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtUpdating and locking dependencies reproducibly generally means introducing additional tools like pip-tools or poetry:
pip-compile requirements.in
pip install -r requirements.txtWith uv, these formerly fragmented steps are streamlined:
uv init myproject
cd myproject
uv add flask
uv venv
uv lock
uv syncuv coordinates dependencies, lockfiles, and virtual environments automatically, minimizing “works on my machine” problems and providing true reproducibility across platforms. Running scripts in an up-to-date, consistent environment is straightforward:
uv run main.pyuv also supports advanced workflows, such as managing multiple Python versions and orchestrating monorepos, far beyond pip’s native capabilities:
uv python install 3.12.0
uv workspace add ./subprojectOverall, uv stands out for its efficiency, comprehensive feature set, and reliability, representing a substantial advance over traditional pip-driven workflows.
Usage with Acc-Py
uv needs to be configured to install packages from Acc-PyPI by setting the following in ~/.config/uv/uv.toml
index-url = "https://acc-py-repo.cern.ch/repository/vr-py-releases/simple"
allow-insecure-host = ["acc-py-repo.cern.ch"]