ertk.config.ERTKConfig

class ertk.config.ERTKConfig

Bases: ABC

Base class for ERTK configuration dataclasses.

__init__() None

Methods

__init__()

from_config(config)

Create config object from any compatible config.

from_file(path[, override])

Create config from YAML file and optionlly override some values.

merge_with_args([args])

Merge config with command-line arguments.

to_dictconfig()

Convert config to DictConfig.

to_file(path)

Write config to YAML file.

to_string()

Generate YAML string representation of config.

Inherited Methods

classmethod from_config(config: Any) T

Create config object from any compatible config.

Parameters:
config: omegaconf.DictConfig or dict

The object to create the config from.

Returns:
ERKConfig

The resulting config.

classmethod from_file(path: PathLike | str, override: List[str] | None = None) T

Create config from YAML file and optionlly override some values.

Parameters:
path: os.Pathlike or str

The path to YAML file containing config.

override: list of str, optional

Argument overrides in the form of key=value pairs.

Returns:
ERKConfig

The resulting config.

merge_with_args(args: List[str] | None = None) T

Merge config with command-line arguments.

Parameters:
args: list of str, optional

Argument overrides in the form of key=value pairs.

Returns:
ERKConfig

The resulting config.

to_dictconfig() DictConfig

Convert config to DictConfig.

Returns:
omegaconf.DictConfig

The structured config which behaves like the corresponding dataclass.

to_file(path: PathLike | str) None

Write config to YAML file.

Parameters:
path: os.Pathlike or str

The path to YAML file to write config to.

to_string() str

Generate YAML string representation of config.

Returns:
str

YAML string representation of config.