
uv-run
Run Python scripts with uv (PEP 723 inline deps, --with for one-off deps). Use when running scripts without venv activation or needing one-off dependencies.
- Installs
- 307
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/laurigates/claude-plugins --skill uv-run- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads uv-run automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
UV Run
Run Python scripts with uv - no manual venv activation needed.
When to Use This Skill
| Use this skill when... | Use a focused sibling instead when... |
|---|---|
Running a one-off script with uv run script.py and no project context | Adding a long-lived dependency to a project — use uv-project-management |
Embedding PEP 723 inline metadata or --with deps into a self-contained script | Installing a global CLI tool (uv tool install / uvx) — use uv-tool-management |
| Executing project commands inside the project venv without manual activation | Authoring the project's pyproject.toml or lockfile — use uv-project-management |
Core Capabilities
- Direct execution:
uv run script.pyhandles environment automatically - Temporary dependencies:
uv run --with requests script.pyfor one-off needs - Inline dependencies: PEP 723 metadata blocks for self-contained scripts
- Ephemeral tools:
uvx toolruns CLI tools without installation
Essential Commands
Running Scripts
# Run script (uv manages environment automatically)
uv run script.py
# Run with arguments
uv run script.py --input data.csv --output results.json
# Run a specific module
uv run -m http.server 8000
# Run with specific Python version
uv run --python 3.12 script.py
Temporary Dependencies
Add dependencies for a single run without modifying project:
# Single dependency
uv run --with requests fetch_data.py
# Multiple dependencies
uv run --with requests --with rich api_client.py
# Version constraints
uv run --with 'requests>=2.31' --with 'rich>12,<14' script.py
# Combine with project dependencies
uv run --with pytest-benchmark pytest # Add benchmark to existing pytest
Inline Script Dependencies (PEP 723)
Create self-contained scripts with embedded dependencies:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests>=2.31",
# "rich>=13.0",
# ]
# ///
import requests
from rich import print
response = requests.get("https://api.github.com")
print(response.json())
Run directly:
uv run script.py
# Or make executable:
chmod +x script.py
./script.py
Managing Script Dependencies
# Initialize script with metadata
uv init --script example.py --python 3.12
# Add dependency to script
uv add --script example.py requests rich
# Lock script dependencies for reproducibility
uv lock --script example.py
Ephemeral Tool Execution (uvx)
Run CLI tools without installation:
# Run tool once
uvx pycowsay "Hello from uv!"
uvx httpie https://api.github.com
uvx ruff check .
# With specific version
uvx ruff@0.1.0 check .
# uvx is shorthand for:
uv tool run pycowsay "Hello"
Shebang Patterns
Self-Contained Executable Script
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["click", "rich"]
# ///
import click
from rich import print
@click.command()
@click.argument('name')
def hello(name):
print(f"[green]Hello, {name}![/green]")
if __name__ == "__main__":
hello()
Script with Python Version Requirement
#!/usr/bin/env -S uv run --script --python 3.12
# /// script
# requires-python = ">=3.12"
# dependencies = ["httpx"]
# ///
import httpx
# Uses Python 3.12+ features
When to Use Each Pattern
| Scenario | Approach |
|---|---|
| Quick one-off task | uv run --with pkg script.py |
| Reusable script | Inline deps (PEP 723) |
| Shareable utility | PEP 723 + shebang |
| Team collaboration | Inline deps + uv lock --script |
| Run CLI tool once | uvx tool |
| Project scripts | uv run (uses project deps) |
uvx vs uv run --with
uvx tool: Run a CLI tool without installation (e.g.,uvx ruff check .)uv run --with pkg: Run a script with temporary dependencies (e.g.,uv run --with requests script.py)
# Run a tool (CLI application)
uvx httpie https://api.github.com
# Run a script with dependencies
uv run --with httpx api_test.py
Profiling and Debugging
# CPU profiling
uv run python -m cProfile -s cumtime script.py | head -20
# Line-by-line profiling (temporary dependency)
uv run --with line-profiler kernprof -l -v script.py
# Memory profiling
uv run --with memory-profiler python -m memory_profiler script.py
# Real-time profiling (ephemeral tool)
uvx py-spy top -- python script.py
# Quick profiling
uv run --with scalene python -m scalene script.py
See Also
- uv-project-management - Project dependencies and lockfiles
- uv-tool-management - Installing CLI tools globally
- python-development - Core Python language patterns
References
- Official docs: https://docs.astral.sh/uv/guides/scripts/
- PEP 723: https://peps.python.org/pep-0723/
- Tools: https://docs.astral.sh/uv/guides/tools/
FAQ
What does the uv-run skill do?
Run Python scripts with uv (PEP 723 inline deps, --with for one-off deps). Use when running scripts without venv activation or needing one-off dependencies.
How do I install uv-run?
Run npx skills add https://github.com/laurigates/claude-plugins --skill uv-run in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/uv-run/ (personal) or .claude/skills/uv-run/ (project).
Which AI agents can use uv-run?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is uv-run safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains uv-run?
It is published by laurigates in laurigates/claude-plugins. It has 307 recorded installs.
More from laurigates/claude-plugins
python-code-quality
laurigates/claude-plugins
Python code quality with ruff and ty. Use when the user mentions ruff, ty, linting, formatting, type checking, or Python code style.
ruff-linting
laurigates/claude-plugins
Python linting with ruff. Fast linting, rule selection, auto-fixing, and config. Use when checking Python code quality, enforcing standards, or finding bugs.
python-testing
laurigates/claude-plugins
Python testing with pytest, coverage, fixtures, and mocking. Use when the user mentions pytest, unit tests, coverage, fixtures, mocking, or writing Python tests.
pytest-advanced
laurigates/claude-plugins
Advanced pytest: fixtures, markers, parametrization, parallel execution. Use when implementing test infrastructure, writing fixtures, or running with coverage.
uv-workspaces
laurigates/claude-plugins
Manage multi-package Python projects with uv workspaces. Use when the user mentions uv workspaces, Python monorepo, shared lockfiles, or member dependencies.
basedpyright-type-checking
laurigates/claude-plugins
Open the skill to read its SKILL.md instructions.
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.