pyiron / pyiron_workflow

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

[patch] Give every node `SingleValue` power #255

Closed liamhuber closed 3 months ago

liamhuber commented 3 months ago

Pulls SingleValue functionality out and let all nodes inherit from it as a new mixin. This allows us to use all the node injections on macros and workflows (as long as they only have one output channel), and means you don't need any special class to make a funciton "single value" -- as long as it's only got a single return value it will act this way be default. (That means we can even get rid of the SingleValue class, but that is a separate PR).

This change ran into an edge case where function nodes use self to store data. I solved this by adding new dict field to store it in -- since the field is pre-existing, we bypasses the getattr node injection. I actually like this, as adding state to function nodes was something to discourage to start with!

TODO:

Contributes to #243

Closes #155

Non-goals:

github-actions[bot] commented 3 months ago

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

codacy-production[bot] commented 3 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.10% (target: -1.00%) :white_check_mark: 97.62%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (b96ab3d86be163359f25faa570bc6c9db87b4715) | 3284 | 2870 | 87.39% | | | Head commit (b1ad266650e2d88dfc1cef7572bcd8975059ae27) | 3303 (+19) | 2890 (+20) | 87.50% (**+0.10%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#255) | 84 | 82 | **97.62%** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

review-notebook-app[bot] commented 3 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB