BUNDLE · tqdm · click · rich · tabulate · PyYAML · the ubiquitous CLI/terminal toolkit · verified 2026

Python CLI & terminal utils cheat sheet

Five small libraries that show up in almost every script & ML project: tqdm (progress bars), click (build CLIs), rich (beautiful terminal output — tables, color, tracebacks), tabulate (quick ASCII/Markdown tables), and PyYAML (read/write YAML config). One page for the 90% you actually use. Targets tqdm 4.7, click 8.x, rich 15, tabulate 0.9, PyYAML 6.

tqdm (progress) click (CLIs) rich (output) tabulate (tables) PyYAML (config) gotcha most common

Verified 2026-08-24 against the official docs/repos: tqdm.github.io, click.palletsprojects.com, rich.readthedocs.io, github.com/astanin/python-tabulate, pyyaml.org. All pure-Python and dependency-light.

Outline

Five independent tools. Jump to the one you need; the last card collects the cross-cutting gotchas (especially the PyYAML security one).

Progress & CLIs

  1. 1 · tqdm basics
  2. 2 · tqdm: manual, pandas, nested
  3. 3 · click: commands & options
  4. 4 · click: groups, prompts, types

Output

  1. 5 · rich: print, console, tables
  2. 6 · rich: progress, tracebacks, inspect
  3. 7 · tabulate

Config

  1. 8 · PyYAML
  2. 9 · Gotchas
  3. Worth memorizing

tqdm — Progress Bars

Wrap any iterable to get a live progress bar.

1tqdm basicsv4.7
2Manual, pandas, nestedbeyond loops

click — Build CLIs

Decorate functions into command-line interfaces.

3Commands & optionsv8
4Groups, prompts, typesreal CLIs

rich — Beautiful Output

Color, tables, progress, and gorgeous tracebacks.

5print, console, tablesv15
6Progress, tracebacks, inspectpower tools

tabulate — Quick Tables

One function, many formats — great for logs, READMEs & reports.

7tabulatev0.9

PyYAML — Config Files

Read & write YAML — safely.

8PyYAMLv6
!Common gotchasread before shipping

Worth memorizing

from tqdm.auto import tqdmworks in both terminal & notebook; wrap any iterable
tqdm.pandas() → progress_applyprogress bars for pandas
click: @command + @option/@argument@group for subcommands; click.echo not print
click types validateChoice, Path(exists=True), prompt=, is_flag
from rich import print[bold red]markup[/]; auto-pretty dicts
rich.traceback.install()gorgeous, readable tracebacks in one line
rich track() / Table / inspectprogress, styled tables, better dir()
tabulate(tablefmt="github")Markdown tables for READMEs/logs
yaml.safe_load, never yaml.loadload = arbitrary code execution