Help us improve
Share bugs, ideas, or general feedback.
From journalism-tools
Run Python scripts with automatic dependency management using uv. Use when executing Python code that may have package dependencies, when the user doesn't have a Python environment set up, or when you need isolated script execution without polluting system packages. Handles dependency installation automatically—no manual pip install or virtual environment setup required.
npx claudepluginhub nhagar/claude-plugins-journalism --plugin journalism-toolsHow this skill is triggered — by the user, by Claude, or both
Slash command
/journalism-tools:python-runnerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Execute Python scripts with automatic, isolated dependency management. No manual environment setup required.
Runs Python scripts with uv supporting PEP 723 inline dependencies, temporary --with packages, and ephemeral uvx tools. Use for quick script execution without virtualenvs.
Replaces pip, pip-tools, pipx, pyenv, virtualenv, and poetry for Python package and project management. Covers uv add, uv sync, uv run, uv init, build, publish, and workspace commands.
Share bugs, ideas, or general feedback.
Execute Python scripts with automatic, isolated dependency management. No manual environment setup required.
# Check if uv is available
uv --version
# Run script without dependencies
uv run script.py
# Run script with dependencies (installed automatically)
uv run --with pandas --with requests script.py
# Run with specific Python version
uv run --python 3.11 script.py
If uv is not installed, see references/install-uv.md.
Embed dependencies directly in the script so it's self-contained and reproducible:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pandas",
# "requests",
# ]
# ///
import pandas as pd
import requests
# ... rest of script
Then run with just:
uv run script.py
uv automatically creates an isolated environment with the declared dependencies.
Use uv add --script to add dependencies to an existing script:
# Add single dependency
uv add --script script.py pandas
# Add multiple with version constraints
uv add --script script.py 'requests<3' 'rich>=13'
This inserts/updates the # /// script metadata block at the top of the file.
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pandas",
# "openpyxl", # for Excel support
# ]
# ///
import pandas as pd
df = pd.read_excel("data.xlsx")
print(df.describe())
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "requests",
# "beautifulsoup4",
# "lxml",
# ]
# ///
import requests
from bs4 import BeautifulSoup
resp = requests.get("https://example.com")
soup = BeautifulSoup(resp.text, "lxml")
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pdfplumber",
# "pandas",
# ]
# ///
import pdfplumber
import pandas as pd
with pdfplumber.open("document.pdf") as pdf:
for page in pdf.pages:
tables = page.extract_tables()
| Option | Purpose | Example |
|---|---|---|
--with pkg | Add dependency for this run only | uv run --with rich script.py |
--python X.Y | Use specific Python version | uv run --python 3.11 script.py |
--no-project | Ignore pyproject.toml in directory | uv run --no-project script.py |
Arguments after the script name pass through to the script:
uv run script.py input.csv --output results.json
In the script:
import sys
print(sys.argv) # ['script.py', 'input.csv', '--output', 'results.json']
"uv: command not found"
→ uv not installed. See references/install-uv.md
Module not found errors
→ Add missing package to dependencies block or use --with
Wrong Python version
→ Specify version: uv run --python 3.11 script.py
→ Or add requires-python to script metadata
Script in a project directory picks up wrong dependencies
→ Use --no-project flag before script name