self-contained-python-script
// Write self-installing autocontained Python scripts using uv and PEP 723
$ git log --oneline --stat
stars:41
forks:8
updated:March 4, 2026
SKILL.mdreadonly
SKILL.md Frontmatter
nameself-contained-python-script
descriptionWrite self-installing self-contained Python scripts using uv and PEP 723
Use this to write Python tools / scripts / CLIs as single files.
- Add dependencies with
uv add --script foo.py httpx. - Run with
uv run foo.py. - If inline metadata is present,
uv runignores project dependencies automatically.
Use PEP 723 inline metadata and an executable shebang:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "httpx",
# ]
# ///
import httpx
dependenciesmust be present, even if empty:dependencies = [].