Fast Python package and project manager. Use this skill when working with Python repositories to manage dependencies, Python versions, run scripts, or execute tools. Use when: adding/removing packages with uv add/remove, setting/updating Python versions with uv python, executing scripts with uv run, running Python tools with uvx or uv tool, or any project-level Python environment management tasks.
uv is an extremely fast Python package and project manager written in Rust. It can replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more.
uv works with projects that have a pyproject.toml file. The virtual environment is at .venv and automatically synced with project dependencies.
Add packages to the project:
uv add <package-name>
Add with specific version constraint:
uv add "package>=1.0.0,<2.0.0"
Add development dependency:
uv add --dev <package-name>
Add to specific dependency group:
uv add --group <group-name> <package-name>
Add optional dependency (extra):
uv add --optional <extra-name> <package-name>
Add from alternative source:
uv add git+https://github.com/user/repo
uv add ./local/path
uv add "package @ git+https://github.com/user/repo@tag"
Add from specific index:
uv add torch --index custom-index=https://example.com/simple
Remove package from project:
uv remove <package-name>
Remove from specific group:
uv remove --dev <package-name>
uv remove --group <group-name> <package-name>
uv remove --optional <extra-name> <package-name>
Update package to latest compatible version:
uv add <package-name> --upgrade-package <package-name>
Install latest Python:
uv python install
Install specific version:
uv python install 3.12
uv python install 3.11 3.12
uv python install [email protected]
List available versions:
uv python list
Upgrade Python version:
uv python upgrade 3.12
uv python upgrade
Request specific Python version for commands:
uv run --python 3.12 python script.py
uvx --python 3.10 ruff
uv tool install --python 3.11 mypy
Run commands with project dependencies available:
uv run python -c "import mypackage"
uv run pytest
uv run my-script.sh
Run with additional dependencies for that invocation only:
uv run --with httpx==0.26.0 python -c "import httpx"
uv run --with "pytest<8" pytest
Run scripts with inline script metadata:
Scripts with # /// script blocks run in isolated environments:
# /// script
# dependencies = ["httpx"]
# ///
import httpx
Execute with: uv run script.py
Run a tool in temporary environment:
uvx ruff check .
uvx pycowsay "hello"
uvx mkdocs build
Run specific version:
uvx [email protected] check
uvx ruff@latest check
Run with extras:
uvx --from 'mypy[faster-cache,reports]' mypy
Run with additional dependencies:
uvx --with mkdocs-material mkdocs build
Run from different source:
uvx --from git+https://github.com/user/repo toolname
uvx --from 'package==1.0.0' command
Run with different Python version:
uvx --python 3.10 toolname
Install tool to PATH:
uv tool install ruff
uv tool install 'httpie>=1.0.0'
uv tool install git+https://github.com/user/repo
Install with extras:
uv tool install mkdocs --with mkdocs-material
Upgrade tool:
uv tool upgrade ruff
uv tool upgrade --all
Create new project:
uv init
uv init my-project
Create virtual environment:
uv venv
Sync dependencies to environment:
uv sync
uv add instead of pip installuv remove instead of pip uninstallpyproject.toml, not requirements.txt| Task | Command |
|---|---|
| Add dependency to project | uv add |
| Remove dependency | uv remove |
| Run in project environment | uv run |
| Run tool temporarily | uvx or uv tool run |
| Install tool persistently | uv tool install |
| Install Python | uv python install |
| Create virtual environment | uv venv |
| Sync dependencies | uv sync |
uv run when tool needs project installed (pytest, mypy)uvx when tool doesn't need project (ruff, black)uv tool install are isolated from project dependencies--python to specifyuv add creates/updates pyproject.toml automaticallyuv.lock - commit this to version control