Command line programs for busy developers
summary
Survey compares getopt optparse argparse and PyPI tools like Click, Cliff, Docopt and shows a concrete Twitter client example with three subcommands (retweets mentions lists) accepting API tokens via flags or environment variables. Introduces Begins as a decorator-based layer over argparse that inspects function signatures to auto-generate options, defaults, boolean flags and type casting, adds logging and entry-point plugin loading, and runs in production today but remains beta with some missing explicit config-file and Windows test cases.
AI-written summary · about
chapters (20)
- 0:00Start
- 2:06Review Process
- 2:29Review Criteria
- 3:08Review Code
- 3:54getopt
- 4:28optparse
- 5:50argparse
- 6:36cliff
- 8:23docopt
- 9:53click
- 12:16Default Values
- 12:50Annotations for help
- 13:21Boolean Flags
- 13:43Sub-Commands
- 14:38Entry Points
- 15:06Multiple Commands
- 15:45Environment Variables
- 16:31Configuration Files
- 17:45Automatic Type Casting
- 18:31Logging
related talks
29mBuilding Nice Command Line Interfaces — A Look Beyond the stdlib
33mUpgrading Python CLIs From Scripts to Interactive Tools
37mLet's Make Better Command Line Applications
02h 28mBuilding human-first and machine-friendly CLI applications
25mThe Hitchhiker's Guide to CLIs in Python
28mThe Modern Command-Line Tool Stack: Pipenv, Click, and Friends
51mBuilding useful project utils in Python
27mHow to Write a Great Command Line Application
