hey guys, Is something changed regarding how the ...
# questions
f
hey guys, Is something changed regarding how the config + env works in kedro? I am doing the following setup:
Copy code
conf/base/catalog.yaml
conf/test/catalog.yaml
in the test env, i have same catalog entries but their filepaths are different, I was trying to get the test run using the
test
env by loading the corresponding data files. However I am getting the following error:
Copy code
if duplicates:
            dup_str = "\n".join(duplicates)
>           raise ValueError(f"{dup_str}")
E           ValueError: Duplicate keys found in /home/ftopal/Projects/ss-finder/conf/test/catalog.yml and /home/ftopal/Projects/ss-finder/conf/base/catalog.yml: basics, crew, people...

../../../miniconda3/envs/ss-finder/lib/python3.10/site-packages/kedro/config/omegaconf_config.py:449: ValueError
I thought it would just do destructive merge but something is still off. here is the test setup:
Copy code
import pandas as pd

from pytest import fixture
from pathlib import Path

from kedro.config import OmegaConfigLoader
from kedro.framework.context import KedroContext
from kedro.framework.hooks import _create_hook_manager
from kedro.framework.project import settings


PROJECT_PATH = Path.cwd().parent.resolve()


@fixture
def config_loader():
    return OmegaConfigLoader(
        conf_source=str(PROJECT_PATH / settings.CONF_SOURCE),
        env="test",
        default_run_env="test"
    )


@fixture
def project_context(config_loader):
    return KedroContext(
        package_name="ss_finder",
        project_path=PROJECT_PATH,
        config_loader=config_loader,
        hook_manager=_create_hook_manager(),
        env="test"
    )
Okay fixed it, somehow i need to pass the base env to omegaconf:
Copy code
@fixture
def config_loader():
    return OmegaConfigLoader(
        conf_source=str(PROJECT_PATH / settings.CONF_SOURCE),
        env="test",
        base_env="base",
        default_run_env="test"
    )
I am not sure if it's intentional that we do
base_env=base
to get it working. Documentation of the func says it should default to
base
but it actually doesn't
y
Yes actually I understand it is confusing. The default for configloader are
base_env="."
and
default_run_env="."
to ensure it runs with config files at the root when using it in a notebook (see link below 👇) But in a kedro project it reads the
settings.py
where the defaults are
"base"
and
"local"
so that it runs as in previous kedro version
👍 1
f
Interesting, thanks for the explanation
e
f
Ah would have been cool to spot it as well but I believe it used to work so I was surprised that it didn't anymore and as u said a quick was added so it works normally now :)