Skills · Coding

Uv Package Manager

Unverified28/40

Master the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
Cursor·UnknownWe have not crawled the repo tree, so we will not guess
Codex·UnknownWe have not crawled the repo tree, so we will not guess
Gemini CLI·UnknownThe spec defines no detection rule for Gemini
Copilot·UnknownWe have not crawled the repo tree, so we will not guess
npx agentalley add uv-package-manager

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Master the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.

The whole source

No sign-in, no blur, nothing truncated
uv-package-manager/SKILL.md346 lines6.9 KBRawView on GitHub
Frontmatter — 2 properties
nameuv-package-manager
descriptionMaster the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.
1---
2name: uv-package-manager
3description: Master the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# UV Package Manager
7 
8Comprehensive guide to using uv, an extremely fast Python package installer and resolver written in Rust, for modern Python project management and dependency workflows.
9 
10## When to Use This Skill
11 
12- Setting up new Python projects quickly
13- Managing Python dependencies faster than pip
14- Creating and managing virtual environments
15- Installing Python interpreters
16- Resolving dependency conflicts efficiently
17- Migrating from pip/pip-tools/poetry
18- Speeding up CI/CD pipelines
19- Managing monorepo Python projects
20- Working with lockfiles for reproducible builds
21- Optimizing Docker builds with Python dependencies
22 
23## Core Concepts
24 
25### 1. What is uv?
26 
27- **Ultra-fast package installer**: 10-100x faster than pip
28- **Written in Rust**: Leverages Rust's performance
29- **Drop-in pip replacement**: Compatible with pip workflows
30- **Virtual environment manager**: Create and manage venvs
31- **Python installer**: Download and manage Python versionsA4This skill pulls in web or user content but never says to treat that content as data. A signal, not proof.
32- **Resolver**: Advanced dependency resolution
33- **Lockfile support**: Reproducible installations
34 
35### 2. Key Features
36 
37- Blazing fast installation speeds
38- Disk space efficient with global cache
39- Compatible with pip, pip-tools, poetry
40- Comprehensive dependency resolution
41- Cross-platform support (Linux, macOS, Windows)
42- No Python required for installation
43- Built-in virtual environment support
44 
45### 3. UV vs Traditional Tools
46 
47- **vs pip**: 10-100x faster, better resolver
48- **vs pip-tools**: Faster, simpler, better UX
49- **vs poetry**: Faster, less opinionated, lighter
50- **vs conda**: Faster, Python-focused
51 
52## Installation
53 
54### Quick Install
55 
56```bash
57# macOS/Linux
58curl -LsSf https://astral.sh/uv/install.sh | shA1Downloads and executes without reading first
59 
60# Windows (PowerShell)
61powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
62 
63# Using pip (if you already have Python)
64pip install uv
65 
66# Using Homebrew (macOS)
67brew install uv
68 
69# Using cargo (if you have Rust)
70cargo install --git https://github.com/astral-sh/uv uv
71```
72 
73### Verify Installation
74 
75```bash
76uv --version
77# uv 0.x.x
78```
79 
80## Quick Start
81 
82### Create a New Project
83 
84```bash
85# Create new project with virtual environment
86uv init my-project
87cd my-project
88 
89# Or create in current directory
90uv init .
91 
92# Initialize creates:
93# - .python-version (Python version)
94# - pyproject.toml (project config)
95# - README.md
96# - .gitignore
97```
98 
99### Install Dependencies
100 
101```bash
102# Install packages (creates venv if needed)
103uv add requests pandas
104 
105# Install dev dependencies
106uv add --dev pytest black ruff
107 
108# Install from requirements.txt
109uv pip install -r requirements.txt
110 
111# Install from pyproject.toml
112uv sync
113```
114 
115## Virtual Environment Management
116 
117### Pattern 1: Creating Virtual Environments
118 
119```bash
120# Create virtual environment with uv
121uv venv
122 
123# Create with specific Python version
124uv venv --python 3.12
125 
126# Create with custom name
127uv venv my-env
128 
129# Create with system site packages
130uv venv --system-site-packages
131 
132# Specify location
133uv venv /path/to/venv
134```
135 
136### Pattern 2: Activating Virtual Environments
137 
138```bash
139# Linux/macOS
140source .venv/bin/activate
141 
142# Windows (Command Prompt)
143.venv\Scripts\activate.bat
144 
145# Windows (PowerShell)
146.venv\Scripts\Activate.ps1
147 
148# Or use uv run (no activation needed)
149uv run python script.py
150uv run pytest
151```
152 
153### Pattern 3: Using uv run
154 
155```bash
156# Run Python script (auto-activates venv)
157uv run python app.py
158 
159# Run installed CLI tool
160uv run black .
161uv run pytest
162 
163# Run with specific Python version
164uv run --python 3.11 python script.py
165 
166# Pass arguments
167uv run python script.py --arg value
168```
169 
170## Package Management
171 
172### Pattern 4: Adding Dependencies
173 
174```bash
175# Add package (adds to pyproject.toml)
176uv add requests
177 
178# Add with version constraint
179uv add "django>=4.0,<5.0"
180 
181# Add multiple packages
182uv add numpy pandas matplotlib
183 
184# Add dev dependency
185uv add --dev pytest pytest-cov
186 
187# Add optional dependency group
188uv add --optional docs sphinx
189 
190# Add from git
191uv add git+https://github.com/user/repo.git
192 
193# Add from git with specific ref
194uv add git+https://github.com/user/[email protected]
195 
196# Add from local path
197uv add ./local-package
198 
199# Add editable local package
200uv add -e ./local-package
201```
202 
203### Pattern 5: Removing Dependencies
204 
205```bash
206# Remove package
207uv remove requests
208 
209# Remove dev dependency
210uv remove --dev pytest
211 
212# Remove multiple packages
213uv remove numpy pandas matplotlib
214```
215 
216### Pattern 6: Upgrading Dependencies
217 
218```bash
219# Upgrade specific package
220uv add --upgrade requests
221 
222# Upgrade all packages
223uv sync --upgrade
224 
225# Upgrade package to latest
226uv add --upgrade requests
227 
228# Show what would be upgraded
229uv tree --outdated
230```
231 
232### Pattern 7: Locking Dependencies
233 
234```bash
235# Generate uv.lock file
236uv lock
237 
238# Update lock file
239uv lock --upgrade
240 
241# Lock without installing
242uv lock --no-install
243 
244# Lock specific package
245uv lock --upgrade-package requests
246```
247 
248## Python Version Management
249 
250### Pattern 8: Installing Python Versions
251 
252```bash
253# Install Python version
254uv python install 3.12
255 
256# Install multiple versions
257uv python install 3.11 3.12 3.13
258 
259# Install latest version
260uv python install
261 
262# List installed versions
263uv python list
264 
265# Find available versions
266uv python list --all-versions
267```
268 
269### Pattern 9: Setting Python Version
270 
271```bash
272# Set Python version for project
273uv python pin 3.12
274 
275# This creates/updates .python-version file
276 
277# Use specific Python version for command
278uv --python 3.11 run python script.py
279 
280# Create venv with specific version
281uv venv --python 3.12
282```
283 
284## Project Configuration
285 
286### Pattern 10: pyproject.toml with uv
287 
288```toml
289[project]
290name = "my-project"
291version = "0.1.0"
292description = "My awesome project"
293readme = "README.md"
294requires-python = ">=3.8"
295dependencies = [
296 "requests>=2.31.0",
297 "pydantic>=2.0.0",
298 "click>=8.1.0",
299]
300 
301[project.optional-dependencies]
302dev = [
303 "pytest>=7.4.0",
304 "pytest-cov>=4.1.0",
305 "black>=23.0.0",
306 "ruff>=0.1.0",
307 "mypy>=1.5.0",
308]
309docs = [
310 "sphinx>=7.0.0",
311 "sphinx-rtd-theme>=1.3.0",
312]
313 
314[build-system]
315requires = ["hatchling"]
316build-backend = "hatchling.build"
317 
318[tool.uv]
319dev-dependencies = [
320 # Additional dev dependencies managed by uv
321]
322 
323[tool.uv.sources]
324# Custom package sources
325my-package = { git = "https://github.com/user/repo.git" }
326```
327 
328### Pattern 11: Using uv with Existing Projects
329 
330```bash
331# Migrate from requirements.txt
332uv add -r requirements.txt
333 
334# Migrate from poetry
335# Already have pyproject.toml, just use:
336uv sync
337 
338# Export to requirements.txt
339uv pip freeze > requirements.txt
340 
341# Export with hashes
342uv pip freeze --require-hashes > requirements.txt
343```
344 
345For advanced workflows including Docker integration, lockfile management, performance optimization, tool comparison, common workflows, tool integration, troubleshooting, best practices, migration guides, and command reference, see [references/advanced-patterns.md](references/advanced-patterns.md)
346 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Coding