types

CONFIG_ID_PATTERN = '[\\w\\-\\/#]+'

Any alphanumeric string (w), as well as - - - / - # (to allow hierarchical IDs as well as fragment IDs).

Specficially excludes . to avoid confusion between IDs, paths, and python module names

May be made less restrictive in the future, will not be made more restrictive.

PythonIdentifier

A single valid python identifier and not one of the reserved identifiers.

See: https://docs.python.org/3.13/library/stdtypes.html#str.isidentifier

alias of Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)]

AbsoluteIdentifier
  • A valid python identifier, including globally accessible namespace like module.submodule.ClassName

OR - a name of a builtin function/type

alias of Annotated[str, AfterValidator(func=_is_absolute_identifier)]

DependencyIdentifier

A {node_id}.{signal} identifier.

The node_id part must be a valid {class}`.PythonIdentifier` .

alias of Annotated[str, AfterValidator(func=_is_signal_slot)]

ConfigID

A string that refers to a config file by the id field in that config

alias of Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern=’[\w\-\/#]+’)])]

ConfigSource

Union of all types of config sources

alias of Path | PathLike[str] | Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern=’[\w\-\/#]+’)])]

JsonStringable

Generic type that casts the inner type to a string when serializing as JSON

alias of Annotated[TStr, PlainSerializer(func=str, return_type=PydanticUndefined, when_used=json)]

class NodeSignal(node_id: NodeID, signal: SignalName)[source]

Hashable representation of a (node_id, signal_name) pair

node_id: Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)]

Alias for field number 0

signal: Annotated[str, AfterValidator(func=_is_identifier)]

Alias for field number 1

EventMap

Type that can be requested to get the raw events rather than event values. Keys are the slot ids that the events would be transformed and passed to.

alias of dict[Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)], Event]

class Name(name: str)[source]

Name of some node output

Examples

def my_function() -> Annotated[int, Name(“charlie”)]: …

name: str
valid_config_id(val: Any) TypeIs[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(pattern='[\\w\\-\\/#]+')])]][source]

Checks whether a string is a valid config id.

class RunnerContext[source]
runner: TubeRunner
tube: Tube
class EpochSegment(node_id, epoch)[source]
node_id: Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)] | Literal['tube']

Alias for field number 0

epoch: int

Alias for field number 1

class Epoch(epoch: int | Iterable[EpochSegment])[source]
make_subepochs(node_id: Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)], n: int) list[Epoch][source]

Make n subepochs for the current epoch.

property parent: Epoch | None

If a subepoch, return the parent epoch. If the root epoch, return None

property parents: tuple[Epoch, ...]
property root: Epoch

The root epoch - self if epoch is not a subepoch, otherwise top-most parent