uv

Runs Python scripts and manages dependencies using the uv package manager.

Updated Feb 22, 2024
One-click install
npx skills add https://github.com/tlipoca9/dotfiles --skill uv-tlipoca9
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: uv
Source: https://github.com/tlipoca9/dotfiles/tree/main/home/dot_agents/skills/uv
Command: npx skills add https://github.com/tlipoca9/dotfiles --skill uv-tlipoca9

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It replaces the fragmented pip/python/venv toolchain with uv, so scripts run with correct dependencies and Python versions without manual virtualenv setup or pycache clutter. ## Core Features & Use Cases - Script Execution: Run scripts with uv run script.py, pass ad-hoc dependencies via --with, or target specific Python versions. - Inline Script Metadata: Declare requires-python and dependencies directly inside a standalone script, then lock them with uv lock --script for reproducibility. - Build Backend Guidance: Configure uv_build in pyproject.toml for pure Python packages, including src layouts, namespace packages, and file inclusion rules. - Use Case: You need to share a one-off data-fetching script with a colleague. Add inline metadata with httpx as a dependency, and they can run it directly with uv run or even as an executable via the uv shebang line. ## Quick Start Ask the AI to run your Python script with uv, declaring its dependencies inline so it executes reproducibly without creating a virtualenv.

Frequently Asked Questions about uv

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a Python script with dependencies using uv?▼

Run a script with `uv run script.py` and add ad-hoc dependencies using `uv run --with requests script.py`. For repeatable runs, declare dependencies in inline script metadata and uv resolves them automatically.

How to add dependencies to a standalone Python script?▼

Use inline script metadata: a comment block with requires-python and dependencies at the top of the file. Create it with `uv init --script foo.py` and add packages with `uv add --script foo.py requests`.

uv vs pip and venv for Python projects?▼

uv replaces pip, python, and venv with a single toolchain: `uv add` manages project dependencies and `uv run` executes scripts without manually activating virtualenvs. It also supports locking scripts via `uv lock --script`.

How do I check Python syntax without creating __pycache__?▼

Use the AST parser instead of py_compile: `uv run python -m ast script.py >/dev/null`. This parses the file to verify syntax without writing bytecode cache directories.

When should I use hatchling instead of uv_build?▼

Use uv_build for pure Python packages with the standard src layout. Switch to hatchling when your package contains extension modules, since uv_build only supports pure Python builds.

Can uv scripts use a custom package index?▼

Yes, run `uv add --index "https://example.com/simple" --script example.py requests` to add a dependency from an alternative index. The index URL is recorded in the script's inline metadata under tool.uv.index.