Overview

Typer 0.7, released on November 5, 2022, adds Rich integration support and improves type handling.

Main Features

Rich integration

Typer uses Rich for help display, error messages, and prompts, providing colorful and structured output.

python
import typer
from rich import print

app = typer.Typer(rich_markup_mode='rich')

@app.command()
def process(
    name: str = typer.Argument(help='[bold]File[/] name'),
):
    """Process a [green]file[/green]."""
    print(f'[bold green]Processing {name}...[/]')

Improved types

Better support for modern Python types: Enum, Path, optional types, and default values.

python
from enum import Enum
from pathlib import Path
import typer

class Format(str, Enum):
    json = 'json'
    csv = 'csv'

@typer.run
def convert(input: Path, fmt: Format = Format.json):
    typer.echo(f'{input} -> {fmt.value}')

Sources