spec¶
- DependsType: TypeAlias = list[typing.Annotated[str, AfterValidator(func=<function _is_signal_slot>)] | typing.Annotated[dict[typing.Annotated[str, AfterValidator(func=<function _is_identifier>), AfterValidator(func=<function _not_reserved>)], typing.Annotated[str, AfterValidator(func=<function _is_signal_slot>)]], Len(min_length=1, max_length=1)]] | typing.Annotated[str, AfterValidator(func=<function _is_signal_slot>)]¶
Either an absolute identifier (which is treated as a positional-only arg) or a dict mapping as described in _DependsBasic.
Examples
```python def example(positional_only: int, /, another_arg: str) -> None:
return another_arg * positional_only
- zzz:
type: example depends: - a.value - another_arg: b.value
When a dependency is a scalar value passed to the first positional argument, it can be specified with a scalar reference to an absolute identifier. For example, if one wanted to return a scalar value from a return node, specify the dependency like this:
- yyy:
type: return depends: a.value
and to return the same value wrapped in a list…
- yyy:
type: return depends: - a.value
- class NodeInfo[source]¶
Metadata about the completed spec given the combination of a node spec and a node class.
The spec if purely static, the node class is mostly static, but some important properties - notably signals and slots - can be dynamic: i.e. the signals or slots of the node depend on the spec.
This metadata is primarily used in visualization or inspection of tubes, rather than at runtime
- pydantic model NodeSpecification[source]¶
Specification for a single processing node within a tube .yaml file.
- Config:
extra: str = forbid
serialize_by_alias: bool = True
- Fields:
- Validators:
drop_computed»all fields
- field depends: DependsType | None = None¶
Dependency specification for the node.
Can be specified as a simple mapping from this node’s input slots to another node’s output signals passed as kwargs, or as a flat list of node.signal identifiers that are passed as positional args.
- Validated by:
- field enabled: bool | AbsoluteIdentifier = True¶
If this flag is False, the node will not be initialized or included in the :meth:.Tube.graph.
Can also accept an input signal, and its truthiness determines whether the node is enabled.
- Validated by:
- field id: PythonIdentifier [Required]¶
The unique identifier of the node
- Constraints:
func = <function _not_reserved at 0x7299c2c81010>
- Validated by:
- field params: dict | None = None¶
Static kwargs to pass to this node, parameterized the signature of a function node, or by a TypedDict for a class node.
- Validated by:
- field stateful: bool | None = None¶
See
Node.stateful, explicitly set statefulness on a node, overriding its default. IfNone, use the default set on the node class.- Validated by:
- field type_: AbsoluteIdentifier [Required] (alias 'type')¶
Shortname of the type of node this configuration is for.
Subclasses should override this with a default.
- Constraints:
func = <function _is_absolute_identifier at 0x7299c2c80d50>
- Validated by:
- validator drop_computed » all fields[source]¶
Accept our own serialized output: nodeinfo is computed on dump but collides with
extra="forbid"when a dumped spec is re-validated (e.g. specs round-tripped through a GUI).
- validator enabled_is_bool_or_input » enabled[source]¶
If the “enabled” value is a string, it must be a reference to an input value