Download
What uv replaces
This cheatsheet is organized by what uv can replace (pyenv, venv, poetry, pip/pipx) and the most common commands.
Python versions
| Purpose |
Command |
| Install a Python |
uv python install <version> |
| List versions |
uv python list |
| Use a version in project |
uv python use <version> |
| Auto-install required version |
uv run --python <version> script.py |
| Pin version |
uv python pin <version> |
Virtual environment
| Purpose |
Command |
| Create venv |
uv venv |
| Create venv w/ specific Python |
uv venv --python <version> |
| Activate (Windows) |
.venv\Scripts\activate |
| Activate (Linux/macOS) |
source .venv/bin/activate |
| Reinstall deps |
uv sync --reinstall |
Project and locking
| Purpose |
Command |
| Init project |
uv init <project-name> |
| Add dependency |
uv add <package-name> |
| Add dev dependency |
uv add --dev <package-name> |
| Remove package |
uv remove <package-name> |
| Lock deps |
uv lock |
| Upgrade lock (all) |
uv lock --upgrade |
| Upgrade lock (one) |
uv lock --upgrade-package <package-name> |
Install, export, upgrade
| Purpose |
Command |
| Install from pyproject |
uv sync |
| Exclude groups |
uv sync --no-group dev --no-group lint |
| Install requirements.txt |
uv pip install -r requirements.txt |
| Freeze requirements.txt |
uv pip freeze > requirements.txt |
| Export from uv.lock |
uv export --format requirements-txt > requirements.txt |
| Upgrade & apply (all) |
uv sync --upgrade |
| Upgrade & apply (one) |
uv sync --upgrade-package <package-name> |
| Purpose |
Command |
| Install tool globally |
uv tool install <tool-name> |
| List tools |
uv tool list |
| Uninstall tool |
uv tool uninstall <tool-name> |
| Upgrade one tool |
uv tool upgrade <tool-name> |
| Upgrade all tools |
uv tool upgrade --all |
| Run script in venv |
uv run <script.py> |
| Run command in venv |
uv run -- <command> |
| Run with temp dep |
uv run --with <package> python script.py |
| One-time CLI tool |
uvx <tool-name> --version |
| Bash completion |
eval "$(uv generate-shell-completion bash)" |