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 = [].
Converted and distributed by TomeVault — claim your Tome and manage your conversions.