Rust-Powered Dependency Tooling

uv Package Manager

Boost python agent setup routines with Astral's Rust-powered installer. Learn lightning-fast dependency resolution, venv builds, lockfile validation, workspaces, and cached builds.

Core Concepts Setup & Installation Code Examples FAQ

Core Concepts

Features that make uv a leading installer for agent developers.

Extreme Speed

Built in Rust, `uv` installs packages up to 10-100x faster than traditional `pip` and `pip-tools` configurations.

Unified Tooling

Serves as a drop-in replacement for `pip`, `pip-tools` (compiling), `virtualenv`, and `poetry` or `pipenv` project workflows.

Lockfile Enforcement

Lock dependency trees securely. Automatically output cross-platform `uv.lock` metadata checking hashes and pins.

Project Workspaces

Orchestrate multi-package monorepos with cross-project local dependencies cleanly using the `uv workspace` parameters.

Global Cache Sharing

Shares a global cache directory across all virtual environments, preventing redundant package downloads and compilation cycles.

Python Automanagement

No Python pre-installation required. `uv` downloads and installs matching target python compiler binaries automatically on demand.

Setup & Installation

Get started installing uv across platform environments.

Installation commands

# Install uv on macOS/Linux using shell script
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or install using Homebrew on macOS
brew install uv

# Or install as a python library
pip install uv

Practical CLI Examples

Initializing projects, adding package dependencies, compilation locks, and executing scripts in clean runtimes.

1. Virtual Environment & Package Operations

# Create virtualenv using specific Python version (automatically downloaded if missing)
uv venv --python 3.11

# Install packages into active environment
uv pip install pydantic-ai fastapi

# Compile requirement pins into strict lockfile
uv pip compile requirements.in -o requirements.txt

2. Modern Project Management Workflow

# Initialize a new project directory structure
uv init agent-project --app
cd agent-project

# Add package dependency (automatically generates/updates pyproject.toml and uv.lock)
uv add pydantic-ai

# Run script cleanly inside isolated context (auto-resolving dependencies)
uv run main.py

Frequently Asked Questions

Why is uv so much faster than standard pip?
`uv` is written in Rust, utilizing concurrent network connection layers, highly optimized parsing structures, and aggressive memory-mapped global download caches to skip rebuild/download processes entirely.
Does uv support pyproject.toml structures?
Yes. In addition to legacy `requirements.txt` processes, `uv` natively manages modern `pyproject.toml` configurations. Running `uv add` or `uv remove` updates PEP-compliant standards structures automatically.
How do we use uv inside Docker container files?
Instead of installing heavy dev environments, you can copy the `uv` binary directly from the official Docker image using: `COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv`. From there, run `uv pip install --system -r requirements.txt` to sync directly into the system python.
Can I run standalone Python scripts with dependencies using uv?
Yes. You can declare inline script metadata comments (PEP 723) detailing dependencies. When executing `uv run script.py`, uv dynamically downloads Python and the dependencies, runs the script in an isolated temp venv, and discards it.