Kino.Output (Kino v0.1.3) View Source
A number of output formats supported by Livebook.
Link to this section Summary
Types
An empty output that should be ignored whenever encountered.
Livebook cell output may be one of these values and gets rendered accordingly.
Interactive data table.
Standalone text block.
Regular text, adjacent such outputs can be treated as a whole.
Interactive Vega-Lite graphic with data streaming capabilities.
Vega-Lite graphic.
Functions
Returns text_block/0
with the inspectd term.
Link to this section Types
Specs
ignored() :: :ignored
An empty output that should be ignored whenever encountered.
Specs
t() :: ignored() | text_inline() | text_block() | vega_lite_static() | vega_lite_dynamic() | table_dynamic()
Livebook cell output may be one of these values and gets rendered accordingly.
Specs
table_dynamic() :: {:table_dynamic, pid()}
Interactive data table.
There should be a server process that serves data requests, filtering, sorting and slicing data as necessary.
Communication protocol
A client process should connect to the server process by sending:
{:connect, pid()}
And expect the following reply:
@type column :: %{
key: term(),
label: binary()
}
{:connect_reply, %{
name: binary(),
columns: list(column()),
features: list(:refetch | :pagination | :sorting)
}}
The client may then query for table rows by sending the following requests:
@type rows_spec :: %{
offset: non_neg_integer(),
limit: pos_integer(),
order_by: nil | term(),
order: :asc | :desc,
}
{:get_rows, pid(), rows_spec()}
To which the server responds with retrieved data:
@type row :: %{
# An identifier, opaque to the client
id: term(),
# A string value for every column key
fields: list(%{term() => binary()})
}
{:rows, %{
rows: list(row()),
total_rows: non_neg_integer(),
# Possibly an updated columns specification
columns: :initial | list(column())
}}
Specs
text_block() :: {:text, binary()}
Standalone text block.
Specs
text_inline() :: binary()
Regular text, adjacent such outputs can be treated as a whole.
Specs
vega_lite_dynamic() :: {:vega_lite_dynamic, pid()}
Interactive Vega-Lite graphic with data streaming capabilities.
There should be a server process responsible for communication with subscribers.
Communication protocol
A client process should connect to the server process by sending:
{:connect, pid()}
And expect the following reply:
{:connect_reply, %{spec: map()}}
The server process may then keep sending one of the following events:
{:push, %{data: list(), dataset: binary(), window: non_neg_integer()}}
Specs
vega_lite_static() :: {:vega_lite_static, spec :: map()}
Vega-Lite graphic.
spec
should be a valid Vega-Lite specification, essentially
JSON represented with Elixir data structures.
Link to this section Functions
Specs
Returns text_block/0
with the inspectd term.
Specs
See table_dynamic/0
.
Specs
See text_block/0
.
Specs
See text_inline/0
.
Specs
See vega_lite_dynamic/0
.
Specs
See vega_lite_static/0
.