Repository navigation
Bind dict node inputs by name in %load_node - #5858
Open
omaraldulimay wants to merge 1 commit into
Open
omaraldulimay wants to merge 1 commit into
omaraldulimay wants to merge 1 commit into
Conversation
The generated cells and call for a node declared with a dict of inputs used the positional order of node.inputs, which loses the argument names. Use the declared inputs so dict keys map to argument names, and build the call positionally up to the first gap and by keyword after, including keyword only arguments and **kwargs. Fixes kedro-org#5846 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Omar Aldulimay <120497558+omaraldulimay@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5846
%load_nodebound the inputs of a node declared with a dict of inputs by position instead of by argument name. Fornode(train, {"data": "raw", "seed": "params:seed"}, ...)withdef train(data, config=None, seed=0),params:seedwas loaded intoconfig. For keyword only arguments or**kwargsthe generated call failed withTypeError: too many positional arguments.Development notes
_get_node_bound_argumentsnow binds the declared inputs (node._inputs) instead ofnode.inputs. For dict inputs the latter is already a list in signature order and has lost the argument names._prepare_function_callwalks the function signature: positional parameters are passed by position up to the first gap, everything after the gap, keyword only parameters and**kwargsentries are passed by keyword. Dict keys that are not in the signature are handled through**kwargs._NodeBoundArguments.input_params_dictexpands**kwargsinto one variable per key.train:data = catalog.load("raw"),seed = catalog.load("params:seed"), calltrain(data, seed=seed)report(data, *, title): callreport(data, title=title)tests/ipython/test_ipython.py(skipped parameter, keyword only,**kwargs, list input regression). The 3 dict tests fail without the fix and pass with it.pytest tests/ipython: 88 passed, 1 skipped (pre-existing skip).ruff format --checkandmypy --stricton the changed module are clean.Developer Certificate of Origin
All commits are signed off.
Checklist
RELEASE.mdfileDrafted with the help of Claude Code and reviewed by me.
🤖 Generated with Claude Code