Python API
OmegaConf's public API centers on the OmegaConf class. Start with an
operation below, then follow the link to its generated signature, parameters,
and return value.
| I want to⦠| Start with |
|---|---|
| Create a config from Python data or YAML | OmegaConf.create() |
| Combine configs, with later values taking precedence | OmegaConf.merge() |
| Read a nested value by path | OmegaConf.select() |
| Write a nested value by path | OmegaConf.update() |
| Convert a config to a Python container | OmegaConf.to_container() |
| Serialize a config to a YAML string | OmegaConf.to_yaml() |
| Resolve interpolations in place | OmegaConf.resolve() |
Types and helpersβ
Use MISSING to mark a mandatory missing value,
II and SI for
interpolations, and open_dict,
read_write, or
flag_override for temporary flag
changes.
For explicit container types in 2.4, see
typed_list,
typed_dict, and
typed_tuple.
Deprecated functionsβ
In 2.4, use OmegaConf.register_resolver() instead of these deprecated
registration methods:
| Deprecated function | Replacement |
|---|---|
register_new_resolver() | register_resolver() |
legacy_register_resolver() | register_resolver() |