From python-ecosystem
Python project management with uv — the fast, Rust-based package and project manager. Use this skill when working in a Python project that has uv.lock, .python-version, or when pyproject.toml uses [tool.uv] or [dependency-groups]. Also use when the user mentions uv, "uv run", "uv add", or asks about Python dependency management in a uv-managed project. Provides project setup, dependency management, running tools, and quality gate commands specific to uv workflows.
How this skill is triggered — by the user, by Claude, or both
Slash command
/python-ecosystem:uvThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**uv** is the single tool for managing Python versions, virtual environments, dependencies, and running project tools. All project operations go through uv.
uv is the single tool for managing Python versions, virtual environments, dependencies, and running project tools. All project operations go through uv.
# Create a new project
uv init my-project
cd my-project
# Or initialize in an existing directory
uv init
# Specify a Python version
uv init --python 3.12 my-project
This creates: pyproject.toml, .python-version, .gitignore, README.md, and a starter main.py.
# Install specific Python versions
uv python install 3.11 3.12
# Pin the project to a specific version
uv python pin 3.12
The pinned version is stored in .python-version and used automatically by all uv commands.
uv auto-creates and manages .venv/ — you rarely need to interact with it directly.
# Explicitly create a venv (usually automatic)
uv venv
# Sync the environment to match the lockfile
uv sync
Never activate the venv manually. Use uv run to execute everything within the project environment.
Adding dependencies:
uv add requests # Runtime dependency
uv add 'requests>=2.31,<3' # With version constraints
uv add git+https://github.com/psf/requests # From git
uv add -r requirements.txt # Import from requirements.txt
Adding dev dependencies:
uv add --dev pytest # Default dev group
uv add --dev pytest-cov
uv add --dev pytest-asyncio
uv add --group lint ruff # Named group
uv add --group docs mkdocs
Removing and upgrading:
uv remove requests # Remove a dependency
uv lock --upgrade-package requests # Upgrade specific package
uv lock --upgrade # Re-lock all dependencies
[project]
name = "my-project"
version = "0.1.0"
description = "Project description"
requires-python = ">=3.12"
dependencies = [
"requests>=2.31,<3",
"pydantic>=2.0",
]
[project.optional-dependencies]
excel = ["openpyxl>=3.1.0"]
[dependency-groups]
dev = [
"pytest>=8.0",
"pytest-cov>=4.0",
"pytest-asyncio>=0.23",
{include-group = "lint"},
]
lint = ["ruff>=0.4"]
docs = ["mkdocs>=1.5"]
[tool.uv]
default-groups = ["dev", "lint"]
uv.lock is a cross-platform lockfile. Auto-generated, commit to version control.
uv lock # Update lockfile from pyproject.toml
uv sync # Sync environment to lockfile
uv sync --group docs # Sync specific groups
uv sync --no-dev # Production-only sync
Always use uv run for project tools:
uv run pytest # Run tests
uv run pytest --cov # Tests with coverage
uv run ruff check src # Linting
uv run ruff format src # Formatting
uv run mypy src # Type checking
uv run python -m mypackage # Run application
Use uvx for standalone/ephemeral tools:
uvx ruff check . # One-off tool without installing
uvx [email protected] check . # Specific version
Rule of thumb: uv run when the tool needs your project code. uvx for standalone utilities.
uv build # Produces wheel and sdist in dist/
project/
├── src/
│ └── mypackage/
│ ├── __init__.py
│ ├── conftest.py
│ ├── core/
│ │ ├── pricing.py
│ │ └── pricing_spec.py
│ ├── adapters/
│ │ ├── payment_gateway.py
│ │ └── payment_gateway_spec.py
│ └── cli.py
├── docs/
├── pyproject.toml
├── uv.lock
├── .python-version
└── README.md
uv add / uv remove — never edit pyproject.toml by hand for depsuv add --dev for dev-only dependenciesuv add --group <name> for named dependency groupsuv.lock committed for reproducible buildsuv sync after cloning or pullingBefore considering any code complete, MUST complete all steps:
Tests with Coverage
uv run pytest — all tests passuv run pytest --cov — coverage above threshold (MANDATORY)uv run pytest path/to/test.py -v or uv run pytest --lfLinting with ZERO warnings
uv run ruff check src — zero warnings (MANDATORY)uv run ruff format src — consistent formattingSecurity Audit
uvx pip-audit — check for known vulnerabilities (MANDATORY)uv pip list --outdated — check for outdated dependenciesDocumentation Sync
uv run mkdocs build — verify docs buildnpx claudepluginhub svetzal/guidelines --plugin python-ecosystemProvides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.