A step-by-step learning repo for building command-line interfaces in Python using sys.argv and argparse, ending with two packaged, production-style CLI projects.
Lesson1/— minimalArgumentParsersetupLesson2/—sys.argvbasics + motivation forargparseLesson3/— coreargparsepatterns (positional/optional args, flags)Lesson4/— argument groups,metavar, custom validatorsLesson5/— advanced patterns (exclusive groups, subcommands, shared options)Lesson6/— robust error handling + 2 deployable projects
Each lesson folder contains a README.md with runnable examples.
Lesson6/text_processor/— packaged CLItextproc(text transformations)Lesson6/todo-manager/— packaged CLItodo(persistent todo manager)
- Install Python (3.x recommended)
- Run scripts from inside each lesson folder, e.g.:
python some_script.py --help- This repo ignores virtual environments, Python caches, and
.envfiles via.gitignore. - Example env templates like
.env.exampleare allowed.