-
Notifications
You must be signed in to change notification settings - Fork 910
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
Lazy load click subcommands #3883
Conversation
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Is this happening because the de-duplication process would mean you can't do lazy loading? IMO it's not ideal, but it's also not the worst. I think it's becoming clear that performance gains on the CLI loading will always have some downsides. We can always add some clarification in the docs on overwriting of commands and what a user should expect to see on the CLI side. |
project_group, | ||
registry_cli, | ||
] | ||
assert len(kedro_cli.project_groups) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful to update the test name or leave a comment explaining that the 1 command group loaded is everything that's not doing lazy loading.
Yeah, for a We could add information to this part of the help text (up top) saying if there's duplicate commands, the commands from the plugins will be used :
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question regarding testing: is it possible to trigger the lazy loading in the tests to make sure the lazy loaded commands to get loaded eventually?
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
I added a check if all the commands are being listed properly for the lazy group in 37764a7 |
```python | ||
if multiprocessing.get_start_method() == "spawn" and package_name: | ||
_bootstrap_subprocess(package_name, logging_config) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The secret scan test was complaining about the link ^ I added the code snippet instead. I hope that's okay? @noklam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this problem locally as well but it's all good now and the link seems correct and working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add this to the release notes. Otherwise looks all good to me 👍 🎉
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 🚀
Description
Fix #1476
Development notes
Lazy Loading of subcommands docs on
click
: https://click.palletsprojects.com/en/8.1.x/complex/#lazily-loading-subcommandskedro/framework/cli/cli.py
project_commands
: Point to project sub commands such asregistry
,catalog
,package
etcglobal_commands
: Point to the implementation ofnew
andstarter
commandsproject_groups
andglobal_groups
properties ofKedroCLI
-> This allows the commands from the plugins to be found first (incase a plugin has overwritten one of the Kedro core commands)LazyGroup
inkedro/framework/cli/utils.py
CommandCollection
class inkedro/framework/cli/utils.py
, removed_dedupe_commands()
method since the ordering of the command groups means that the commands from plugins are found first. **** This means that the help text looks a bit different.
Before:
After:
KEY DIFFERENCES:
kedro-override
which is a dummy plugin I have installed which overwrites thekedro catalog
command groups shows separately in both cases. But in the first one, since de-duplication takes place,catalog
help text is removed from under the "Project specific commands from Kedro" section but after this change it remains.❓ For reviewers: ^ Is the change in the help text acceptable?
Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file