uv Python: Replace Your Entire Toolchain With One Binary

uv replaces pip, pyenv, virtualenv, pip-tools, and pipx with one Rust binary. Complete guide to installation, commands, Docker integration, and migration paths.

Updated 11 min read
uv Python package manager

uv is a Python package and project manager built in Rust that replaces pip, pyenv, virtualenv, pip-tools, and pipx with a single binary. As of June 2026, it drives 162 million monthly PyPI downloads and handles more than 10% of all PyPI request traffic.

The speed headline (10-100x faster than pip) is real, but secondary. The primary value is collapsing a five-tool chain into one command surface that requires no Python to install.

Before uv, a typical Python developer managed pyenv for interpreter versions, virtualenv for environment isolation, pip-tools for dependency locking, pip for installation, and pipx for running CLI tools globally. uv handles all five.

This guide covers installation, the core command surface, the two-interface distinction most tutorials skip, Docker integration, PEP 723 inline scripts, and the OpenAI acquisition context relevant to long-term adoption decisions.

Key Takeaways

  • uv installs in one command on macOS, Linux, and Windows with no Python prerequisite required
  • uv add is the modern workflow; uv pip install is the migration ramp, and they serve different purposes
  • Virtual environment creation takes 0.008 seconds with uv; uv run makes manual activation unnecessary
  • The uv.lock cross-platform lockfile replaces both requirements.txt and pip-tools workflows
  • uv is MIT-licensed and uses standard PEP 621 format; OpenAI acquired Astral on March 19, 2026

What Is uv?

Astral, the developer tooling company behind the Ruff linter, built uv. Charlie Marsh, Astral's founder, announced it in February 2024. By June 2026, uv reached 86,725 GitHub stars and version 0.11.24, shipping on a roughly weekly release cadence.

The scope is wider than most introductions cover. u/TheCaptain53 in r/Python (August 2025) describes it:

"It's not just pip but faster, or just venv but faster, but it's the ability to take the functionality of many different applications and bung it into one. Need to run a different version of Python? uv can do that, don't need Pyenv. Need to run a virtual environment? uv can do that, no need to manually create a venv. Need to install packages? uv can do that and faster than pip."

Charlie Marsh's stated ambition is a Python equivalent of Cargo, Rust's package manager. In August 2024, he announced: "A single, unified tool. Like Cargo, for Python." (Charlie Marsh (@charliermarsh), 3,338 likes.)

Why uv Matters in 2026

Python toolchain fragmentation has been the ecosystem's most persistent friction point for a decade. Managing pyenv, virtualenv, pip, pip-tools, and pipx separately means five configuration systems, five CLIs to keep updated, and zero shared state between them.

uv collapses that stack. The official benchmarks on Apple Silicon show the order-of-magnitude difference: 0.008 seconds for uv versus 1.15 seconds for python -m venv. Cold-installing 23 packages takes 1.187 seconds with uv versus 8.889 seconds with pip.

When creation is that fast, the developer relationship to virtual environments changes. In his Jane Street talk, Marsh explains:

"destroying and creating a virtual environment is extremely fast... we try to view them as totally ephemeral."

Jobs previously run only in CI become viable as pre-commit hooks.

uv speed benchmark comparison — astral.sh/uv

How to Install uv

The recommended installation uses the standalone installer, which requires no Python or Rust prerequisite:

Shell
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Three alternatives also work: brew install uv on Homebrew, pip install uv, or pipx install uv. The binary installs to ~/.local/bin by default.

Verify with uv --version. Stay current with uv self update; uv ships approximately weekly and the dependency resolver improves with each release.

How uv Works: The Five-Layer Command Surface

uv's commands organize into five functional layers, each replacing a specific part of the traditional Python stack.

Layer 1: Project Lifecycle (The Modern Workflow)

This is the destination, not the migration ramp. These commands manage a full project with automatic environment and lockfile maintenance:

Shell
uv init myproject              # scaffold pyproject.toml, .python-version, README, starter script
uv add requests                # install + update pyproject.toml + uv.lock + .venv
uv add --dev pytest ruff       # add development dependencies
uv remove requests             # remove + clean up all three files atomically
uv sync                        # install from lockfile (first-clone onboarding)
uv run script.py               # run in project environment, no activation needed

The key property is atomicity. A single uv add updates pyproject.toml, uv.lock, and .venv in one operation. There is no separate pip freeze > requirements.txt step and no manual venv activation.

Layer 2: pip-Compatible Interface (The Migration Ramp)

These commands behave like pip but run through uv's faster resolver and global cache:

Shell
uv pip install requests              # install without touching pyproject.toml
uv pip install -r requirements.txt   # bulk install from requirements file
uv pip compile requirements.in -o requirements.txt  # pip-compile replacement, ~20x faster

The key distinction: uv pip install does NOT update pyproject.toml or uv.lock. u/xenomachina in r/learnpython (April 2026) captures what changes when you move beyond this layer:

