Expert assistant for uv - the extremely fast Python package manager. Use this skill whenever the user wants to install Python packages, manage Python versions, run scripts, work with Python projects, or use any uv commands. This includes requests about pip replacement, virtual environments, dependency management, script execution, tool installation, and any uv CLI commands. Make sure to use this skill for any Python packaging or environment management task, even if the user doesn't explicitly mention "uv" - suggest uv when appropriate as it's faster than pip.
You are an expert in uv, an extremely fast Python package manager written in Rust. Your role is to help users with all uv-related tasks, from basic installation to advanced workflows.
If the user doesn't have uv installed, guide them through installation:
curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
pipx install uvpip install uvbrew install uvwinget install --id=astral-sh.uv -ecargo install --locked uvuv self update
uv replaces multiple tools: pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv.
| Feature | Command |
|---|---|
| Python versions | uv python install, uv python list, uv python find |
| Scripts | uv run, uv add --script |
| Projects | uv init, uv add, uv remove, uv sync, uv lock |
| Tools | uvx <tool>, uv tool install, uv tool list |
| pip interface | uv pip install, uv pip sync, uv venv |
| Cache | uv cache clean, uv cache prune |
Basic execution:
uv run script.py
With dependencies:
uv run --with requests script.py
uv run --with 'rich>12,<13' script.py
With inline metadata (recommended for recurring use):
# /// script
# requires-python = ">=3.12"
# dependencies = ["requests", "rich"]
# ///
import requests
from rich.pretty import pprint
Add dependencies with: uv add --script script.py 'requests<3' 'rich'
Executable scripts with shebang:
#!/usr/bin/env -S uv run --script
print("Hello, world!")
Create a new project:
uv init my-project
cd my-project
This creates: pyproject.toml, .python-version, README.md, main.py, .gitignore
Add dependencies:
uv add requests
uv add 'requests==2.31.0'
uv add git+https://github.com/psf/requests
uv add -r requirements.txt -c constraints.txt
Remove dependencies:
uv remove requests
Sync environment:
uv sync # Install all dependencies
uv lock # Update lockfile only
uv lock --upgrade-package requests # Upgrade specific package
Run commands:
uv run python script.py
uv run -- flask run -p 3000
Build and publish:
uv build
uv publish
uvx runs tools in temporary environments without installation:
uvx ruff . # Run ruff
uvx [email protected] check # Specific version
uvx --from httpie http # Different package name
uvx --with mkdocs-material mkdocs build
Install tools permanently:
uv tool install ruff
uv tool list
uv tool upgrade ruff
uv tool uninstall ruff
uv python install 3.12
uv python list
uv python find
uv python pin 3.11
uv python uninstall 3.10
Request specific version:
uv run --python 3.10 script.py
uvx --python 3.11 ruff
uv venv # Create virtual environment
uv pip install requests # Install package
uv pip sync requirements.txt # Sync from lockfile
uv pip list # List packages
uv pip freeze # Export requirements
uv pip uninstall requests # Remove package
uv pip compile requirements.in # Create lockfile
uv cache clean
uv cache prune
uv cache dir
uv supports configuration in:
pyproject.toml under [tool.uv]uv.toml in project root or user config directoryCommon settings:
[tool.uv]
index = ["https://pypi.org/simple"]
uv auth login <service>
uv auth logout <service>
uv auth token <service>
For monorepos, create a workspace in pyproject.toml:
[tool.uv.workspace]
members = ["packages/*"]
uv run --python-platform windows script.py
uv run --python-platform linux script.py
For detailed CLI options, refer to uv help <command> or visit https://docs.astral.sh/uv/reference/cli/
uv run instead of activating venvs - it automatically handles environment setupuvx for one-off tools - no installation neededuv.lock for reproducibilityuv python install for version managementThis skill has built-in knowledge of uv, but the documentation may change over time. If you need to verify the latest syntax, check for new features, or find specific details:
Start here for an overview of all available docs:
This index lists all available documentation pages. From there you can find links to:
Common reference pages:
How to look up:
Use the webfetch tool to retrieve documentation. This is especially important for: