pyiron/ironflow

Macros

Opened this issue · 1 comments

Be able to collapse multiple nodes into a macro node. After being collapsed only IO that is not sourced from/channeled to another node inside the macro should be exposed, e.g. with labels like subnode_name_1.input_name_4; subnode_name_3.input_name_0. It would also be great to then be able to generate the underlying node code from the macro, so that it can be saved to a module file, imported, registered, and used in other graphs later.

The main ryven author, Leon Thomm, has considered and rejected macros, at least for now. Personally, I think they're important/cool enough that we should push on them anyhow and one of ryven's comeptitors, PyGraph, does include support for 'subgraphs' -- i.e. macros, so I believe it is a soluble problem. I appreciate in particular, however, Leon Thomm's open question about how one should handle data vs exec flows.

One way we could get pseudo-macros quite easily is to introduce a new passing node that takes a script, node, and output value as input, and gives that output value as output. The script/node/output could probably even be automatically and sequentially populated with dropdown menus quite easily.

This is not a true macro as it would still require the user to force the different scripts to run, and would only work sequentially, but it does allow for using different tabs to focus on getting particular results, and then aggregating/using these results elsewhere at a more abstracted level.

Might be useful as a stopgap until we have real macros.