pyiron / pyiron_workflow

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

Storage: nodes from a package should know their package #152

Closed liamhuber closed 10 months ago

liamhuber commented 10 months ago

On loading a Macro, all children get instantiated -- if you can instantiate a Macro, you'll be able to load that Macro (barring an edge case where replace was used to change a child...this could perhaps be handled on the save side).

The same is not true for Workflow, whose children are created dynamically -- a newly instantiated Workflow is empty. Thus, any storage of the children will also need to store the source for those child classes so that necessary packages can be re-registered prior to loading, e.g. Node.package_identifier: str | None.

Whenever a node gets created by the creator, package info should be automatically included.

Loading a workflow where some of the nodes were local and not from a package is also an issue -- this could be resolved by hard-serializing the entire class, or by preventing saving, but like macros who have had a child replaced, this problem can be delayed and doesn't pertain directly to including package info when it exists.