uv: one fast tool for Python packages, virtual environments and versions
uv replaces pip, virtualenv, pip-tools and pyenv-style version management with a single fast binary. Here is how the everyday workflow looks and when it is worth switching.
Author's connection to this tool: No connection. An independent overview written by the RecallRun editors.
Setting up a Python project used to mean juggling several tools: one to install Python versions, one to create a virtual environment, pip to install packages, and something else to lock versions. uv, from Astral (the team behind Ruff), does all of that in one binary written in Rust, and it is fast enough that installs which took a minute often finish in seconds.
Install
pipx install uv # or: pip install uv
uv --version
The project also publishes standalone installers and packages for Homebrew, WinGet and others; see the official documentation.
The project workflow
uv manages projects through the standard pyproject.toml plus a lock file.
uv init my-service # creates pyproject.toml and a starter module
cd my-service
uv add fastapi "httpx>=0.27" # adds dependencies and updates uv.lock
uv add --dev pytest ruff # development-only dependencies
uv run pytest # runs inside the project's environment
A few things happen without you asking:
- A virtual environment (
.venv) is created and kept in sync with the lock file. uv.lockrecords exact versions for every platform, so teammates and CI get the same dependency tree.uv runmakes sure the environment matches the lock file before running your command, so "works on my machine" problems from stale environments mostly disappear.
On a fresh checkout, one command reproduces the environment:
uv sync
Managing Python versions
uv can download and manage Python itself:
uv python install 3.12
uv python pin 3.12 # writes .python-version for the project
This removes the need for a separate version manager on most machines and in CI.
Drop-in pip commands
If you're not ready to change your project layout, uv offers a pip-compatible interface that is simply faster:
uv venv
uv pip install -r requirements.txt
uv pip compile requirements.in -o requirements.txt # like pip-tools
This is an easy way to try uv in an existing project without touching anything else.
Running tools without installing them
uvx runs a command-line tool in a temporary, cached environment:
uvx ruff check .
uvx httpie https://example.com
It's handy for one-off tools you don't want in your project's dependencies.
In CI
A typical GitHub Actions job becomes shorter and faster:
- uses: astral-sh/setup-uv@v5
- run: uv sync --locked
- run: uv run pytest -q
--locked fails the build if uv.lock is out of date with pyproject.toml, which catches "forgot to commit the lock file" mistakes.
When to switch, and when not to
Good reasons to adopt uv:
- Slow dependency installs in CI or Docker builds.
- A team that keeps hitting environment drift.
- Several projects needing different Python versions.
Things to check first:
- If your organisation relies on Conda for non-Python dependencies (CUDA, GDAL and similar), uv doesn't replace that.
- Very old tooling that expects
setup.py-only projects may need updating topyproject.toml. - Pin a uv version in CI so a tool upgrade doesn't change behaviour unexpectedly.
Verdict
For new Python projects, uv is an easy recommendation: one tool, standard pyproject.toml, reproducible locks and very fast installs. For existing projects, start with uv pip install in CI, enjoy the speed-up, and move to the full project workflow when it suits you.
Written by RecallRun Editors for the RecallRun community. Community posts are checked for safety and reviewed by our editors before publishing, but the views and claims are the author's own. Links are the author's; open them with care. Report this post.
More from the community
- Tools
Ruff: replacing Flake8, isort and Black with one fast linter and formatter
How to set up Ruff as both linter and formatter, which rule sets are worth enabling, and how to roll it out on an existing codebase without a giant noisy diff.
- Tools
Pydantic v2: validate data at the edges of your Python application
Pydantic turns type hints into fast runtime validation and serialisation. Here are the core patterns for API payloads, settings and LLM outputs, plus the v2 changes that trip people up.
- Tools
DuckDB: fast SQL analytics on Parquet, CSV and DataFrames without a server
DuckDB is an in-process analytical database: no server, just a library. Here is how to query files and DataFrames directly, and where it fits next to pandas, Postgres and Spark.
Share a tech article or a tool you built. Every post is checked and reviewed before it goes live.