Typer + Rich: Build Beautiful Modern CLIs in Python 2026 — Tired of ugly command-line tools? In 2026, the gold standard for building professional CLIs is the powerful combination of Typer (FastAPI for the terminal) and Rich (beautiful terminal output).
This duo gives you automatic help, type validation, progress bars, rich tables, colors, and markdown — all with clean, modern Python code.
1. Project Setup with uv + Ruff
uv init cli-tool --python 3.13
cd cli-tool
uv add typer rich
uv add --dev ruff pytest pre-commit
2. Basic Typer CLI
# main.py
import typer
from rich.console import Console
from rich.table import Table
from rich.progress import Progress
app = typer.Typer(
name="mytool",
help="A modern beautiful CLI tool built in 2026",
add_completion=True
)
console = Console()
@app.command()
def greet(name: str = "World", uppercase: bool = False):
"""Greet someone with style."""
greeting = f"Hello, {name}!"
if uppercase:
greeting = greeting.upper()
console.print(greeting, style="bold green")
3. Rich Tables & Progress Bars
@app.command()
def show_data():
"""Display sample data in a beautiful table."""
table = Table(title="2026 Python Projects")
table.add_column("Project", style="cyan")
table.add_column("Status", style="green")
table.add_column("Stars", justify="right")
table.add_row("uv", "Active", "12.4k")
table.add_row("Polars", "Active", "28.7k")
table.add_row("FastAPI", "Active", "75k")
console.print(table)
@app.command()
def process_files(count: int = 100):
"""Simulate processing with progress bar."""
with Progress() as progress:
task = progress.add_task("[green]Processing files...", total=count)
for i in range(count):
# Simulate work
import time
time.sleep(0.02)
progress.update(task, advance=1)
console.print("✅ All files processed successfully!", style="bold green")
4. Full Recommended Structure
cli-tool/
├── pyproject.toml
├── uv.lock
├── main.py
├── app/
│ ├── __init__.py
│ ├── cli.py
│ └── utils.py
└── tests/
5. Running & Installing
# Run directly
uv run main.py greet John --uppercase
# Install as editable package
uv pip install -e .
# Now use globally
mytool greet Alice
mytool show-data
mytool process-files 50
6. Best Practices in 2026
- Use Typer for argument parsing and help
- Use Rich for all output (tables, panels, markdown, syntax highlighting)
- Add
--helpautomatically looks professional - Combine with
Logurufor logging - Use type hints everywhere (Typer loves them)
- Add sub-commands for larger tools
Conclusion
Typer + Rich is the modern way to build CLIs in 2026. You get beautiful, professional-looking tools with minimal code — perfect for DevOps scripts, data tools, internal utilities, or open-source projects.
Stop building ugly CLIs. Start building tools people actually enjoy using.
💡 Pro Tip: Create a GitHub template repository with Typer + Rich + uv + Ruff so every new CLI starts with perfect setup.