yera.runtime.blocks.table
Emit normalized tabular data with optional incremental row updates.
Initial data may come from a DataFrame-like object, dictionaries, nested lists,
or another supported iterable. The block normalizes columns and rows into a
target-independent payload. TableStream.add_rows() emits only new rows so
handlers can accumulate and update the displayed table.
Symbols
TableStream
_StreamHandleStream handle for a table block that supports incremental row additions.
Returned by yr.table() to enable add_rows() functionality.
Maintains table metadata (columns, border, block_id) and streams incremental
row updates to the frontend. The frontend accumulates these rows to build the
complete table state.
Methods
TableStream.__init__
__init__(
block_id: str,
columns: list[str],
border: bool | Literal['horizontal'],
)Initialize a table stream.
Parameters
Identity shared by table updates.
Ordered table column labels.
Requested border presentation.
TableStream.add_rows
add_rows(
data: object,
) → NoneAdd rows to the table, matching Streamlit's element.add_rows() behavior.
The first call to an empty table fixes the column schema from the incoming data; later calls align to it.
Supports:
- list of lists: each inner list is a row
- list of dicts: each dict becomes a row (keys should match existing columns)
- pandas DataFrame: adds all rows
- single list: treated as a single row
Parameters
Row-oriented values or a pandas-like data frame to append.
TableStream.__enter__
__enter__()Open the table block scope.
Returns
This active table stream.
TableStream.__exit__
__exit__(
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType,
)Close the table block scope.
Parameters
Type of exception leaving the context, if any.
Exception leaving the context, if any.
Traceback associated with the exception, if any.
Returns
False so exceptions propagate from the managed block.