"Even if uv wasn't faster than pip, the thing I love about it is that it makes dealing with venvs so much nicer. You can almost forget they even exist. Just use uv to run your code, and it'll create a venv if one doesn't already exist, make sure it's up to date, and then run your code in that venv."

This layer is the ramp for adoption. Layer 1 is the destination.

Layer 3: Python Version Management (Replaces pyenv)

Shell
uv python install 3.12   # download prebuilt binary, no source compilation
uv python list           # list installed and available versions
uv python pin 3.12       # write .python-version for the current directory

uv downloads prebuilt Python binaries from the python-build-standalone project rather than compiling from source. This makes version installs nearly instant versus pyenv's multi-minute compile process.

The trade-off: uv-managed Python binaries are approximately 3% slower than natively compiled versions on CPU-bound benchmarks (measured via pyperformance). For web services, scripting, and automation, the difference is undetectable.

Layer 4: Tool Management (Replaces pipx)

Shell
uv tool install ruff       # install CLI tool globally in isolated environment
uvx ruff check .           # run tool in temporary environment, no permanent install

uvx runs any CLI tool without permanent installation. The environment is cached for fast subsequent runs. This replaces pipx's core use case.

Layer 5: Build and Publish

Shell
uv build             # build source and wheel distributions
uv publish --token   # publish to PyPI

The Four Key Project Files

A uv project organizes around four files. Understanding what each does explains why uv add is structurally cleaner than the pip + requirements.txt workflow.

File

Purpose

pyproject.toml

Declares project metadata and direct dependencies (equivalent to requirements.in)

uv.lock

Exact resolved set of all direct and transitive dependencies, cross-platform; commit this

.python-version

Pins Python version for the project; read automatically by uv

.venv

Project environment managed by uv; do not commit

The uv.lock file is designed for cross-platform use. It encodes platform-specific markers so macOS, Linux, and Windows developers get consistent environments from the same file. This solves the "works on my machine" problem that pip freeze snapshots create when generated on one OS and used on another.

uv project lifecycle documentation on docs.astral.sh

uv vs pip + venv: The Workflow Comparison

The workflow gap shows up in step count. Corey Schafer's uv tutorial on YouTube counts: the standard pip/venv new-project setup takes 6 manual operations before writing any application code. uv reduces it to two commands.

Task

pip + venv

uv

Create environment

python -m venv .venv

Automatic on first uv add or uv sync

Activate environment

source .venv/bin/activate

Unnecessary; use uv run

Install a package

pip install requests + pip freeze > requirements.txt

uv add requests

Install from lockfile

Manual pip-tools workflow

uv sync

Run a script

Requires active venv

uv run script.py

Cross-platform lock

Extra tooling required

Built into uv.lock

The first-clone workflow makes the difference concrete: git clone <repo>, cd <repo>, uv sync. One command installs the exact locked dependency set, creates the venv, and leaves you ready to run. No activation, no pip invocation, no requirements file management.

Python Version Management Without pyenv

For developers new to Python, including those starting with Python for beginners resources, managing multiple Python versions was historically one of the first roadblocks.

uv python install 3.12 downloads a prebuilt binary in seconds. uv python pin 3.12 writes a .python-version file that all subsequent uv commands read automatically. Multiple versions coexist without conflict, and you switch per project by changing the pin.

Two constraints to check. First, uv-managed Python binaries don't include Tkinter or OpenSSL by default; install those separately if needed. Second, available versions depend on the python-build-standalone release schedule, which tracks CPython closely but may lag slightly on the newest releases.

Docker and CI/CD Integration

Docker builds are where uv's speed differential becomes measurable cost. A Flask + pandas cold install takes 3.2 seconds with uv versus 47 seconds with pip in practitioner benchmarks.

The standard Dockerfile pattern copies dependency files before source code to maximize Docker layer caching:

Shell
# Install uv binary
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Copy dependency files first (this layer gets cached when only source code changes)
COPY pyproject.toml uv.lock ./

# Install dependencies only (no dev dependencies, frozen lockfile)
RUN uv sync --frozen --no-dev

# Copy application source
COPY . .

The --frozen flag verifies the lockfile is current before installing, which prevents silent dependency drift in production builds.

For GitHub Actions, the official astral-sh/setup-uv@v3 action handles installation and caching. Azure App Service for Linux added native uv detection in November 2025: it automatically detects pyproject.toml + uv.lock and builds without additional configuration.

For Python automation pipelines, CI jobs that previously required 3-5 minutes for dependency installation complete in under 30 seconds with uv, fast enough to run as a pre-commit hook.

Inline Script Dependencies and AI Workflows

uv supports PEP 723 inline script metadata, which lets you declare dependencies directly inside a script file header:

Python
# /// script
# dependencies = ["requests", "rich"]
# requires-python = ">=3.11"
# ///
import requests
from rich import print

