diff --git a/docs/source/configuration/advanced_configuration.md b/docs/source/configuration/advanced_configuration.md index f9c96c7e31..78f9dc94f2 100644 --- a/docs/source/configuration/advanced_configuration.md +++ b/docs/source/configuration/advanced_configuration.md @@ -218,6 +218,31 @@ companies: ``` If the `folder` parameter is not passed through the CLI `--params` option with `kedro run`, the default value `'data/01_raw/'` is used for the `filepath`. +#### How to use `globals` and `runtime_params` + +As mentioned above, `runtime_params` are not designed to override `globals` configuration. This is done to avoid unexplicit overrides and to simplify parameter resolutions. Thus, `globals` has only one entry point - the `yaml` file. + +However, you can use `globals` and `runtime_params` by specifying `globals` as a default value to be used in case the runtime parameter is not passed. + +Consider this `parameters.yml`: +```yaml +model_options: + random_state: "${runtime_params:random, ${globals:my_global_value}}" +``` + +and this `globals.yml` file: + +```yaml +my_global_value: 4 +``` + +This will allow you to pass a runtime parameter named `random` through the CLI to specify the value of `model_options.random_state` in your project's parameters: +```bash +kedro run --params random=3 +``` + +If the `random` parameter is not passed through the CLI `--params` option with `kedro run`, then `my_global_value` from `globals.yml` is used for the `model_options.random_state`. + ### How to use resolvers in the `OmegaConfigLoader` Instead of hard-coding values in your configuration files, you can also dynamically compute them using [`OmegaConf`'s resolvers functionality](https://omegaconf.readthedocs.io/en/2.3_branch/custom_resolvers.html#resolvers). You use resolvers to define custom diff --git a/pyproject.toml b/pyproject.toml index 645fb0dd97..57bf2dfaf7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ dynamic = ["readme", "version"] [project.optional-dependencies] test = [ "behave==1.2.6", - "coverage>=7.2.0", + "coverage[toml]", "import-linter==2.0", "ipylab>=1.0.0", "ipython>=7.31.1, <8.0; python_version < '3.8'", @@ -88,7 +88,7 @@ jupyter = [ "ipylab>=1.0.0", "notebook>=7.0.0" # requires the new share backend of notebook and labs" ] -all = ["kedro[test,docs,jupyter]"] +all = [ "kedro[test,docs,jupyter]" ] [project.urls] Homepage = "https://kedro.org" @@ -129,7 +129,7 @@ omit = [ "kedro/runner/parallel_runner.py", "*/site-packages/*", ] -exclude_also = ["raise NotImplementedError"] +exclude_lines = ["pragma: no cover", "raise NotImplementedError"] [tool.pytest.ini_options] addopts="""