Changelog¶
Release 5.0.0¶
Warning
Major API changes! Read the full documentation before upgrading!
- Python 2 support is now dropped!
- Add the possibility to supply a custom file “handler” (f.ex. YAML or other custom parsers).
- Add
config_resolver.handler.json
as optional file-handler. - Refactored from a simple module to a full-fledged Python package
- Retrieving a config instance no longer returns a subclass of the
configparser.ConfigParser
class. Instead, it will return whatever the supplied handler creates. - External API changed to a functional API. You no longer call the
Config
constructor, but instead use theget_config()
function. - Retrieval meta-data is returned along-side the retrieved config. This
separation allows a custom handler to return any type without impacting the
internal logic of
config_resolver
. - Dropped the deprectaed lookup in
~/.group-name/app-name
in favor of the XDG standar~/.config/group-name/app-name
.
Upgrading from 4.x¶
- Replace
Config
withget_config
- The result from the call to
get_config
now returns two objects: The config instance and additional metadata. - The following attributes moved to the meta-data object:
active_path
prefix_filter
loaded_files
- Return types for INI files is now a standard library instance of
configparser.ConfigParser
. This means that thedefault
keyword argument toget
has been replaced withfallback
.
Release 4.1.0¶
Features added¶
XDG Basedir support
config_resolver
will now search in the folders/names defined in the XDG specification.
Release 4.0.0¶
Features added¶
Config versioning support.
The config files can now have a section
meta
with the keyversion
. The version is specified in dotted-notation with a major and minor number (f.ex.:version=2.1
). Configuration instances take an optionalversion
argument as well. If specified, config_resolver expects themeta.version
to be there. It will raise aconfig_resolver.NoVersionError
otherwise. Increments in the major number signify an incompatible change. If the application expectes a different major number than stored in the config file, it will raise aconfig_resolver.IncompatibleVersion
exception. Differences in minor numbers are only logged.
Improvments¶
- The
mandatory
argument has been dropped! It is now implicitly assumed it the.get
method does not specify a default value. Even though “explicit is better than implicit”, this better reflects the behaviour of the coreConfigParser
and is more intuitive. - Legacy support of old environment variable names has been dropped!
- Python 3 support.
- When searching for a file on the current working directory, look for
./.group/app/app.ini
instead of simply./app.ini
. This solves a conflict when two modules use config_resolver in the same application. - Better logging.
Release 3.3.0¶
Features added¶
- New (optional) argument:
require_load
. If set toTrue
creating a config instance will raise an error if no appropriate config file is found. - New class:
SecuredConfig
: This class will refuse to load config files which are readable by other users than the owner.
Improvments¶
- Documentation updated/extended.
- Code cleanup.
Release 3.2.1¶
Fixes/Improvments¶
- The “group” name has been prefixed to the names of the environment variables. So, instead of APP_PATH, you can now use GROUP_APP_PATH instead. Not using the GROUP prefix will still work but emit a DeprecationWarning.