pyiron / pyiron_workflow

Graph-and-node based workflows
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Callbacks as strings #174

Closed liamhuber closed 9 months ago

liamhuber commented 9 months ago

This is stacked on top of #160, but looks more complicated than it is because it also merged in #173. Once #173 is merged, just the 4 commits from 23 Jan will show here.

Basically we add the requirement that callback functions stored on InputSignal need to be methods of the node that owns them. In practice this has always been the case, so there is no real change, and since you can put whatever method you want on

Further, the requirement that callbacks be arg-free was already stated, but now we explicitly test for it and fail hard if it's violated.

Since the callback is now guaranteed to be a method of the owning InputSignal.node attribute, we can safely store its name in our state (a mere string) instead of storing the actual function object. This will make storage easier later.

github-actions[bot] commented 9 months ago

Binder :point_left: Launch a binder notebook on branch _pyiron/pyiron_workflow/callbacks_asstrings