This source did not publish a separate summary. Review SKILL.md before using the skill.
SKILL.md
UV Package Manager
Comprehensive guide to using uv, an extremely fast Python package installer and resolver written in Rust, for modern Python project management and dependency workflows.
When to Use This Skill
Setting up new Python projects quickly
Managing Python dependencies faster than pip
Creating and managing virtual environments
Installing Python interpreters
Resolving dependency conflicts efficiently
Migrating from pip/pip-tools/poetry
Speeding up CI/CD pipelines
Managing monorepo Python projects
Working with lockfiles for reproducible builds
Optimizing Docker builds with Python dependencies
Core Concepts
1. What is uv?
Ultra-fast package installer: 10-100x faster than pip
Written in Rust: Leverages Rust's performance
Drop-in pip replacement: Compatible with pip workflows
Virtual environment manager: Create and manage venvs
Python installer: Download and manage Python versions
Resolver: Advanced dependency resolution
Lockfile support: Reproducible installations
2. Key Features
Blazing fast installation speeds
Disk space efficient with global cache
Compatible with pip, pip-tools, poetry
Comprehensive dependency resolution
Cross-platform support (Linux, macOS, Windows)
No Python required for installation
Built-in virtual environment support
3. UV vs Traditional Tools
vs pip: 10-100x faster, better resolver
vs pip-tools: Faster, simpler, better UX
vs poetry: Faster, less opinionated, lighter
vs conda: Faster, Python-focused
Installation
Quick Install
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Using pip (if you already have Python)
pip install uv
# Using Homebrew (macOS)
brew install uv
# Using cargo (if you have Rust)
cargo install --git https://github.com/astral-sh/uv uv
Verify Installation
uv --version
# uv 0.x.x
Quick Start
Create a New Project
# Create new project with virtual environment
uv init my-project
cd my-project
# Or create in current directory
uv init .
# Initialize creates:
# - .python-version (Python version)
# - pyproject.toml (project config)
# - README.md
# - .gitignore
Install Dependencies
# Install packages (creates venv if needed)
uv add requests pandas
# Install dev dependencies
uv add --dev pytest black ruff
# Install from requirements.txt
uv pip install -r requirements.txt
# Install from pyproject.toml
uv sync
Virtual Environment Management
Pattern 1: Creating Virtual Environments
# Create virtual environment with uv
uv venv
# Create with specific Python version
uv venv --python 3.12
# Create with custom name
uv venv my-env
# Create with system site packages
uv venv --system-site-packages
# Specify location
uv venv /path/to/venv
Pattern 2: Activating Virtual Environments
# Linux/macOS
source .venv/bin/activate
# Windows (Command Prompt)
.venv\Scripts\activate.bat
# Windows (PowerShell)
.venv\Scripts\Activate.ps1
# Or use uv run (no activation needed)
uv run python script.py
uv run pytest
Pattern 3: Using uv run
# Run Python script (auto-activates venv)
uv run python app.py
# Run installed CLI tool
uv run black .
uv run pytest
# Run with specific Python version
uv run --python 3.11 python script.py
# Pass arguments
uv run python script.py --arg value
Package Management
Pattern 4: Adding Dependencies
# Add package (adds to pyproject.toml)
uv add requests
# Add with version constraint
uv add "django>=4.0,<5.0"
# Add multiple packages
uv add numpy pandas matplotlib
# Add dev dependency
uv add --dev pytest pytest-cov
# Add optional dependency group
uv add --optional docs sphinx
# Add from git
uv add git+https://github.com/user/repo.git
# Add from git with specific ref
uv add git+https://github.com/user/[email protected]
# Add from local path
uv add ./local-package
# Add editable local package
uv add -e ./local-package
# Upgrade specific package
uv add --upgrade requests
# Upgrade all packages
uv sync --upgrade
# Upgrade package to latest
uv add --upgrade requests
# Show what would be upgraded
uv tree --outdated
# Install Python version
uv python install 3.12
# Install multiple versions
uv python install 3.11 3.12 3.13
# Install latest version
uv python install
# List installed versions
uv python list
# Find available versions
uv python list --all-versions
Pattern 9: Setting Python Version
# Set Python version for project
uv python pin 3.12
# This creates/updates .python-version file
# Use specific Python version for command
uv --python 3.11 run python script.py
# Create venv with specific version
uv venv --python 3.12
# Issue: uv not found
# Solution: Add to PATH or reinstall
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
# Issue: Wrong Python version
# Solution: Pin version explicitly
uv python pin 3.12
uv venv --python 3.12
# Issue: Dependency conflict
# Solution: Check resolution
uv lock --verbose
# Issue: Cache issues
# Solution: Clear cache
uv cache clean
# Issue: Lockfile out of sync
# Solution: Regenerate
uv lock --upgrade
Best Practices
Project Setup
Always use lockfiles for reproducibility
Pin Python version with .python-version
Separate dev dependencies from production
Use uv run instead of activating venv
Commit uv.lock to version control
Use --frozen in CI for consistent builds
Leverage global cache for speed
Use workspace for monorepos
Export requirements.txt for compatibility
Keep uv updated for latest features
Performance Tips
# Use frozen installs in CI
uv sync --frozen
# Use offline mode when possible
uv sync --offline
# Parallel operations (automatic)
# uv does this by default
# Reuse cache across environments
# uv shares cache globally
# Use lockfiles to skip resolution
uv sync --frozen # skips resolution
Migration Guide
From pip + requirements.txt
# Before
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# After
uv venv
uv pip install -r requirements.txt
# Or better:
uv init
uv add -r requirements.txt
From Poetry
# Before
poetry install
poetry add requests
# After
uv sync
uv add requests
# Keep existing pyproject.toml
# uv reads [project] and [tool.poetry] sections
From pip-tools
# Before
pip-compile requirements.in
pip-sync requirements.txt
# After
uv lock
uv sync --frozen
Command Reference
Essential Commands
# Project management
uv init [PATH] # Initialize project
uv add PACKAGE # Add dependency
uv remove PACKAGE # Remove dependency
uv sync # Install dependencies
uv lock # Create/update lockfile
# Virtual environments
uv venv [PATH] # Create venv
uv run COMMAND # Run in venv
# Python management
uv python install VERSION # Install Python
uv python list # List installed Pythons
uv python pin VERSION # Pin Python version
# Package installation (pip-compatible)
uv pip install PACKAGE # Install package
uv pip uninstall PACKAGE # Uninstall package
uv pip freeze # List installed
uv pip list # List packages
# Utility
uv cache clean # Clear cache
uv cache dir # Show cache location
uv --version # Show version