Typer + Rich: Build Beautiful Modern CLIs in Python 2026

Modern Python Tools And Libraries May 13, 2026

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 --help automatically looks professional
  • Combine with Loguru for 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.

Share:
Last updated: May 2026
Built-in Functions in Python 2026 str() in Python 2026: String Conversion + Modern Formatting & Best Practices memoryview with JAX in Python 2026: Zero-Copy NumPy → JAX Array Interop + Efficient ML Examples memoryview with TensorFlow in Python 2026: Zero-Copy NumPy → Tensor Interop + GPU Pinning & ML Examples memoryview with TensorFlow in Python 2026: Zero-Copy NumPy → Tensor Interop + ML Examples memoryview with NumPy & PyTorch in Python 2026: Zero-Copy Views, Efficient Slicing & ML Interop Examples memoryview with NumPy in Python 2026: Zero-Copy Views, Efficient Slicing & Real ML Examples memoryview() in Python 2026: Zero-Copy Magic for Large Binary Data + Real Examples import() in Python 2026: How It Works, Security Risks & Modern Alternatives (importlib) zip() in Python 2026: How to Use It, strict=True Behavior & Real-World Examples vars() in Python 2026: Accessing Object Namespace + Modern Introspection Patterns type() in Python 2026: Dynamic Type Inspection & Object Creation + Modern Patterns tuple() in Python 2026: Immutable Sequences + Modern Patterns & Best Practices super() in Python 2026: Method Resolution & Modern Inheritance Patterns sum() in Python 2026: Summing Iterables + Modern Numeric Patterns & Best Practices staticmethod() in Python 2026: Static Methods, Utility Functions & Modern Best Practices sorted() in Python 2026: Sorting Iterables + Modern Patterns & Best Practices slice() in Python 2026: Creating Slice Objects + Modern Patterns & Best Practices setattr() in Python 2026: Dynamic Attribute Setting + Modern Patterns & Safety set() in Python 2026: Mutable Sets Creation + Modern Patterns & Best Practices