Week 15 of 16

Watch & Read: CLI Frameworks

Learn Typer — the modern way to build command-line tools in Python.

Day 71 45 minutes Watch + Read

Day 71 of 80

Why a CLI Tool Instead of input()?

Your scripts have used input() for user interaction. That works when you're using a tool interactively. But real automation is different.

Imagine generating prompts for 20 shots from a CSV file. With input(): type each one manually, wait, type the next. With a CLI tool:

python dvp.py batch my_shots.json --save

One command. All 20 shots. All platforms. Done in seconds. That's automation — and that's what CLI tools unlock.

CLI tools also integrate with shell scripts, cron jobs, and other tools. input() can't do that.

Watch

Video: ArjanCodes — Build Professional CLI Apps with Typer (~20 min)

Build Professional CLI Apps with Typer — ArjanCodes. Covers the core concepts: creating a Typer app, commands, arguments, options, and help text generation.

ArjanCodes is your teacher for Week 15. His style is denser than Corey Schafer — less hand-holding, more professional patterns. You're ready for it.

Read

Typer Official Tutorial — First 3 Sections

Read these three sections from the Typer Official Tutorial:

  1. First Steps — creating a basic command
  2. CLI Arguments — required positional inputs
  3. CLI Options — optional flags with defaults

Typer was built by the same developer as FastAPI. The design philosophy is the same: use Python type hints to define behavior, and the framework generates validation, help text, and shell completion automatically.

Key Concepts

Arguments vs. Options
# In CLI tools, there are two kinds of inputs:

# ARGUMENT — required, positional.
# python dvp.py generate "Golf swing at sunset"
#                         ^^^^^^^^^^^^^^^^^^^^ this is an argument

# OPTION — optional, named with --flag.
# python dvp.py generate "Golf swing" --platforms Kling,Runway --save
#                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ these are options

import typer
app = typer.Typer()

@app.command()
def generate(
    shot: str,                          # required argument — no default
    platforms: str = typer.Option("Kling,Runway,Veo"),  # optional flag
    save: bool = typer.Option(False),   # --save flag
):
    """Generate AI prompts for a shot."""
    typer.echo(f"Generating for: {shot}")
Help Text is Automatic

The docstring becomes the command's help text. Type annotations and Option() definitions generate the options list. Run any Typer command with --help and you get a full usage guide — for free, without writing it yourself.

python dvp.py generate --help
# Outputs something like:
#
# Usage: dvp.py generate [OPTIONS] SHOT
#
#   Generate AI prompts for a shot.
#
# Arguments:
#   SHOT  [required]
#
# Options:
#   --platforms TEXT       [default: Kling,Runway,Veo]
#   --save / --no-save     [default: no-save]
#   --help                 Show this message and exit.
Multiple Commands in One App
app = typer.Typer(name="dvp", help="DVP Prompt Vault tools.")

@app.command()
def list(): ...

@app.command()
def generate(): ...

@app.command()
def search(): ...

# Run them:
# python dvp.py list
# python dvp.py generate "Golf swing"
# python dvp.py search golf
# python dvp.py --help  (shows all commands)

Install Typer

pip install typer

End of Day Checklist

Tomorrow

Day 72 builds a simple Typer CLI to get your hands on it before building the full DVP tool.