ENH: Add pre- and post-processing with NestedPipeFunc classmethod decorator#595
ENH: Add pre- and post-processing with NestedPipeFunc classmethod decorator#595LennartGevers wants to merge 2 commits intopipefunc:mainfrom
NestedPipeFunc classmethod decorator#595Conversation
NestedPipeFunc classmethod decorator
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match the correct format. Thank you! |
CodSpeed Performance ReportMerging #595 will not alter performanceComparing Summary
|
|
Good idea to make a PR early to get some eyes on it! 👀 I like the idea of making I have starred at the example for a while now but I need some help understanding it. here for example re:
re:
Is this example you wrote correct? If so, I do not understand what is going on or the logic 😅 Perhaps I need some fresh eyes before I understand it 😂 |
|
Alright, no actually I think this confirms my suspicion that this logic is yet a bit to cumbersome. |
|
I actually think it's better to drop this overwrites feature and only rely on renames defined by the user to achieve the same results. I think that is where I make it too complicated |
I wanted to share some of my progress on #565
Feature Idea/Request: Macro for Pre- and Post-process steps of a PipeFunc.for some feedback.It's still WIP ATM I justed wanted to outline my current idea of the feature and see wether it works. (So don't mind the
process_funcfunction defined within the classmethod. Also, all of the names are not final ofc).I actually had some iterations on the design of this feature but now came up with the
@NestedPipeFunc.inject()decorator.It's a bit more generalized and flexible than
@NestedPipeFunc.wrap(pre=my_pre, post=my_post)but also more compact and can actually serve several purposes.The decorator can be used to add pre- and post process up/downstream nodes to a
PipeFunclike below:But the catch is that because
NestedPipeFunc.injectjust accepts a list of Pipefuncs/Callables, one can actually use it to manage reuseable subroutines/subpipelines. This is quite simmilar to Hamiltonssubdagdecorator but also includes thepipe.inputandpipe.outputfeature.Maybe I'd also implement that one can pass default values to NestedPipeFunc.inject in order to set default values of those subroutines, like
to make the usage of subroutines more flexible.
I'm not settled with the names
input_overwritesandoutput_overwrites, I think there might be terms which are suited better and would convey the idea of the feature better.