Latch dynamically constructs the workflow interface based on the workflow function code and the LatchMetadata
object.
LatchMetadata
object:
metadata.parameters
must be the name of one of the parameters of the workflow function. Other keys will be ignored. Parameters without a corresponding key in metadata.parameters
will not be displayed.
{class}
~latch.types.metadata.LatchParameter
specifies the metadata associated with each workflow parameter.{class}
~latch.types.metadata.LatchAuthor
describes information about the workflow author.{class}
~latch.types.metadata.LatchRule
describes the rule that the parameter input must follow.flow
parameter of the {class}
~latch.types.metadata.Metadata
specification, which is a list of flow elements. Some flow elements can have child flows. All flow elements can be arbitrarily nested.
{class}
~latch.types.metadata.Params
is the most basic flow element which displays the specified parameter widgets one after another. A parameter can be part of any number of {class}
~latch.types.metadata.Params
elements. The default workflow layout is equivalent to flow=[Params("first_param", "second_param", ...)]
{class}
~latch.types.metadata.Title
and {class}
~latch.types.metadata.Text
are decorative flow elements that display a string of title and body text respectively. These elements have full markdown support. They are most often used to explain a parameter or group parameters without cluttering the UI as much as a {class}
~latch.types.metadata.Section
{class}
~latch.types.metadata.Section
displays a child flow in a card with a given title. This is the basic building block of most UIs{class}
~latch.types.metadata.Spoiler
displays a child flow in a collapsible card with a given title. The spoiler is collapsed by default. This is often used for hiding away parts of the UI that will not be useful to the majority of users{class}
~latch.types.metadata.Fork
shows a set of mutually-exclusive alternatives. The alternatives are specified as a list of {class}
~latch.types.metadata.ForkBranch
, each of which displays a child flow when active and nothing otherwise. Each branch is identified by a unique key. This key is passed to the workflow is a str
-typed parameter so the user selection can be used to change runtime behavior