python
Use for Python work with uv—envs, deps, and commands run through uv; avoid pip/venv/pip-tools; keep Justfile/CI parity with ruff, mypy, pytest.
When & Why to Use This Skill
This Claude skill optimizes Python development workflows by standardizing on `uv` for lightning-fast environment management and dependency resolution. It eliminates the complexities of legacy tools like pip and venv, providing a unified interface for linting with ruff, type checking with mypy, and testing with pytest to ensure production-ready code and perfect CI/CD parity.
Use Cases
- Rapid Project Initialization: Quickly set up new Python projects with optimized virtual environments and standardized dependency structures using uv commands.
- Automated Code Quality Enforcement: Seamlessly integrate ruff, mypy, and pytest into the development cycle to maintain high standards for formatting, static typing, and unit testing.
- CI/CD Pipeline Optimization: Streamline continuous integration workflows by using 'uv sync --frozen' to ensure consistent, reproducible, and high-speed build environments.
- Dependency Migration: Efficiently transition legacy Python projects from pip, pipenv, or poetry to uv for improved performance and simplified maintenance.
| name | python |
|---|---|
| description | Use for Python work with uv—envs, deps, and commands run through uv; avoid pip/venv/pip-tools; keep Justfile/CI parity with ruff, mypy, pytest. |
Python (uv-only)
Overview
Standardize Python workflows on uv for envs, dependency resolution, and execution. No pip, venv, or pip-tools unless forced by third-party tooling.
When to Use
- Any Python install/run/test/lint/typecheck in this repo.
- Setting up new projects or maintaining existing ones.
- CI steps for Python.
Core Pattern
- Standard commands (keep CI aligned):
uv venv .venv && source .venv/bin/activate && uv sync;uv run ruff format --check .;uv run ruff check .;uv run mypy .;uv run pytest;uv lock; combine as needed for CI. - Env:
uv venv .venv; activate shell or direnv; never use system/site-packages. - Deps:
uv add <pkg>; dev depsuv add --dev ruff mypy pytest; syncuv sync; commituv.lock+pyproject.toml. - Run: always
uv run <cmd>(python, pytest, scripts). - CI:
uv sync --frozen;uv run pytest(plus ruff/mypy as needed).
Quick Reference
| task | command |
|---|---|
| New env | uv venv .venv |
| Install | uv add foo / uv add --dev ruff mypy |
| Sync lock | uv sync --frozen |
| Run script | uv run python script.py |
| Tests | uv run pytest |
| Format | uv run ruff format --check . |
| Lint | uv run ruff check . |
| Types | uv run mypy . |
| Lock | uv lock |
Red Flags
- Any
pip install,python -m venv, orpipenv/poetryuse. - Missing
uv.lockin repo. - Running
python script.pywithoutuv run. - Mixing global site-packages with project env.
Verification
- Fresh clone:
uv venv && uv sync --frozen && uv run pytestsucceeds without pip. which pippoints to.venv/bin/pipcreated by uv.