OmegaConf 2.2.1
2.2.1 (2022-05-17)
OmegaConf 2.2 is a major release. The most significant area of improvement in
2.2 is support for more flexible type hints in structured configs. In addition,
OmegaConf now natively supports two new primitive types, bytes
and pathlib.Path
.
Features
- Support unions of primitive types in structured config type hints (
typing.Union
) (#144) - Support nested container type hints in structured configs, e.g. dict-of-dict and list-of-list (#427)
- Improve support for optional element types in structured config container type hints (
typing.Optional
) (#460) - Add support for
bytes
-typed values (#844) - Add support for
pathlib.Path
-typed values (#97) ListConfig
now implements slice assignment (#736)- Enable adding a
ListConfig
to alist
via theListConfig.__radd__
dunder method (#849) - Add
OmegaConf.missing_keys()
, a method that returns the missing keys in a config object (#720) - Add
OmegaConf.clear_resolver()
, a method to remove interpolation resolvers by name (#769) - Enable the use of a pipe symbol
|
in unquoted strings in OmegaConf interpolations (#799)
Bug Fixes
OmegaConf.to_object
now works properly with structured configs that haveinit=False
fields (#789)- Fix bugs related to creation of structured configs from dataclasses having fields with a default_factory (#831)
- Fix default value initialization for structured configs created from subclasses of dataclasses (#817)
API changes and deprecations
- Removed support for
OmegaConf.is_none(cfg, "key")
. Please usecfg.key is None
instead. (#547) - Removed support for
${env}
interpolations.${oc.env}
should be used instead. (#573) - Removed
OmegaConf.get_resolver()
. Please useOmegaConf.has_resolver()
instead. (#608) - Removed support for
OmegaConf.is_optional()
. (#698) - Improved error message when assigning an invalid value to int or float config nodes (#743)
- To conform with the
MutableMapping
API, theDictConfig.items
method now returns an object of typeItemsView
, andDictConfig.keys
will now always return aKeysView
(#848)