Hi everyone, Given: ```node(pre_process, i...
# questions
m
Hi everyone, Given:
Copy code
node(pre_process, 
     inputs = ['dataset', 'params:pre_process'], 
     outputs = "pre_processed_dataset")
Kedro will pass
'params:pre_process'
as a dict to
pre_process
which results in a bit of an “opaque” function’s signature:
def pre_process(df: pd.DataFrame, params: dict): ...
Is there a “kedro way” of unpacking this dict and therefore have more “transparent” signature, with individual params specified ? Thx M
n
If your function take multiple arguments, why not pass specific parameters instead of the whole dict?
params:pre_process.key1
,
params:pre_process.key2
m
I guess I was feeling lazy 😅
The function actually has, per “clean-code” standards, too many params (7)… and I wanted the node definition itself to be as “uncluttered” as possible… More serioulsy: If the function signature change, with unpacking, I only need to modify the params file. While with “explicit” / hardcoded argument passing I’ll also need to refactor the node definition…
n
I guess what you are looking for is something like
**params:pre_process
, this is not a valid syntax
m
Exactly… I even “felt lucky” and gave it a shot, just in case 😉 Is the fact that it is non-valid syntax an “opinionated decision” ? Or is it simply because it hasn’t been implemented yet ?
n
I don’t have the context when this is implemented. My gut feeling is the former. I guess this is not too hard to create a helper in your node function.
Copy code
def node_func(params):
  target_func(**params)
Did I miss a clear solution for this? Cc @Juan Luis @datajoely
👍 1
j
yeah my guess is that this has never come up 😄 feel free to open an issue @Marc Gris!
👍 1
m
Thx ! Will do 🙂
i
n
Goal for this is making it easier to map Python func -> Node when possible while not breaking anything
d
The other related version of this you can’t override
**kwargs
in modular pipelines
n
What do you mean?