diff --git a/RELEASE.md b/RELEASE.md index 616ba97219..f7e737f8fe 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,7 @@ ## Major features and improvements ## Bug fixes and other changes +* Fixed an issue where `kedro new --config config.yml` was ignoring the config file when `prompts.yml` didn't exist. ## Minor breaking changes to the API diff --git a/kedro/framework/cli/starters.py b/kedro/framework/cli/starters.py index 4d1c3fc804..fe39a5357c 100644 --- a/kedro/framework/cli/starters.py +++ b/kedro/framework/cli/starters.py @@ -153,6 +153,8 @@ def new( # Obtain config, either from a file or from interactive user prompts. if not prompts_required: config = {} + if config_path: + config = _fetch_config_from_file(config_path) elif config_path: config = _fetch_config_from_file(config_path) _validate_config_file(config, prompts_required) @@ -436,7 +438,6 @@ def _validate_config_file(config: Dict[str, str], prompts: Dict[str, Any]): """ if config is None: raise KedroCliError("Config file is empty.") - missing_keys = set(prompts) - set(config) if missing_keys: click.echo(yaml.dump(config, default_flow_style=False)) diff --git a/tests/framework/cli/test_starters.py b/tests/framework/cli/test_starters.py index 64aa57115c..0399dbdfed 100644 --- a/tests/framework/cli/test_starters.py +++ b/tests/framework/cli/test_starters.py @@ -328,7 +328,7 @@ def test_no_prompts(self, fake_kedro_cli): result = CliRunner().invoke( fake_kedro_cli, ["new", "--starter", "template", "--config", "config.yml"] ) - _assert_template_ok(result) + _assert_template_ok(result, **config) def test_empty_prompts(self, fake_kedro_cli): config = { @@ -342,7 +342,7 @@ def test_empty_prompts(self, fake_kedro_cli): result = CliRunner().invoke( fake_kedro_cli, ["new", "--starter", "template", "--config", "config.yml"] ) - _assert_template_ok(result) + _assert_template_ok(result, **config) @pytest.mark.usefixtures("chdir_to_tmp")