| name | uv-0-11-23 |
| description | Manages Python packages, projects, scripts, tools, and Python versions with extreme speed. Use when the user mentions uv, python packages, pip replacement, virtual environments, venv, pyproject.toml, dependency management, python version switching, tool installation (uvx), script dependencies, lockfiles, workspace management, or any Python packaging task. Replaces pip, pip-tools, pipx, poetry, pyenv, twine, and virtualenv.
|
uv 0.11.23
An extremely fast Python package and project manager written in Rust. A single tool replacing pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more — 10-100x faster than pip.
Overview
uv provides four main interfaces:
- Projects — Full project management with lockfiles, workspaces, and environments (
uv init, uv add, uv run, uv sync, uv lock)
- Scripts — Run Python scripts with on-demand dependency resolution, including inline metadata (PEP 723)
- Tools — Install and run CLI tools from Python packages, like
pipx (uvx, uv tool install)
- Python versions — Install and manage Python interpreters, auto-downloading as needed
It also includes a pip-compatible interface (uv pip install, uv pip compile, uv venv) for gradual migration from existing workflows.
Usage
Projects
uv init my-project
uv add requests flask
uv add 'requests>=2.28,<3'
uv remove requests
uv run python main.py
uv run -- flask run -p 3000
uv lock
uv sync
uv build
uv tree
Scripts
uv run script.py
uv run --with rich,requests script.py
uv add --script script.py requests
uv init --script tool.py --python 3.12
uv lock --script script.py
Tools (like pipx)
uv tool run ruff check .
uvx ruff check .
uvx ruff@0.9.0 check .
uv tool install ruff
uv tool upgrade ruff
uv tool upgrade --all
uv tool list
uv tool uninstall ruff
Python Versions
uv python install 3.12
uv python install 3.11 3.12 3.13
uv python install pypy@3.10
uv python list
uv python pin 3.12
uv python upgrade 3.12
pip Interface (drop-in replacement)
uv venv --python 3.12
uv pip install flask requests
uv pip compile requirements.in -o requirements.txt
uv pip sync requirements.txt
uv pip uninstall flask
Common Flags
| Flag | Description |
|---|
--python VERSION | Use specific Python version (e.g., 3.12, pypy@3.10) |
--with PACKAGE | Include additional packages (run/tool contexts) |
--no-project | Skip project context, run standalone |
--system | Install into system Python (CI/containers) |
--exclude-newer DATE | Limit to distributions released before date |
Gotchas
uvx vs uv run for tools — uvx runs in an isolated environment. Use uv run when the tool needs access to your project (e.g., pytest, mypy).
- Package name vs command name — When they differ, use
--from: uvx --from httpie http.
- Inline script metadata ignores project deps — Scripts with
# /// script blocks run independently of the surrounding project. No need for --no-project.
- Automatic Python downloads — uv downloads Python on-demand by default. Disable with
UV_PYTHON_DOWNLOADS=never or --no-managed-python.
.venv naming — uv creates .venv by default. Use VIRTUAL_ENV=/path/to/venv to target a different environment.
- Lockfile format —
uv.lock is TOML-based and managed automatically. Do not edit it manually.
--system flag — Required when installing into non-virtual (system) Python. Skips virtualenv discovery.
References
- 01-projects — Project lifecycle: init, add, lock, sync, run, build
- 02-tools — Tool management: uvx, install, upgrade, list, uninstall
- 03-scripts — Script execution, inline metadata (PEP 723), shebangs
- 04-python-versions — Python installation, discovery, pinning, upgrades
- 05-pip-interface — pip-compatible commands: install, compile, sync, uninstall
- 06-workspaces — Multi-package workspace setup and management
- 07-resolution — Resolution strategies, constraints, overrides, indexes