| name | py-uv |
| description | Manage Python projects with uv (Astral's package/project manager). Use when
creating Python projects, adding dependencies, running scripts, or managing
Python versions. Triggers on: "create python project", "add dependency",
"uv init", "uv add", "run python", "install package", or Python project setup.
|
| allowed-tools | ["Bash","Read","Edit","Write","Glob","Grep"] |
uv — Python Package & Project Manager (Astral)
Blazingly fast Python package and project manager written in Rust. Replaces pip,
pip-tools, pipx, poetry, pyenv, and virtualenv.
Repo: https://github.com/astral-sh/uv
When to use
Use uv for ALL Python project management: creating projects, adding dependencies,
running scripts, managing Python versions, and installing tools.
Installation
curl -LsSf https://astral.sh/uv/install.sh | sh
Key commands
Project management
uv init my-project
uv add requests fastapi
uv add --dev pytest ruff ty
uv remove requests
uv sync
uv lock
uv tree
Running code
uv run script.py
uv run --with requests script.py
uv run python
Python version management
uv python install 3.12
uv python pin 3.12
uv python list
Tool management
uv tool install ruff
uv tool upgrade --all
uvx ruff check .
uvx --from httpie http
pip compatibility
uv pip install requests
uv pip compile requirements.in
uv pip sync requirements.txt
uv venv
Publishing
uv build
uv publish
Configuration
In pyproject.toml:
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = ["requests>=2.28"]
[tool.uv]
dev-dependencies = ["pytest>=7.0", "ruff", "ty"]
[tool.uv.workspace]
members = ["packages/*"]
File artifacts
pyproject.toml — project metadata and config
uv.lock — universal lockfile (commit to VCS)
.venv/ — virtual environment (auto-created)
.python-version — pinned Python version
Inline script dependencies (PEP 723)
import requests
Run with uv run script.py — deps installed automatically.
Workflow
- New projects:
uv init, then uv add dependencies
- Existing projects:
uv sync to set up environment
- Run code with
uv run (never activate venvs manually)
- Install dev tools with
uv add --dev ruff ty