core.cli

Classes

CLI

Base CLI with automatic component logging support.

Module Contents

class core.cli.CLI(component_name: str | None = None)

Base CLI with automatic component logging support.

Initialize the CLI with optional component logging.

Parameters:

component_name – Component name for automatic logging configuration (‘distributor’, ‘worker’, ‘server’, or None to disable)

parser
component_name = None
main(argstr: str | None = None) Any

Parse args and configure component logging before execution.

configure_component_logging() None

Configure logging for this component using existing infrastructure.

This method can be called directly when needed (e.g., by plugins that bypass the normal main() flow).

Configures both: 1. Standard logging (handlers, formatters, etc.) 2. Structlog (processors, context merging, OTLP integration)

parse_args(argstr: str | None = None) argparse.Namespace

Construct a parser, parse either sys.argv (default) or the provided argstr.

Returns a Namespace. The Namespace should have a ‘func’ attribute which can be used to dispatch to the appropriate downstream function.