Skip to content

output

output

Output protocol for Marianne daemon — decouples execution from Rich console.

Replaces tight coupling to Rich Console with an abstract OutputProtocol. Implementations: - NullOutput: no-op for tests - StructuredOutput: structlog for daemon mode - ConsoleOutput: wraps Rich for CLI backwards compatibility

Classes

OutputProtocol

Bases: ABC

Abstract output for job execution feedback.

Replaces tight coupling to Rich Console. Implementations: - NullOutput: no-op for tests - StructuredOutput: structlog for daemon - ConsoleOutput: wraps Rich for CLI backwards compat

NullOutput

Bases: OutputProtocol

No-op output for testing.

StructuredOutput

StructuredOutput(*, event_bus=None)

Bases: OutputProtocol

Structured logging output for daemon mode.

Routes all output through structlog, producing structured JSON events that daemon consumers (SSE, gRPC, log aggregators) can parse.

Source code in src/marianne/daemon/output.py
def __init__(self, *, event_bus: EventBus | None = None) -> None:
    from marianne.core.logging import get_logger

    self._logger = get_logger("daemon.output")
    self._event_bus = event_bus

ConsoleOutput

ConsoleOutput(console=None)

Bases: OutputProtocol

Rich Console wrapper for CLI backwards compatibility.

Bridges the OutputProtocol to Rich Console, so the existing CLI can adopt the protocol without changing its visual output.

Source code in src/marianne/daemon/output.py
def __init__(self, console: Any | None = None) -> None:
    if console is None:
        from rich.console import Console

        console = Console()
    self._console = console