metron_shared.config.config_schema module#

This module provides decorator <create_structured_config_schema> which creates a Structured Config Schema used by Hydra framework to validate presence of expected config parameters and their type. It calls schema registration function passed as an argument into the function. The decorator has to be used before calling Hydra’s <hydra.main>. See the sample code:

``` @create_structured_config_schema(schema_registration_function_to_be_called) @hydra.main(config_path=”…”, config_name=”…”) @other_decorators def main(cfg: DictConfig) -> None:

```

metron_shared.config.config_schema.create_structured_config_schema(schema_registering_function: Callable[[hydra.core.config_store.ConfigStore], None]) Callable[[Callable[[...], omegaconf.DictConfig]], Callable[[...], omegaconf.DictConfig]]#

Creates Structured Config Schema of Hydra framework which is used to validate config parameters presence and data types. It does not validate config parameter values. The actual schema registering is done by <schema_registering_function> function. The advantage of decorator, rather than calling a function in main file, is code transparency from usage perspective.

Parameters:
  • schema_registering_function (Callable[[ConfigStore]], None]) – Function which does actual Structured

  • return (Config Schema registration. The function has to have only one input parameter of type ConfigStore and) –

  • None.

Returns (typing.Callable[[typing.Callable[…, typing.Any]], DictConfig]): Hydra’s main decorator function.