| name | uv-0-11-19 |
| description | Fast Python package and project manager written in Rust. Replaces pip, pip-tools, pipx, poetry, pyenv, virtualenv, twine, and more. Use when managing Python dependencies, creating virtual environments, running tools with uvx (pipx alternative), installing Python versions, building/publishing packages, or any Python project setup task. |
uv 0.11.19
Extremely fast Python package and project manager (10–100× faster than pip). Single tool replacing pip, pip-tools, pipx, poetry, pyenv, virtualenv, and twine.
Overview
uv manages Python projects, scripts, tools, and environments. It provides:
- Projects — dependency management with lockfiles (
uv.lock)
- Scripts — inline metadata (PEP 723) for standalone
.py files
- Tools —
uvx for ephemeral tool execution (pipx replacement)
- Python versions — install and switch between Python implementations
- pip interface — drop-in
uv pip replacement with familiar CLI
Usage
Project workflow
uv init my-project
cd my-project
uv add requests
uv add 'flask>=2.0'
uv add --dev pytest
uv remove requests
uv lock
uv sync
uv run python main.py
uv run flask run
uvx — run tools without installing (pipx alternative)
uvx ruff check .
uvx pycowsay hello
uvx ruff@0.8.0 check
uvx --from httpie http
uvx --with mkdocs-material mkdocs
Python version management
uv python install 3.12
uv python install pypy@3.10
uv python list
uv python pin 3.12
uv venv --python 3.11
Scripts with inline metadata (PEP 723)
uv init --script task.py
uv add --script task.py requests rich
uv run task.py
Inline metadata block in .py files:
Build and publish
uv build
uv version --bump minor
uv publish
pip interface (drop-in replacement)
uv venv
uv pip install flask
uv pip install -r reqs.txt
uv pip compile reqs.in -o reqs.txt
uv pip sync reqs.txt
uv pip freeze
Cache management
uv cache clean
uv cache clean ruff
uv cache prune --ci
Gotchas
uvx vs uv run — uvx runs in an isolated environment with no access to project dependencies. Use uv run when the tool needs your project installed (e.g., pytest, mypy).
--no-project flag — inside a project directory, uv run script.py installs the project first. Use uv run --no-project script.py to skip that.
- Inline scripts ignore project deps — when a
.py file has PEP 723 metadata, uv run uses only those dependencies, not the surrounding project's.
- Package vs command name mismatch — if
uvx ruff fails because the command isn't in the package, use uvx --from <package> <command>.
--system required for system Python — uv refuses to modify system Python by default. Add --system flag explicitly (appropriate for CI/containers).
- Automatic Python downloads — uv downloads missing Python versions by default. Disable with
UV_PYTHON_DOWNLOADS=never if you need strict control.
- Workspaces share one lockfile — all workspace members resolve together. Conflicting
requires-python across members takes the intersection.
uv pip compile outputs to stdout — use -o requirements.txt to write a file; without it the output is just displayed.
References
- 01-projects.md — project structure, pyproject.toml, lockfile, dependency sources
- 02-tools.md — uvx details, tool install/upgrade, package vs command names
- 03-scripts.md — PEP 723 inline metadata, shebang scripts, locking scripts
- 04-python.md — Python installation, version requests, managed vs system Python
- 05-pip-interface.md — uv pip commands, compile/sync, constraints and overrides
- 06-workspaces.md — multi-package workspaces, shared lockfile, workspace sources