mache.deploy.hooks.load_hooks

mache.deploy.hooks.load_hooks(config: dict[str, Any], repo_root: str, logger: Logger) HookRegistry[source]

Load deployment hooks from a target-software repository.

Parameters:
  • config

    Parsed config from rendered deploy/config.yaml.j2.

    Hooks are configured under the optional top-level hooks section:

    hooks:
      file: "deploy/hooks.py"  # default
      entrypoints:
        pre_pixi: "pre_pixi"        # optional
        post_pixi: "post_pixi"      # optional
        pre_spack: "pre_spack"      # optional
        post_spack: "post_spack"    # optional
        post_deploy: "post_deploy"  # optional
    

    If the hooks section is missing, hooks are considered disabled.

  • repo_root – Target-software repository root (the working directory where deploy/ lives).

  • logger – Logger used for hook loading and execution messages.

Returns:

  • HookRegistry – A registry containing a resolved hook module path and stage->callable mapping. Stages not present are simply no-ops.

  • Missing file semantics

  • ———————-

    • If the hooks section is not present, a missing hooks file is treated – as “no hooks”.

    • If the hooks section is present (explicitly configured) and the – hooks file is missing, a FileNotFoundError is raised.