Skip to content
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

Better handle the case when using both --starter and --addons #3330

Closed
merelcht opened this issue Nov 22, 2023 · 2 comments · Fixed by #3362
Closed

Better handle the case when using both --starter and --addons #3330

merelcht opened this issue Nov 22, 2023 · 2 comments · Fixed by #3362

Comments

@merelcht
Copy link
Member

Description

It shouldn't be possible to use both --starter and --addons when doing kedro new. Currently you get a weird error:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/merel_theisen/anaconda3/envs/dev/bin/kedro:8 in <module>                                  │
│                                                                                                  │
│ /Users/merel_theisen/Projects/kedro/kedro/framework/cli/cli.py:197 in main                       │
│                                                                                                  │
│   194 │   """                                                                                    │
│   195 │   _init_plugins()                                                                        │
│   196 │   cli_collection = KedroCLI(project_path=Path.cwd())                                     │
│ ❱ 197 │   cli_collection()                                                                       │
│   198                                                                                            │
│                                                                                                  │
│ /Users/merel_theisen/anaconda3/envs/dev/lib/python3.11/site-packages/click/core.py:1157 in       │
│ __call__                                                                                         │
│                                                                                                  │
│ /Users/merel_theisen/Projects/kedro/kedro/framework/cli/cli.py:125 in main                       │
│                                                                                                  │
│   122 │   │   )                                                                                  │
│   123 │   │                                                                                      │
│   124 │   │   try:                                                                               │
│ ❱ 125 │   │   │   super().main(                                                                  │
│   126 │   │   │   │   args=args,                                                                 │
│   127 │   │   │   │   prog_name=prog_name,                                                       │
│   128 │   │   │   │   complete_var=complete_var,                                                 │
│                                                                                                  │
│ /Users/merel_theisen/anaconda3/envs/dev/lib/python3.11/site-packages/click/core.py:1078 in main  │
│                                                                                                  │
│ /Users/merel_theisen/anaconda3/envs/dev/lib/python3.11/site-packages/click/core.py:1688 in       │
│ invoke                                                                                           │
│                                                                                                  │
│ /Users/merel_theisen/anaconda3/envs/dev/lib/python3.11/site-packages/click/core.py:1434 in       │
│ invoke                                                                                           │
│                                                                                                  │
│ /Users/merel_theisen/anaconda3/envs/dev/lib/python3.11/site-packages/click/core.py:783 in invoke │
│                                                                                                  │
│ /Users/merel_theisen/Projects/kedro/kedro/framework/cli/starters.py:200 in new                   │
│                                                                                                  │
│   197 │   │   selected_add_ons_flag = selected_add_ons_flag.lower()                              │
│   198 │                                                                                          │
│   199 │   # Select which prompts will be displayed to the user based on which flags were selec   │
│ ❱ 200 │   prompts_required = _select_prompts_to_display(                                         │
│   201 │   │   prompts_required, selected_add_ons_flag, project_name                              │
│   202 │   )                                                                                      │
│   203                                                                                            │
│                                                                                                  │
│ /Users/merel_theisen/Projects/kedro/kedro/framework/cli/starters.py:496 in                       │
│ _select_prompts_to_display                                                                       │
│                                                                                                  │
│   493 │   │   │   │   err=True,                                                                  │
│   494 │   │   │   )                                                                              │
│   495 │   │   │   sys.exit(1)                                                                    │
│ ❱ 496 │   │   del prompts_required["add_ons"]                                                    │
│   497 │                                                                                          │
│   498 │   if project_name is not None:                                                           │
│   499 │   │   if not re.match(r"^[\w -]{2,}$", project_name):                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'add_ons'

Instead, the user should get a more user friendly message saying these flags can't be used together.

@SajidAlamQB
Copy link
Contributor

Same should be done for --example and --starter.

@merelcht
Copy link
Member Author

Solved in #3362

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants