spec

DependsType

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

```

```yaml nodes:

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:

```yaml nodes:

yyy:

type: return depends: a.value

```

and to return the same value wrapped in a list…

```yaml nodes:

yyy:

type: return depends: - a.value

```

alias of list[Annotated[str, AfterValidator(func=_is_signal_slot)] | Annotated[dict[Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)], Annotated[str, AfterValidator(func=_is_signal_slot)]], Len(min_length=1, max_length=1)]] | Annotated[str, AfterValidator(func=_is_signal_slot)]

pydantic model NodeSpecification[source]

Specification for a single processing node within a tube .yaml file.

Show JSON schema
{
   "title": "NodeSpecification",
   "description": "Specification for a single processing node within a tube .yaml file.",
   "type": "object",
   "properties": {
      "type": {
         "title": "Type",
         "type": "string"
      },
      "id": {
         "title": "Id",
         "type": "string"
      },
      "depends": {
         "anyOf": [
            {
               "items": {
                  "anyOf": [
                     {
                        "type": "string"
                     },
                     {
                        "additionalProperties": {
                           "type": "string"
                        },
                        "maxProperties": 1,
                        "minProperties": 1,
                        "type": "object"
                     }
                  ]
               },
               "type": "array"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Depends"
      },
      "params": {
         "anyOf": [
            {
               "additionalProperties": true,
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Params"
      },
      "enabled": {
         "default": true,
         "title": "Enabled",
         "type": "boolean"
      },
      "stateful": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Stateful"
      },
      "description": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Description"
      }
   },
   "required": [
      "type",
      "id"
   ]
}

Fields:
Validators:
field depends: list[Annotated[str, AfterValidator(func=_is_signal_slot)] | Annotated[dict[Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)], Annotated[str, AfterValidator(func=_is_signal_slot)]], Len(min_length=1, max_length=1)]] | Annotated[str, AfterValidator(func=_is_signal_slot)] | 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 description: str | None = None

An optional description of the node

field enabled: bool = True

If this flag is False, the node will not be initialized or included in the :meth:.Tube.graph.

field id: Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)] [Required]

The unique identifier of the node

Constraints:
  • func = <function _not_reserved at 0x77de2d4389a0>

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.

field stateful: bool | None = None

See Node.stateful , explicitly set statefulness on a node, overriding its default. If None , use the default set on the node class.

field type_: Annotated[str, AfterValidator(func=_is_absolute_identifier)] [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 0x77de2d4385e0>

validator slots_unique  »  depends[source]

Ensure slots are unique in dependency spec: can’t map more than one signal to the same slot