-
Notifications
You must be signed in to change notification settings - Fork 903
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
Add addon flags to kedro new #3081
Conversation
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.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.
The addons
flag now works well if you provide valid add-ons, however if you try something like kedro new --addons=random
it will still prompt for the project name and then you get an error like:
(dev) M-C02XN0V5JHD5:Testing merel_theisen$ kedro new --addons=random
Project Name
============
Please enter a human readable name for your new project.
Spaces, hyphens, and underscores are allowed.
(New Kedro Project): bla
Traceback (most recent call last):
File "/var/folders/_3/kzkd3jjj31s24wjnsg7qgnk80000gn/T/tmp02ezo4dy.py", line 27, in <module>
main()
File "/var/folders/_3/kzkd3jjj31s24wjnsg7qgnk80000gn/T/tmp02ezo4dy.py", line 18, in main
selected_add_ons_list = parse_add_ons_input(selected_add_ons)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/merel_theisen/Projects/kedro/kedro/templates/project/hooks/utils.py", line 90, in parse_add_ons_input
_validate_selection(selected)
File "/Users/merel_theisen/Projects/kedro/kedro/templates/project/hooks/utils.py", line 58, in _validate_selection
if int(add_on) < 1 or int(add_on) > 5:
^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'random'
[10/19/23 13:26:09] ERROR Stopping generation because post_gen_project hook script didn't exit hooks.py:159
successfully
kedro.framework.cli.utils.KedroCliError: Failed to generate project when running cookiecutter.
Run with --verbose to see the full exception
Error: Failed to generate project when running cookiecutter.
Ideally, the add on input gets validated before it promts for the project name and the message shouldn't be ValueError: invalid literal for int() with base 10: 'random'
but more something along the lines of "random
isn't a valid option for addons
, the possible options are ..."
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: lrcouto <laurarccouto@gmail.com>
…edro into add-addon-flags-to-kedro-new
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.
Thank you @lrcouto, I've tested it manually and it looks great and on the right track!
There were a few things I noticed though. When we separate the add-ons with spaces after each comma the command fails. i.e lint,test,log
works but not lint, test, log
maybe we need some logic that sanitises the whitespace from inputs.
Also I noticed if we do lint,all
we get unhelpful/confusing error:
ValueError: invalid literal for int() with base 10: 'all'
[10/23/23 16:14:58] ERROR Stopping generation because post_gen_project hook script didn't exit successfully generate.py:256
kedro.framework.cli.utils.KedroCliError: Failed to generate project when running cookiecutter.
Run with --verbose to see the full exception
Error: Failed to generate project when running cookiecutter.
We might want a more clear error message telling users they have to select between a combination of add ons or none/all.
Signed-off-by: lrcouto <laurarccouto@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.
I've tested this again after your changes and I think this looks really good 👏 . I can't think of any other edge cases at the moment. I would add this change to the release notes for visibility of the feature ✍️
@SajidAlamQB you made a very good point about the spaces. The way it's implemented now is consistent with e.g. kedro run --tags=....
spaces can only be "allowed" if they are inside a string so: kedro new --addons="test, docs, log"
, but not like kedro new --addons=test, docs
.
Signed-off-by: L. R. Couto <57910428+lrcouto@users.noreply.github.com>
The way it is right now, trying to pass them outside of quotation marks will return an "unexpected argument" error. Using them inside quotation marks as in |
Signed-off-by: L. R. Couto <57910428+lrcouto@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: L. R. Couto <57910428+lrcouto@users.noreply.github.com>
When I try to reproduce this, I get the folllwing result: |
Turns out I was using an old commit 🤦🏽 All good! |
Only missing bit then is adding this to the release notes |
Signed-off-by: lrcouto <laurarccouto@gmail.com>
Signed-off-by: L. R. Couto <57910428+lrcouto@users.noreply.github.com>
Signed-off-by: L. R. Couto <57910428+lrcouto@users.noreply.github.com>
Description
Part of the add-ons flow work. Adds an
--addons
flag tokedro new
that allows the used to select which addons they would like to have on their new project through the CLI.Examples:
kedro new --addons=lint,test,log,docs,data
kedro new --addons=all
kedro new --addons=none
Development notes
Checklist
RELEASE.md
file