diff --git a/src/hyfi/core/hydra/utils.py b/src/hyfi/core/hydra/utils.py index ac2ba6e7..ddba29ce 100644 --- a/src/hyfi/core/hydra/utils.py +++ b/src/hyfi/core/hydra/utils.py @@ -18,6 +18,8 @@ from hydra.errors import SearchPathException from hydra.types import TaskFunction +from hyfi.core import __config_module_path__ + log = logging.getLogger(__name__) @@ -55,6 +57,23 @@ def _run_hydra( calling_file, calling_module, config_path ) + def add_hyfi_conf() -> None: + if ( + calling_module + and calling_module.split(".")[0] == __config_module_path__.split(".")[0] + ): + log.debug("Calling module is hyfi") + else: + log.debug( + "Calling module is not hyfi, adding hyfi to the config search path" + ) + search_path.prepend( + provider="hyfi", + path=f"pkg://{__config_module_path__}", + ) + + run_and_report(add_hyfi_conf) + def add_conf_dir() -> None: if args.config_dir is not None: abs_config_dir = os.path.abspath(args.config_dir)