Reviewed 6 September 2026

Part II: Practices

Command-line interfaces and single-file scripts

Library Notes
argparse Stdlib. Sufficient for a handful of flags. Colour output added in 3.14.
Typer Builds on Click; derives parameters, types and help from function signatures.
Click Decorator-based. Ships CliRunner for invoking commands in-process from tests.
Cyclopts Type-hint-driven alternative to Typer with different conventions for parameter binding.
Rich Terminal output formatting; integrates with Typer and Click.

PEP 723 allows a single file to declare its interpreter requirement and dependencies inline:

# /// script
# requires-python = ">=3.13"
# dependencies = ["httpx", "rich"]
# ///

uv run script.py provisions an ephemeral environment from that block. This removes the need for a separate requirements file or a pre-existing virtual environment for standalone scripts, which is the common case for repository tooling in projects whose main language is not Python.

CLI applications are published as packages with a [project.scripts] entry point and installed with uv tool install or pipx.

References