Module

terminal

Kida terminal components.

Provides a FileSystemLoader for terminal component templates, and a convenience function to create a terminal-configured Environment.

Live rendering::

from kida.terminal import terminal_env, LiveRenderer, Spinner

env = terminal_env()
tpl = env.from_string(template_str, name="live")

with LiveRenderer(tpl) as live:
    live.update(status="building")
    time.sleep(1)
    live.update(status="done")

Progressive streaming::

from kida.terminal import terminal_env, stream_to_terminal

stream_to_terminal(template, context, delay=0.03)

Functions

terminal_env 1 Environment
Create an Environment pre-configured for terminal output. Convenience wrapper …
def terminal_env(**kwargs) -> Environment

Create an Environment pre-configured for terminal output.

Convenience wrapper that sets autoescape="terminal" and adds a loader for the built-in terminal component templates.

All keyword arguments are passed to Environment, including: ambiguous_width: Override character width for ambiguous Unicode symbols (1=narrow, 2=wide). Auto-detected if not specified.

Parameters
Name Type Description
**kwargs
Returns
Environment