-
Notifications
You must be signed in to change notification settings - Fork 906
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
[To discuss] @node
decorator syntax
#2471
Comments
@node
decorator syntax@node
decorator syntax
Some folks on my team have been doing this for a while and it's pretty ergonomic. A basic implementation is trivial, just from kedro.pipeline import node
def make_node(**kwargs):
return lambda func: node(func=func, **kwargs) |
Copying here my comments from #2408. As noted already, there's a problem here if you want to reuse the same function in multiple nodes and when you start using modular pipelines. These are not insurmountable with the decorator approach but it does get cumbersome. That said, I actually think there's potentially a lot of value in the decorator method for simple projects. Just like auto-registration of pipelines, anything we can do to make it easier for people to make a simple project is good in my book. Certainly just slapping a In fact, a while ago there was a QB tool that did something similar and took the simplification even further:
I actually think there's a lot to be said for at least some aspects of this approach, although it won't ever replace the current system. |
This is a reasonable default, but I suspect this is less scalable as you are likely to use a generic variable name like
this is my favourite part, It's sometimes annoying to search over 10 pipelines.py.
|
Definitely agree with @antonymilne , this functionality definitely would not replace the existing scheme, just act as sugar for what I suspect is a decent chunk of use cases. The possibility to automatically infer names and arguments would be slick. |
Just coming back to it again, it may be quite useful for learning kedro smoothing. I have been teaching some people about Kedro lately and sometimes they get stuck about how to write a node , then I will ask "forget about Kedro, how would you write it in normal python script?". Suddenly they can write the code properly and then just map it to Kedro. I suspect this happen more for beginner when they trying to jump too fast and think about node. @astrojuanlu Have you ever encountered this, is it worth to check with other people who teaches Kedro? |
Originally posted by @mle-els in #2726 (comment) |
I think it's safe to say that the current approach will not go away for the time being, so the question would be whether to maintain this as an alternative, recommended approach. And from that perspective, it looks like a lot of documentation and maintainability effort, plus the potential confusion of users having to pick between the two approaches, all of this for little gain. There have been some very valid concerns about this approach, most importantly that it blends functions with nodes and that hampers reusability of said functions by coupling them to Kedro. I'm closing this issue, if you disagree and think this deserves further discussion feel free to leave a comment. |
Introduction
ChatGPT once suggested this syntax to a user
Is this a syntax we'd like to add to Kedro?
The text was updated successfully, but these errors were encountered: