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

Check if starter is used before printing tools message #3484

Merged
merged 20 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions kedro/framework/cli/starters.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ def _get_extra_context( # noqa: PLR0913
or None in case the flag wasn't used.
project_name: a string containing the value for the --name flag, or
None in case the flag wasn't used.
example_pipeline: a string containing the value for the --example flag,
or None in case the flag wasn't used
starter_alias: a string containing the value for the --starter flag, or
None in case the flag wasn't used

Returns:
the prompts_required dictionary, with all the redundant information removed.
Expand All @@ -498,6 +502,9 @@ def _get_extra_context( # noqa: PLR0913
prompts_required, cookiecutter_context
)

if starter_alias:
extra_context["starter_alias"] = starter_alias
AhdraMeraliQB marked this conversation as resolved.
Show resolved Hide resolved

# Format
extra_context.setdefault("kedro_version", version)

Expand Down Expand Up @@ -851,9 +858,12 @@ def _create_project(template_path: str, cookiecutter_args: dict[str, Any]):
f"\nYour project '{project_name}' has been created in the directory \n{result_path}\n"
)

# we can use starters without tools:
# End here if a starter was used
if extra_context.get("starter_alias"):
return

if tools is not None:
AhdraMeraliQB marked this conversation as resolved.
Show resolved Hide resolved
if tools == "['None']": # TODO: This should be a list
AhdraMeraliQB marked this conversation as resolved.
Show resolved Hide resolved
if tools == "['None']":
click.secho(
"You have selected no project tools",
fg="green",
Expand Down
1 change: 1 addition & 0 deletions tests/framework/cli/test_starters.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ def test_no_hint(self, fake_kedro_cli):
"To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
not in result.output
)
assert "You have selected" not in result.output
_assert_template_ok(result)
_clean_up_project(Path("./new-kedro-project"))

Expand Down