Join the Kedro community

Updated 2 months ago

Node declaration with function signature

Hey everyone,

I was wondering if there was a way to do the node declaration as follows:

pipelines/data.py

@node(inputs=..., outputs=...)
def preprocess(...):
    ...
The reason why i ask is because my nodes are growing and it is becoming a bit tiring to go import my function, do the kedro wiring and occasionally I have typos as i forgot about the function signature. Something like this would be quite nice to declare.

J
F
4 comments

we considered it at some point yes!

Thanks for the link. Useful read. I was wondering if this would make my functions work as normal if i am not using kedro. For instance, if i run a unit test on the function or import into a notebook and try to play with it? Current trick just returns a node object if im not missing anything?

yeah that's the tradeoff of using such decorator indeed. if you wanted to test them or play interactively with them, you'd need to access the underlying undecorated function. maybe using functools.wraps would do the trick.

it's the reason why we don't promote that syntax though

Add a reply
Sign up and join the conversation on Slack