Flexible Python configuration system. The last one you will ever need.
BSD-3-CLAUSE License
Bot releases are hidden (Show)
metadata["omegaconf_ignore"]
is True
. (#984)Published by Jasha10 about 2 years ago
Path
to str
was disallowed. (#934)typing.Sequence
) are used in structured configs. (#991)tuple
as equivalent to typing.Tuple
, and likewise for dict
/Dict
and list
/List
. (#973)Published by Jasha10 over 2 years ago
Published by Jasha10 over 2 years ago
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
.
typing.Union
) (#144)typing.Optional
) (#460)bytes
-typed values (#844)pathlib.Path
-typed values (#97)ListConfig
now implements slice assignment (#736)ListConfig
to a list
via the ListConfig.__radd__
dunder method (#849)OmegaConf.missing_keys()
, a method that returns the missing keys in a config object (#720)OmegaConf.clear_resolver()
, a method to remove interpolation resolvers by name (#769)|
in unquoted strings in OmegaConf interpolations (#799)OmegaConf.to_object
now works properly with structured configs that have init=False
fields (#789)OmegaConf.is_none(cfg, "key")
. Please use cfg.key is None
instead. (#547)${env}
interpolations. ${oc.env}
should be used instead. (#573)OmegaConf.get_resolver()
. Please use OmegaConf.has_resolver()
instead. (#608)OmegaConf.is_optional()
. (#698)MutableMapping
API, the DictConfig.items
method now returns an object of type ItemsView
, and DictConfig.keys
will now always return a KeysView
(#848)Published by Jasha10 about 3 years ago
Published by omry over 3 years ago
OmegaConf 2.1 is a major release introducing substantial new features, and introducing some incompatible changes.
The biggest area of improvement in 2.1 is interpolations and resolvers. In addition - OmegaConf containers are now
much more compatible with their plain Python container counterparts (dict and list).
@dataclass
or @attr.s
class. (#472)OmegaConf.has_resolver()
allows checking whether a resolver has already been registered. (#608)OmegaConf.MISSING
(#390)structured_config_mode
keyword argument. Setting structured_config_mode=SCMode.DICT_CONFIG
causes to_container
to not convert Structured Config objects to python dicts (it leaves them as DictConfig objects). (#548)OmegaConf.{update, select}
and in interpolations, bracketed keys may be used as an alternative form to dot notation,${namespace.my_func:123}
) (#539)oc.select
, enabling node selection with a default value to use if the node cannot be selected (#541)oc.decode
that can be used to automatically convert a string to bool, int, float, dict, list, etc. (#574)oc.dict.keys
and oc.dict.values
provide a list view of the keys or values of a DictConfig node. (#643)oc.create
can be used to dynamically generate config nodes (#645)oc.deprecated
, that enables deprecating config nodes (#681)$
is now allowed in interpolated key names, e.g. ${$var}
(#600)ListConfig.append()
now copies input config nodes (#601)__delitem__
can now be called with a string naming the enum member to be deleted. (#554)OmegaConf.select()
of a missing (???
) node from a ListConfig with throw_on_missing
set to True now raises the intended exception. (#563)DictConfig.{get(),pop()}
now return None
when the accessed key evaluates to None
, instead of the specified default value (for consistency with regular Python dictionaries). (#583)ListConfig.get()
now return None
when the accessed key evaluates to None
, instead of the specified default value (for consistency with DictConfig). (#583)parent
when creating a config from a YAML string. (#648)__getattr__
access, e.g. cfg.foo
, is now raising a AttributeError if the key "foo" does not exist (#515)__getitem__
access, e.g. cfg["foo"]
, is now raising a KeyError if the key "foo" does not exist (#515)cfg.get("foo")
, now returns None
if the key "foo" does not exist (#527)Omegaconf.select(cfg, key, default, throw_on_missing)
now requires keyword arguments for everything after key
(#228)???
) instead of auto-expanding (#411)register_resolver()
is deprecated in favor of register_new_resolver()
, allowing resolvers to (i) take non-string arguments like int, float, dict, interpolations, etc. and (ii) control the cache behavior (now disabled by default) (#426)OmegaConf.select()
, DictConfig.{get(),pop()}
, ListConfig.{get(),pop()}
no longer return the specified default value when the accessed key is an interpolation that cannot be resolved: instead, an exception is raised. (#543)InterpolationResolutionError
or a subclass of it. (#561)key in cfg
now returns True when key
is an interpolation even if the interpolation target is a missing ("???") value. (#562)OmegaConf.select()
as well as container methods get()
and pop()
do not return their default value anymore when the accessed key is an interpolation that cannot be resolved: instead, an exception is raised. (#565)${foo:a,}
) are deprecated in favor of explicit quoted strings (e.g., ${foo:a,""}
) (#572)env
resolver is deprecated in favor of oc.env
, which keeps the string representation of environment variables, does not cache the resulting value, and handles "null" as default value. (#573)OmegaConf.get_resolver()
is deprecated: use the new OmegaConf.has_resolver()
to check for the existence of a resolver. (#608)typing.Dict
is now deprecated. (#663)Published by omry over 3 years ago
OmegaConf 2.1 is a major release introducing substantial new features, and introducing some incompatible changes.
The biggest area of improvement in 2.1 is interpolations and resolvers. In addition - OmegaConf containers are now
much more compatible with their plain Python container counterparts (dict and list).
@dataclass
or @attr.s
class. (#472)OmegaConf.has_resolver()
allows checking whether a resolver has already been registered. (#608)OmegaConf.MISSING
(#390)structured_config_mode
keyword argument. Setting structured_config_mode=SCMode.DICT_CONFIG
causes to_container
to not convert Structured Config objects to python dicts (it leaves them as DictConfig objects). (#548)OmegaConf.{update, select}
and in interpolations, bracketed keys may be used as an alternative form to dot notation,${namespace.my_func:123}
) (#539)oc.select
, enabling node selection with a default value to use if the node cannot be selected (#541)oc.decode
that can be used to automatically convert a string to bool, int, float, dict, list, etc. (#574)oc.dict.keys
and oc.dict.values
provide a list view of the keys or values of a DictConfig node. (#643)oc.create
can be used to dynamically generate config nodes (#645)oc.deprecated
, that enables deprecating config nodes (#681)$
is now allowed in interpolated key names, e.g. ${$var}
(#600)__delitem__
can now be called with a string naming the enum member to be deleted. (#554)OmegaConf.select()
of a missing (???
) node from a ListConfig with throw_on_missing
set to True now raises the intended exception. (#563)DictConfig.{get(),pop()}
now return None
when the accessed key evaluates to None
, instead of the specified default value (for consistency with regular Python dictionaries). (#583)ListConfig.get()
now return None
when the accessed key evaluates to None
, instead of the specified default value (for consistency with DictConfig). (#583)parent
when creating a config from a YAML string. (#648)__getattr__
access, e.g. cfg.foo
, is now raising a AttributeError if the key "foo" does not exist (#515)__getitem__
access, e.g. cfg["foo"]
, is now raising a KeyError if the key "foo" does not exist (#515)cfg.get("foo")
, now returns None
if the key "foo" does not exist (#527)Omegaconf.select(cfg, key, default, throw_on_missing)
now requires keyword arguments for everything after key
(#228)???
) instead of auto-expanding (#411)register_resolver()
is deprecated in favor of register_new_resolver()
, allowing resolvers to (i) take non-string arguments like int, float, dict, interpolations, etc. and (ii) control the cache behavior (now disabled by default) (#426)OmegaConf.select()
, DictConfig.{get(),pop()}
, ListConfig.{get(),pop()}
no longer return the specified default value when the accessed key is an interpolation that cannot be resolved: instead, an exception is raised. (#543)InterpolationResolutionError
or a subclass of it. (#561)key in cfg
now returns True when key
is an interpolation even if the interpolation target is a missing ("???") value. (#562)OmegaConf.select()
as well as container methods get()
and pop()
do not return their default value anymore when the accessed key is an interpolation that cannot be resolved: instead, an exception is raised. (#565)${foo:a,}
) are deprecated in favor of explicit quoted strings (e.g., ${foo:a,""}
) (#572)env
resolver is deprecated in favor of oc.env
, which keeps the string representation of environment variables, does not cache the resulting value, and handles "null" as default value. (#573)OmegaConf.get_resolver()
is deprecated: use the new OmegaConf.has_resolver()
to check for the existence of a resolver. (#608)typing.Dict
is now deprecated. (#663)Published by omry almost 4 years ago
Published by omry almost 4 years ago
Published by omry almost 4 years ago
Published by omry about 4 years ago
Minor release deprecating an uncommonly used feature.
Published by omry about 4 years ago
${foo.bar}
if foo
is a value node (instead of silently returning ${foo}
) (#364)Published by omry about 4 years ago
This is mostly a bugfix release.
The notable change is the config.pretty() is now deprecated in favor of OmegaConf.to_yaml().
Published by omry over 4 years ago
OmegaConf 2.0 is a major release introducing substantial new features, and introducing some incompatible changes.
The biggest new feature is Structured Configs, which extends OmegaConf into an schema validation system
as well as a configuration system.
With Structured Configs you can create OmegaConf objects from standard dataclasses or attr classes (or objects).
OmegaConf will retain the type information from the source object/class and validate that config mutations are legal.
This is the biggest OmegaConf release ever, the number of unit tests more than trippled (485 to 1571).
Published by omry almost 5 years ago
Published by omry almost 5 years ago