From 3f87895ed0e54d55be4994c462fb2030c3e13493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Nu=C3=B1ez?= <37588143+jmnunezd@users.noreply.github.com> Date: Sat, 26 Aug 2023 11:01:08 -0400 Subject: [PATCH] Update on credentials.md (#2787) * 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 * adding a more explicit code example, now we directly show the user that project_path is a pathlib.Path object Signed-off-by: Jose * Update docs/source/configuration/credentials.md Co-authored-by: Jo Stichbury --------- Signed-off-by: Jose Co-authored-by: Jo Stichbury Co-authored-by: Nok Lam Chan --- docs/source/configuration/credentials.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/source/configuration/credentials.md b/docs/source/configuration/credentials.md index 0d91da9cbc..8252c9d76f 100644 --- a/docs/source/configuration/credentials.md +++ b/docs/source/configuration/credentials.md @@ -12,10 +12,13 @@ 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 = str(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"] ``` @@ -25,10 +28,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 = str(project_path / settings.CONF_SOURCE) +conf_path = str(Path() / settings.CONF_SOURCE) conf_loader = ConfigLoader(conf_source=conf_path) try: