Skip to content

preflight

preflight

Rendering surface for PreflightReport.

The preflight package produces structured values; this module turns them into human- (and, eventually, agent-) readable output. Callers should use render_preflight_report and select the output mode via RenderMode.

Classes:

Name Description
PreflightRenderContext

Display-only context threaded into a preflight-report render call.

Functions:

Name Description
render_preflight_report

Render report to the given output mode.

PreflightRenderContext(config_path=None, data_source=None, artifact_dir=None, log_file=None, run_info=None) dataclass

Display-only context threaded into a preflight-report render call.

None of these fields are part of PreflightReport itself -- they are caller-supplied extras (usually from the CLI) that shape what auxiliary sections the renderer draws.

render_preflight_report(report, *, registry, context=None, mode=RenderMode.RICH, console=None)

Render report to the given output mode.

Parameters:

Name Type Description Default
report PreflightReport

The structured preflight report to render.

required
registry PreflightRegistry

The registry used to produce report. Supplies the per-check display metadata (label, category) and the panel ordering; the report itself only carries raw issues and statuses.

required
context PreflightRenderContext | None

Optional display-only context (paths, run info) that tells the renderer which auxiliary sections to emit.

None
mode RenderMode

Output format. Currently only RenderMode.RICH is implemented.

RICH
console Console | None

Only consulted for Rich output. Defaults to a new rich.console.Console.

None

Raises:

Type Description
NotImplementedError

If mode is a RenderMode value whose backend has not yet been implemented.

Source code in src/nemo_safe_synthesizer/tooling/preflight.py
def render_preflight_report(
    report: PreflightReport,
    *,
    registry: PreflightRegistry,
    context: PreflightRenderContext | None = None,
    mode: RenderMode = RenderMode.RICH,
    console: Console | None = None,
) -> None:
    """Render ``report`` to the given output ``mode``.

    Args:
        report: The structured preflight report to render.
        registry: The registry used to produce ``report``. Supplies the
            per-check display metadata (label, category) and the panel
            ordering; the report itself only carries raw issues and
            statuses.
        context: Optional display-only context (paths, run info) that
            tells the renderer which auxiliary sections to emit.
        mode: Output format. Currently only ``RenderMode.RICH`` is
            implemented.
        console: Only consulted for Rich output. Defaults to a new
            ``rich.console.Console``.

    Raises:
        NotImplementedError: If ``mode`` is a ``RenderMode`` value
            whose backend has not yet been implemented.
    """
    if context is None:
        context = PreflightRenderContext()

    if mode is RenderMode.RICH:
        from ._rich.preflight import render_rich

        render_rich(report, registry=registry, context=context, console=console)
        return

    raise NotImplementedError(f"Preflight render mode {mode!r} is not implemented yet.")