Skip to content

API reference

Roadshow includes the Typer CLI and Rich renderer, with py-buzz as its error base.

Core

roadshow.core

Discover, inspect, and capture Python demo functions.

DemoDetails dataclass

Store the displayable parts of a demo function.

DemoResult dataclass

Store output and failures captured while running a demo.

succeeded property
succeeded: bool

Return whether the demo completed without an error or nonzero exit.

capture_demo

capture_demo(
    function: DemoFunction,
    *,
    input_text: str | None = None,
    input_lines: Sequence[str] | None = None,
    argv: Sequence[str] | None = None,
    isolate_home: bool = True,
) -> DemoResult

Run a demo while capturing standard streams, input, and process exit.

decompose_demo

decompose_demo(function: DemoFunction) -> DemoDetails

Extract a demo function's docstring and executable body.

demo

demo(
    feature: str,
    *,
    before: Callable[[], object] | None = None,
    after: Callable[[], object] | None = None,
    input_text: str | None = None,
    input_lines: Sequence[str] | None = None,
    argv: Sequence[str] = (),
) -> Callable[[DemoFunction], DemoFunction]

Mark a function as a demo and attach its feature, hooks, and input fixtures.

discover_demos

discover_demos(module: ModuleType) -> list[DemoFunction]

Return featured demo functions defined in a module, sorted by name.

Application

roadshow.app

Build and run tagged demo applications.

Roadshow

Discover tagged demos in a package and expose them through a Typer CLI.

__init__
__init__(
    package: str | ModuleType, *, title: str | None = None
)

Create a Roadshow app for one package or module.

discover
discover() -> dict[str, list[DemoFunction]]

Import the package's modules and group their demos by feature tag.

run
run() -> None

Start the Typer CLI for this Roadshow app.

start
start(
    feature: Annotated[
        list[str] | None,
        Option(
            "--feature",
            "-f",
            help="Features to run. Repeat this option to select multiple features; omit it to run all features.",
        ),
    ] = None,
    non_interactive: Annotated[
        bool,
        Option(
            "--non-interactive",
            help="Run all selected demos without prompts.",
        ),
    ] = False,
) -> None

Run the selected demo features and report captured failures.

get_standalone_module

get_standalone_module() -> ModuleType

Return the main module for standalone demo discovery.

Rendering

roadshow.render

Render demo descriptions and captured output with Rich.

display_demo

display_demo(
    function: DemoFunction,
    console: Console,
    *,
    label: str | None = None,
    input_text: str | None = None,
    input_lines: Sequence[str] | None = None,
    argv: Sequence[str] | None = None,
    isolate_home: bool = True,
    progress: tuple[int, int] | None = None,
) -> DemoResult

Display a demo and its captured result, optionally showing progress in the outer panel.