Skip to content

Commit

Permalink
feat(hyfi): add hyfi configuration path to search path
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jul 22, 2023
1 parent eecd81f commit eceb21f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/hyfi/core/hydra/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit eceb21f

Please sign in to comment.