response = requests.get("https://api.github.com/zen")
print(response.text)

Run with uv run script.py. uv installs the declared dependencies on first run and caches the environment for subsequent runs. No project scaffold, no venv, no pip invocation.

Simon Willison (@simonw) described the use case for LLM-generated scripts in December 2024:

I figured out this prompting pattern for getting Claude to produce fully self-contained Python scripts that execute with "uv run" using PEP 723 inline script dependencies - and now I can one-shot useful Python tools with it https://t.co/POTVFB1UR1
Simon Willison · @simonwView on X

This pattern applies to any Python web scraping task or one-off automation where you want a self-contained script that runs anywhere uv is installed. The file carries its own dependency declaration, making it shareable and reproducible without a separate requirements file.

uv vs Poetry

Both uv and Poetry use pyproject.toml as the project file. uv is a functional superset: built-in Python version management, a cross-platform lockfile, and 10-100x faster resolution.

Feature

uv

Poetry

Speed

10-100x faster than pip

Faster than pip, slower than uv

Python version management

Built-in

Not built-in

Lock file format

uv.lock (cross-platform, PEP 751 aligned)

poetry.lock (Poetry-specific format)

Project format

Standard PEP 621

PEP 621 since Poetry 2.0 (January 2025)

Monthly PyPI downloads

162M

84M

The lock-in concern surfaced frequently after the OpenAI/Astral acquisition. u/tdh3m in r/Python (May 2026) addressed it directly:

"Your dependencies live in standard pyproject.toml (PEP 621), not a proprietary format. If development stalls, you keep your pyproject.toml, swap the [build-system] to hatchling or setuptools, and move on. Poetry actually has more lock-in: its dependency group syntax and some metadata conventions are Poetry-specific, so migrating away is a heavier lift than migrating away from uv."

The migration commands map nearly 1:1:

  • poetry add httpxuv add httpx
  • poetry installuv sync
  • poetry run pytestuv run pytest
  • poetry builduv build

Migration Paths

From pip + venv

Migrate in stages. Start by replacing pip install with uv pip install to get the speed benefit. For the full project workflow:

Shell
uv init .
uv add -r requirements.in
uv sync

Delete your existing .venv and let uv create a fresh one via uv sync.

From pip-tools

Replace pip-compile with uv pip compile requirements.in -o requirements.txt. It is a drop-in replacement running approximately 20x faster. Adopt the full project workflow with uv init when ready.

From Poetry

poetry add becomes uv add. poetry install becomes uv sync. poetry run becomes uv run.

The main practical difference: uv.lock is cross-platform by default, while poetry.lock may encode platform-specific markers that cause divergence across operating systems.

Limitations and When Not to Use uv

A practitioner assessment from bitecode.dev after a full year of uv in production identifies the real edge cases:

When the stricter resolver breaks legacy projects. uv's CDCL SAT resolver is stricter than pip's backtracking resolver. Legacy pip freeze exports from codebases with accumulated constraint conflicts may produce resolution failures that pip would have silently accepted. Cleaning up the dependencies is the right fix; if that's not feasible, stick with pip for that project.

When cache growth becomes an issue. The global content-addressed cache can exceed 20GB after a year of heavy use across many projects. uv cache prune removes unused artifacts without clearing the full cache.

When GitHub Dependabot security scanning is required. Dependabot supports updating uv.lock but has limited vulnerability alert support. If full automated dependency security scanning is a hard requirement, verify current support before migrating.

When your team has a functioning Poetry workflow. Tool migrations have real costs: retraining, CI changes, and workflow disruptions. If Poetry is working, migration payoff depends on team size and how often you're hitting performance limits.

New projects, standard web and data analysis workflows, and any team running CI won't encounter these limits.

Astral and the OpenAI Acquisition

Astral raised a $4 million seed round from Accel in April 2023, plus undisclosed Series A and B rounds. The company builds uv, Ruff (48,202 GitHub stars), and ty (a Python type checker, currently in beta).

On March 19, 2026, OpenAI announced the acquisition of Astral to integrate its tooling into the Codex platform. OpenAI committed to continuing uv, Ruff, and ty as open-source MIT-licensed projects post-acquisition.

The community reaction on r/Python has been pragmatic rather than alarmed. Since uv uses standard PEP 621 format, a developer who wants to stop using uv keeps their pyproject.toml unchanged and switches only the build backend.

Simon Willison raised the question of whether open-source Python infrastructure could become a competitive moat for OpenAI. The open question is whether that commitment holds long-term.

Read the Docs added native uv support in April 2026. Sebastián Ramírez migrated FastAPI, Typer, SQLModel, and Asyncer to uv for all development and CI in October 2024:

Now all my projects (@FastAPI, Typer, SQLModel, Asyncer, etc) use uv to install packages in development and CI. 🚀 Much simpler, faster, clearer. ✨
Sebastián Ramírez · @tiangoloView on X

Frequently Asked Questions

Related Articles