pyiron_workflow.mixin.has_interface_mixins module

For interface specification.

There are cases where we want to be able to depend on the presence of a particular attribute or method, but care very little about its details – nothing beyond, perhaps, type hints. These mixins allow us to guarantee the presence of such interfaces while leaving their actual implementation up to other classes in order to have the weakest possible coupling between different components of a composed class.

class pyiron_workflow.mixin.has_interface_mixins.HasChannel[source]

Bases: ABC

A mix-in class for use with the Channel class and its children.

This is useful for letting channels attempt to connect to non-channel objects directly by pointing them to some channel that object holds.

abstract property channel: Channel
class pyiron_workflow.mixin.has_interface_mixins.HasLabel[source]

Bases: ABC

A mixin to guarantee the label interface exists.

property full_label: str

A more verbose label based off the underlying label attribute (and possibly other data) – in the root class, it’s just the same as the label.

property label: str

A label for the object.

class pyiron_workflow.mixin.has_interface_mixins.HasRun[source]

Bases: ABC

A mixin to guarantee that the run() method exists.

abstractmethod run(*args, **kwargs)[source]
class pyiron_workflow.mixin.has_interface_mixins.UsesState[source]

Bases: object

A mixin for any class using __getstate__() or __setstate__().

Guarantees that super() can always be called in these methods to return a copy of the state dict or to update it, respectively.