yera.runtime.handlers.registry
Handler registry and render-environment detection for the Yera event rendering.
Symbols
detect_render_env
detect_render_env() → RenderEnvDetect the rendering environment for the current process.
Checks, in order: YERA_RENDERER env-var override, Jupyter kernel, Kitty-protocol terminal, then falls back to plain ANSI.
Returns
The detected RenderEnv.
EventHandlerRegistry
Maps block-type names to factories that construct their handlers.
Methods
EventHandlerRegistry.create
create(
block_type: str,
) → BaseHandlerConstruct a fresh handler for a single block.
A handler's lifetime is one block: the router constructs it when the
block opens and discards it when the block ends. Handlers therefore
hold per-block state directly rather than resetting it in __enter__.
Parameters
The event block type to look up.
Returns
A new handler, or a new fallback handler if unregistered.
EventHandlerRegistry.build
build(
env: RenderEnv | None = None,
console: Console | None = None,
web_render: WebRenderContext | None = None,
) → EventHandlerRegistryBuild a registry for the given target, auto-detecting if unspecified.
Parameters
Force a target. Defaults to auto-detection (env var override, then Jupyter, then Kitty, then ANSI).
The rich console object to use when printing to screen etc.
The render context to use when handling events -> HTMX.
RenderEnv
EnumSupported rendering environments for console output.