diff --git a/RELEASE.md b/RELEASE.md index da3423fab0..fcdbb8fe9a 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -13,12 +13,13 @@ * Moved pattern resolution logic from `DataCatalog` to a separate component - `CatalogConfigResolver`. Updated `DataCatalog` to use `CatalogConfigResolver` internally. * Made packaged Kedro projects return `session.run()` output to be used when running it in the interactive environment. * Enhanced `OmegaConfigLoader` configuration validation to detect duplicate keys at all parameter levels, ensuring comprehensive nested key checking. + ## Bug fixes and other changes * Fixed bug where using dataset factories breaks with `ThreadRunner`. * Fixed a bug where `SharedMemoryDataset.exists` would not call the underlying `MemoryDataset`. * Fixed template projects example tests. -* Made credentials loading consistent between `KedroContext._get_catalog()` and `resolve_patterns` so that both us -e `_get_config_credentials()` +* Made credentials loading consistent between `KedroContext._get_catalog()` and `resolve_patterns` so that both use `_get_config_credentials()` +* Allow runtime parameters to be wrapped in a list. ## Breaking changes to the API * Removed `ShelveStore` to address a security vulnerability. diff --git a/kedro/framework/cli/utils.py b/kedro/framework/cli/utils.py index 1b50408cc5..67e0a83629 100644 --- a/kedro/framework/cli/utils.py +++ b/kedro/framework/cli/utils.py @@ -2,6 +2,7 @@ from __future__ import annotations +import ast import difflib import importlib import logging @@ -471,6 +472,17 @@ def _validate_config_file(key: str) -> None: def _split_params(ctx: click.Context, param: Any, value: Any) -> Any: if isinstance(value, dict): return value + if isinstance(value, list) and len(value) == 1: + value = value[0] + # Try evaluating the string as a Python literal in case it contains a list + if isinstance(value, str): + try: + evaluated_value = ast.literal_eval(value) + if isinstance(evaluated_value, list) and len(evaluated_value) == 1: + value = evaluated_value[0] + except (ValueError, SyntaxError): + pass # Safely continue if the evaluation fails + dot_list = [] for item in split_string(ctx, param, value): equals_idx = item.find("=") diff --git a/tests/framework/cli/test_cli.py b/tests/framework/cli/test_cli.py index e243ef73e1..df797f3d8c 100644 --- a/tests/framework/cli/test_cli.py +++ b/tests/framework/cli/test_cli.py @@ -859,6 +859,8 @@ def test_run_with_params_in_config( "foo.nested_1.double_nest=123.45,foo.nested_2=1a", {"foo": {"nested_1": {"double_nest": 123.45}, "nested_2": "1a"}}, ), + (["foo=bar,fizz=buzz"], {"foo": "bar", "fizz": "buzz"}), + ('["foo=bar,fizz=buzz"]', {"foo": "bar", "fizz": "buzz"}), ], ) def test_run_extra_params(