scaffold.hydra.config_helpers

Attributes

CONFIG_STORE

Classes

StructuredConfig

Functions

check_cfg_for_missing_values([allowed_missing])

Decorator function that ensures we have no entries with MISSING values.

structured_config(→ Callable)

Decorator which extends the @dataclass in the following ways:

Module Contents

class scaffold.hydra.config_helpers.StructuredConfig
classmethod get_store_args() Dict[str, str]
Abstractmethod:

Returns the arguments used to store this dataclass in the config store.

classmethod get_store_path() str
Abstractmethod:

Returns the path to the node of the StructuredConfig inside the config store.

scaffold.hydra.config_helpers.check_cfg_for_missing_values(allowed_missing: List[str] | None = None)

Decorator function that ensures we have no entries with MISSING values.

Deprecated since version Use: hydra_zen.builds() with populate_full_signature=True and rely on hydra’s built-in MISSING handling instead. This helper will be removed in a future release.

It checks entries to see if they have not been overwritten via YAML or CLI. Entries ending with logging are not checked.

Usage: >>> @hydra.main( … config_name=”my_config”, … ) … @check_cfg_for_missing_values([‘myconfig.subconfig_tree.this_entry_may_be_missing’]) … def main(cfg: DictConfig) -> None: … pass

scaffold.hydra.config_helpers.structured_config(_cls: Type | None = None, name: str | None = None, group: str | None = None, package: str | None = None, provider: str | None = None, frozen: bool = False) Callable

Decorator which extends the @dataclass in the following ways:

  1. Adds the decorated class to the config store with reasonable defaults for name (class name) and provider (python package)

  2. Adds the base type StructuredConfig to the class

  3. Adds a class method get_store_args() which can be used to get the store location from the class.

Deprecated since version Use: hydra_zen.builds() and hydra_zen.store() instead::

from hydra_zen import builds from scaffold.conf import scaffold_store

MyConf = builds(MyClass, arg=value) scaffold_store(MyConf, group=”my/group”, name=”MyConf”)

This decorator will be removed in a future release.

NOTE: The decorated class is only registered, if the module containing it is imported!

Example:

@structured_config
class MyRootConfig():
    ...

@structured_config(group="my/group")
class MyGroupConfig():
    ...
Parameters:
  • name (Optional[str]) – Name of the config node. By default the class.__name__.

  • group (Optional[str]) – Config group, subgroup separator is ‘/’. If None, will be placed in the root.

  • package (Optional[str]) – Config package, which specifies where the config is applied. By default, this is derived from the group (“my/group” -> my.group)

  • provider (Optional[str]) – The name of the module/app providing this config. Helps debugging. By default this is set to the python module of the structured_config.

  • frozen (Optional[bool]) – Whether the dataclass should be read only.

Returns:

Class decorator.

scaffold.hydra.config_helpers.CONFIG_STORE