-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creator on the node object #58
Comments
I very much like the idea. It should be rather easy to realize this concept once we have ontologic typing included. A quick fix that would work with the present implementation would be to create node libraries that contain only specific nodes. For example, we could have a library atomistics.structure_to_structure were only nodes that take an input structure as an argument and which return a structure for further processing. Nodes that could be included in such a library would be |
Direct responseYeah, I like this idea! It is certainly possible, because we have exactly this over on ironflow with the node-suggestion menu. In fact, making something like this available early in the codebase would make it trivially easy to implement suggestion menus like ironflow has in a gui. @JNmpi, I fully agree it's much easier once we have ontological typing. I think we can have a weaker version already with the plain typing. The suggestions would sometimes be too broad with classical typing, i.e. you may require a surface structure and have a bulk structure creator recommended to you, but we can still do it. I would amend the original suggestion to say rather that channels should have a creator (or creator-like) object attached to them. I think showing all possible partners for an entire node is simply too broad. Of course, in the case of I would also suggest that if the type is not given, zero suggestions are shown rather than all of them. Finally, I also see room to extend this from creation to connection in the form of Pseudocode thoughtsIn this paradigm I would imagine all the following examples are identical: from pyiron_workflow import Workflow
wf = Worfklow("create_from_channels")
# ... register whatever packages we need
wf.structure = wf.create.atomistics.Bulk("Al")
wf.calc = wf.create.atomistic_codes.Lammps(structure=wf.structure)
Implementation thoughtsAs for implementation....that might be trickier. Not impossible, I don't think, just more work (EDIT: Ok, maybe impossible for macros without some serious changes in infrastructure and user behaviour). The main issue I see is that the IO channels don't actually exist until after instantiation -- so searching them at the class-level to instantiate compatible classes is tricky. You can't trivially instantiate channels on the classes themselves, or updates to the channels get propagate to all instances of that channel.
Since #53, we do store type hints at the class level, so one way around the meta-channel may be to simple directly parse those hints. (This works at the regular typing level -- for ontological typing we'd need to wait and see how we implement those hints.) Of course, those type hints are only available for function nodes. Macros are a whole different deal: we allow the The way to get make these things easier is to have classes explicitly define their IO at the class level, but doing this automatically (especially for macros) without ever having users even know what a class is becomes...difficult. Of course you can always make new functional nodes by subclassing In the short and medium term, Joerg's suggestion to logically group node is a good step to improve usability that doesn't require so much fancy infrastructure. |
I took the following lines from @JNmpi ’s example:
In current
pyiron_atomistics
,repeat
is attached tostructure
, which has a huge advantage that you have only the related items appear in the auto-complete list. I don’t know how difficult it would be, but I would like to follow the same spirit and havecreate
on the node level, so that we can setstructure.create.lammps.Repeat
, where on thelammps
level there are only items shown which can havestructure
as an argument. I don’t mind having to writestructure
explicitly in the argument. The object type should be parsed from the function, i.e. fromdef BulkNode(blablabla) -> pyiron_atomistics.atomistics.structure
. If the type is not given, it shows simply all possible entries.The text was updated successfully, but these errors were encountered: