Python argparse Command-Line Interfaces Cheat Sheet
Design testable Python command-line interfaces with argparse positionals, options, subcommands, validation, defaults, help text, and controlled errors.
Open cheat sheetPython · 6 guides
Build command-line tools and work with files, processes, configuration, and archives.
Focused references
Each guide includes copy-ready syntax, detailed examples, and authoritative references.
Design testable Python command-line interfaces with argparse positionals, options, subcommands, validation, defaults, help text, and controlled errors.
Open cheat sheetRead TOML and INI configuration safely in Python with typed values, layered defaults, interpolation controls, validation, and version-aware standard-library APIs.
Open cheat sheetWork safely with Python pathlib, text and binary files, directory traversal, globbing, JSON, temporary files, and atomic replacement.
Open cheat sheetHandle Python process signals, graceful shutdown, environment variables, child-process environments, platform differences, and startup configuration safely.
Open cheat sheetRun child processes safely in Python with argument lists, captured text, checked exit codes, timeouts, standard input, environments, and Popen communication.
Open cheat sheetCreate, inspect, stream, and safely extract ZIP and tar archives with Python, plus gzip, bz2, lzma, and zlib compression for files and bytes.
Open cheat sheet