uv-python-manager
Standardize Python development using UV - a fast, unified package and project manager. Use when creating Python projects, managing dependencies, setting up virtual environments, installing Python versions, or optimizing Python workflows. Replaces pip, virtualenv, pyenv, poetry, and pipx with a single 10-100x faster tool.
What this skill does
# uv-python-manager
UV is the modern standard for Python package and project management in 2025, delivering 10-100x speed improvements while unifying pip, virtualenv, pyenv, poetry, and pipx into a single Rust-based tool.
## When to Use This Skill
Use this skill when:
- Creating new Python projects
- Managing dependencies and lockfiles
- Setting up virtual environments
- Installing or switching Python versions
- Building or publishing packages
- Optimizing CI/CD pipelines
- Migrating from pip, poetry, or other tools
- Creating portable Python scripts
- Working with Docker containers
## Core Principles
1. **Project-first workflow**: Use `uv init` and `uv add` instead of manual configuration
2. **Lock file discipline**: Always commit `uv.lock` for reproducibility
3. **Universal execution**: Use `uv run` instead of manual environment activation
4. **Version pinning**: Use `.python-version` for team consistency
5. **Fast by default**: Leverage caching and parallel operations (8-100x faster than pip)
## Quick Start
### Installing UV
```bash
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows PowerShell
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Update UV
uv self update
```
### Creating a New Project
```bash
# Initialize project (creates pyproject.toml, .python-version, .gitignore)
uv init my-project
cd my-project
# Add dependencies
uv add requests fastapi pandas
# Add development dependencies
uv add --dev pytest ruff mypy
# Add to custom groups
uv add --group docs sphinx
uv add --group test pytest-cov
# Run code (auto-syncs environment)
uv run python main.py
uv run pytest
```
## Essential Commands Reference
### Project Lifecycle
```bash
uv init [name] # Create new project with structure
uv add <package> # Add dependency (updates pyproject.toml + uv.lock)
uv add --dev <package> # Add development dependency
uv add --group <name> <pkg> # Add to custom dependency group
uv remove <package> # Remove dependency
uv sync # Install/sync all dependencies
uv sync --frozen # Sync without updating lock (CI mode)
uv sync --no-dev # Production install (exclude dev deps)
uv run <command> # Run command in project environment
uv build # Build distribution packages
uv publish # Publish to PyPI
```
### Python Version Management
```bash
uv python install 3.12 # Install Python version
uv python install 3.11 3.12 # Install multiple versions
uv python list # List installed Python versions
uv python pin 3.12 # Pin project to Python version
uv python find # Show active Python version
```
### Virtual Environments
```bash
uv venv # Create virtual environment (.venv/)
uv venv --python 3.12 # Create with specific Python version
uv venv my-env # Create with custom name
```
### Lock File Management
```bash
uv lock # Update lockfile from pyproject.toml
uv lock --upgrade # Upgrade all dependencies
uv lock --upgrade-package <pkg> # Upgrade specific package
uv lock --check # Verify lock is current (CI check)
uv export --format requirements-txt > requirements.txt # Export format
```
### Tool Management (replaces pipx)
```bash
uvx <tool> # Run tool temporarily (no install)
uvx ruff check . # Example: run ruff once
uv tool install <tool> # Install tool globally
uv tool list # List installed tools
uv tool uninstall <tool> # Remove global tool
```
### Maintenance
```bash
uv cache clean # Clean cache
uv cache dir # Show cache location
uv self update # Update UV itself
```
## Project Structure Best Practices
### Standard Layout
```
project/
├── .git/
├── .gitignore # Auto-generated by uv init
├── .python-version # Python version pin (COMMIT THIS)
├── README.md # Setup instructions
├── pyproject.toml # Project configuration (COMMIT THIS)
├── uv.lock # Universal lockfile (COMMIT THIS)
├── .venv/ # Virtual environment (DO NOT COMMIT)
├── src/
│ └── package/
│ ├── __init__.py
│ └── main.py
└── tests/
└── test_main.py
```
### pyproject.toml Structure
```toml
[project]
name = "my-app"
version = "0.1.0"
description = "Application description"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"requests>=2.31.0,<3.0.0", # Range with upper bound
"pandas>=2.0.0", # Minimum version
"fastapi[standard]>=0.115.0", # With extras
]
[project.optional-dependencies]
plotting = ["matplotlib>=3.7.0", "seaborn>=0.12.0"]
database = ["sqlalchemy>=2.0.0", "psycopg2-binary>=2.9.0"]
[dependency-groups]
dev = ["pytest>=8.0.0", "ruff>=0.3.0", "mypy>=1.8.0"]
test = ["pytest-cov>=4.1.0", "pytest-asyncio>=0.23.0"]
docs = ["sphinx>=7.0.0", "sphinx-rtd-theme>=2.0.0"]
```
## Key Workflows
### Dependency Management
**Adding dependencies:**
```bash
# Single package
uv add requests
# Multiple packages
uv add requests pandas numpy
# With version constraints
uv add "fastapi>=0.115.0,<1.0.0"
# With extras
uv add "fastapi[standard]"
# Development dependencies
uv add --dev pytest ruff mypy
# Optional dependency groups
uv add --optional plotting matplotlib seaborn
```
**Managing versions:**
```bash
# Upgrade all dependencies
uv lock --upgrade
# Upgrade specific package
uv lock --upgrade-package requests
# Pin to latest compatible versions
uv add requests --upgrade
```
### Running Code
**Always use `uv run` instead of activating environments:**
```bash
# Run Python scripts
uv run python script.py
uv run python -m mymodule
# Run installed tools
uv run pytest
uv run ruff check .
uv run mypy src/
# Run with specific Python version
uv run --python 3.12 python script.py
# Pass arguments
uv run pytest tests/ -v --cov
```
**Why `uv run` is better:**
- Auto-syncs environment before running
- Works cross-platform without activation scripts
- Ensures reproducibility
- Handles environment discovery automatically
### Inline Script Dependencies (PEP 723)
Create portable single-file scripts:
```python
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests",
# "rich",
# ]
# ///
import requests
from rich import print
response = requests.get("https://api.github.com")
print(response.json())
```
Run with: `uv run script.py` (automatically installs dependencies)
### Python Version Management
**Project-level pinning:**
```bash
# Pin Python version for project
uv python pin 3.12
# This creates .python-version file
# Always commit this file to git
# UV will automatically use this version
uv run python --version
```
**Installing Python versions:**
```bash
# Install specific version
uv python install 3.12
# Install multiple versions
uv python install 3.11 3.12 3.13
# List available versions
uv python list --all-versions
# List installed versions
uv python list
```
### CI/CD Integration
**GitHub Actions example:**
```yaml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up UV
uses: astral-sh/setup-uv@v6
with:
version: "0.9.5" # Pin UV version
enable-cache: true
- name: Set up Python
run: uv python install
- name: Install dependencies
run: uv sync --frozen # Use --frozen in CI
- name: Check lock file is current
run: uv lock --check
- name: Run tests
run: uv run pytest
- name: Run linting
run: uv run ruff check .
```
**Docker optimization:**
```dockerfile
FROM python:3.12-slim
# Install UV
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Set working directory
WORKDIR /app
# Copy dependency files
COPY pyproject.tomRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.