Variables¶
Variables that YAML specs and pipelines can reference.
lumen.variables
¶
disallow_refs = {'allow_refs': False} if param2 else {}
module-attribute
¶
state = _session_state()
module-attribute
¶
Constant
¶
Bases:
Constant declares a constant value that can be referenced.
variable_type = 'constant'
class-attribute
¶
Cookie
¶
Bases:
Cookie variables reflect the value of a cookie in the request.
EnvVariable
¶
Bases:
EnvVariable fetches an environment variable that can be referenced.
Header
¶
Bases:
Header variables reflect the value of a request header.
MultiTypeComponent
¶
Bases:
MultiComponentType is the baseclass for extensible Lumen components.
A MultiTypeComponent can be resolved using the _get_type method
either by the name declared in the <component>_type attribute,
where the name of the component represent the immediate subclasses
of MultiTypeComponent. For example class View(MultiTypeComponent)
should define view_type for all its descendants to override.
Just as any other Component, MultiTypeComponent implements
methods to construct an instance from a specification, export the
specification of a component and the ability to validate a
component.
from_spec(spec)
classmethod
¶
to_spec(context=None)
¶
Exports the full specification to reconstruct this component.
Returns:
| Type | Description |
|---|---|
Resolved and instantiated Component object
|
|
validate(spec, context=None)
classmethod
¶
Validates the component specification given the validation context and the path.
Arguments
spec: dict | str The specification for the component being validated or a reference to the component. context: dict Validation context contains the specification of all previously validated components, e.g. to allow resolving of references.
Returns:
| Type | Description |
|---|---|
Validated specification.
|
|
Parameter
¶
Bases:
Parameter variables reflect the current value of a parameter.
URLQuery
¶
Bases:
URLQuery variables reflect the value of a URL query parameter.
UserInfo
¶
Bases:
UserInfo variables reflect a value in the user info returned by an OAuth provider.
Variable
¶
Bases:
Variable components declare values that can be referenced from other components.
The source of the Variable value can be anything from an
environment variable to a widget or URL parameter. Variable
components allow a concise way to configure other components and
make it possible to orchestrate actions across multiple
components.
default = param.Parameter(constant=True, doc='\n Default value to use if no other value is defined')
class-attribute
instance-attribute
¶
label = param.String(default=None, doc='\n Optional label override for variable. Used wherever the variable\n shows up in the UI.')
class-attribute
instance-attribute
¶
materialize = param.Boolean(default=False, constant=True, doc='\n Whether the variable should be inlined as a constant variable\n (in the Lumen Builder).')
class-attribute
instance-attribute
¶
panel
property
¶
Optionally returns a renderable component that allows controlling the variable.
required = param.Boolean(default=False, constant=True, doc='\n Whether the variable should be treated as required.')
class-attribute
instance-attribute
¶
secure = param.Boolean(default=False, constant=True, doc='\n Whether the variable should be treated as secure.')
class-attribute
instance-attribute
¶
value = param.Parameter(doc='\n The materialized value of the variable.')
class-attribute
instance-attribute
¶
variable_type = None
class-attribute
¶
as_materialized()
¶
If the variable is to be materialized by the builder this implements the conversion from a variable that references some external value to a materialized value.
from_spec(spec, variables=None)
classmethod
¶
Variables
¶
Bases:
Variables stores a number Variable types and mirrors their
values onto dynamically created parameters allowing other
components to easily watch changes in a variable.
add_variable(var)
¶
Adds a new variable to the Variables instance and sets up a parameter that can be watched.
Arguments
var: Variable | panel.widgets.Widget | param.Parameter The Variable to add to the Variables store.
create_variables()
classmethod
¶
from_spec(spec)
classmethod
¶
keys()
¶
panel(variables=None)
¶
Widget
¶
Bases:
Widget variables dynamically reflect the current widget value.
kind = param.String(default=None, constant=True, doc='\n The type of widget to instantiate.')
class-attribute
instance-attribute
¶
panel
property
¶
throttled = param.Boolean(default=True, constant=True, doc='\n If the widget has a value_throttled parameter use that instead,\n ensuring that no intermediate events are generated, e.g. when\n dragging a slider.')
class-attribute
instance-attribute
¶
value = self._widget.value
instance-attribute
¶
variable_type = 'widget'
class-attribute
¶
to_spec(context=None)
¶
Exports the full specification to reconstruct this component.
Returns:
| Type | Description |
|---|---|
Resolved and instantiated Component object
|
|
is_ref(value)
¶
Whether the value is a reference.
resolve_module_reference(reference, component_type=None)
¶
base
¶
Constant
¶
Bases:
Constant declares a constant value that can be referenced.
variable_type = 'constant'
class-attribute
¶
Cookie
¶
Bases:
Cookie variables reflect the value of a cookie in the request.
EnvVariable
¶
Bases:
EnvVariable fetches an environment variable that can be referenced.
Header
¶
Bases:
Header variables reflect the value of a request header.
Parameter
¶
Bases:
Parameter variables reflect the current value of a parameter.
URLQuery
¶
Bases:
URLQuery variables reflect the value of a URL query parameter.
UserInfo
¶
Bases:
UserInfo variables reflect a value in the user info returned by an OAuth provider.
Variable
¶
Bases:
Variable components declare values that can be referenced from other components.
The source of the Variable value can be anything from an
environment variable to a widget or URL parameter. Variable
components allow a concise way to configure other components and
make it possible to orchestrate actions across multiple
components.
default = param.Parameter(constant=True, doc='\n Default value to use if no other value is defined')
class-attribute
instance-attribute
¶
label = param.String(default=None, doc='\n Optional label override for variable. Used wherever the variable\n shows up in the UI.')
class-attribute
instance-attribute
¶
materialize = param.Boolean(default=False, constant=True, doc='\n Whether the variable should be inlined as a constant variable\n (in the Lumen Builder).')
class-attribute
instance-attribute
¶
panel
property
¶
Optionally returns a renderable component that allows controlling the variable.
required = param.Boolean(default=False, constant=True, doc='\n Whether the variable should be treated as required.')
class-attribute
instance-attribute
¶
secure = param.Boolean(default=False, constant=True, doc='\n Whether the variable should be treated as secure.')
class-attribute
instance-attribute
¶
value = param.Parameter(doc='\n The materialized value of the variable.')
class-attribute
instance-attribute
¶
variable_type = None
class-attribute
¶
as_materialized()
¶
If the variable is to be materialized by the builder this implements the conversion from a variable that references some external value to a materialized value.
from_spec(spec, variables=None)
classmethod
¶
Variables
¶
Bases:
Variables stores a number Variable types and mirrors their
values onto dynamically created parameters allowing other
components to easily watch changes in a variable.
add_variable(var)
¶
Adds a new variable to the Variables instance and sets up a parameter that can be watched.
Arguments
var: Variable | panel.widgets.Widget | param.Parameter The Variable to add to the Variables store.
create_variables()
classmethod
¶
from_spec(spec)
classmethod
¶
keys()
¶
panel(variables=None)
¶
Widget
¶
Bases:
Widget variables dynamically reflect the current widget value.
kind = param.String(default=None, constant=True, doc='\n The type of widget to instantiate.')
class-attribute
instance-attribute
¶
panel
property
¶
throttled = param.Boolean(default=True, constant=True, doc='\n If the widget has a value_throttled parameter use that instead,\n ensuring that no intermediate events are generated, e.g. when\n dragging a slider.')
class-attribute
instance-attribute
¶
value = self._widget.value
instance-attribute
¶
variable_type = 'widget'
class-attribute
¶
to_spec(context=None)
¶
Exports the full specification to reconstruct this component.
Returns:
| Type | Description |
|---|---|
Resolved and instantiated Component object
|
|