From 36dd661def64837001c1916a8a9bd239617d3211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Nu=C3=B1ez?= <37588143+jmnunezd@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:39:00 -0400 Subject: [PATCH 1/4] Update on credentials.md Updating example code in credentials.md to make it usable when copy/pasting. Since as of now it will generate a TypeError Signed-off-by: Jose --- docs/source/configuration/credentials.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/configuration/credentials.md b/docs/source/configuration/credentials.md index 620fb569ac..ef2582a9aa 100644 --- a/docs/source/configuration/credentials.md +++ b/docs/source/configuration/credentials.md @@ -15,7 +15,7 @@ The following examples all use the default `ConfigLoader` class. from kedro.config import ConfigLoader from kedro.framework.project import settings -conf_path = str(project_path / settings.CONF_SOURCE) +conf_path = f"{project_path}/{settings.CONF_SOURCE}" conf_loader = ConfigLoader(conf_source=conf_path) credentials = conf_loader["credentials"] ``` @@ -28,7 +28,7 @@ Calling `conf_loader[key]` in the example above throws a `MissingConfigException from kedro.config import ConfigLoader, MissingConfigException from kedro.framework.project import settings -conf_path = str(project_path / settings.CONF_SOURCE) +conf_path = f"{project_path}/{settings.CONF_SOURCE}" conf_loader = ConfigLoader(conf_source=conf_path) try: From 38f2ef3344401797c1c0f858b304f316230ca26c Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 1 Aug 2023 14:26:06 -0400 Subject: [PATCH 2/4] adding a more explicit code example, now we directly show the user that project_path is a pathlib.Path object Signed-off-by: Jose --- docs/source/configuration/credentials.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/source/configuration/credentials.md b/docs/source/configuration/credentials.md index ef2582a9aa..64c5b48fdc 100644 --- a/docs/source/configuration/credentials.md +++ b/docs/source/configuration/credentials.md @@ -12,10 +12,12 @@ Credentials configuration can be loaded the same way as any other project config The following examples all use the default `ConfigLoader` class. ```python +from pathlib import Path + from kedro.config import ConfigLoader from kedro.framework.project import settings -conf_path = f"{project_path}/{settings.CONF_SOURCE}" +conf_path = str(Path(project_path) / settings.CONF_SOURCE) conf_loader = ConfigLoader(conf_source=conf_path) credentials = conf_loader["credentials"] ``` @@ -25,10 +27,12 @@ This loads configuration files from `conf/base` and `conf/local` whose filenames Calling `conf_loader[key]` in the example above throws a `MissingConfigException` error if no configuration files match the given key. But if this is a valid workflow for your application, you can handle it as follows: ```python +from pathlib import Path + from kedro.config import ConfigLoader, MissingConfigException from kedro.framework.project import settings -conf_path = f"{project_path}/{settings.CONF_SOURCE}" +conf_path = str(Path(project_path) / settings.CONF_SOURCE) conf_loader = ConfigLoader(conf_source=conf_path) try: From d8ee886a6f7c0687adf6288f8508d8f562e77fd5 Mon Sep 17 00:00:00 2001 From: Nok Lam Chan Date: Thu, 24 Aug 2023 13:22:21 +0100 Subject: [PATCH 3/4] Update docs/source/configuration/credentials.md Co-authored-by: Jo Stichbury --- docs/source/configuration/credentials.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/configuration/credentials.md b/docs/source/configuration/credentials.md index 0d2cc3d94e..50aef67f6d 100644 --- a/docs/source/configuration/credentials.md +++ b/docs/source/configuration/credentials.md @@ -17,7 +17,8 @@ from pathlib import Path from kedro.config import ConfigLoader from kedro.framework.project import settings -conf_path = str(Path(project_path) / settings.CONF_SOURCE) +# Substitute with the [root folder for your project](https://docs.kedro.org/en/stable/tutorial/spaceflights_tutorial.html#terminology) +conf_path = str(Path() / settings.CONF_SOURCE) conf_loader = ConfigLoader(conf_source=conf_path) credentials = conf_loader["credentials"] ``` From ea6a5f299ce37eb789bec5ba42088d236dae4df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Sat, 26 Aug 2023 16:45:40 +0200 Subject: [PATCH 4/4] Update credentials.md --- docs/source/configuration/credentials.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/configuration/credentials.md b/docs/source/configuration/credentials.md index 50aef67f6d..8252c9d76f 100644 --- a/docs/source/configuration/credentials.md +++ b/docs/source/configuration/credentials.md @@ -33,7 +33,7 @@ from pathlib import Path from kedro.config import ConfigLoader, MissingConfigException from kedro.framework.project import settings -conf_path = str(Path(project_path) / settings.CONF_SOURCE) +conf_path = str(Path() / settings.CONF_SOURCE) conf_loader = ConfigLoader(conf_source=conf_path) try: