Repository navigation
v0.7.2
Added
duho.config, a module that reads and writes JSON, TOML, YAML and INI:
ConfigBackend(the contract),JSONBackend,TOMLBackend,YAMLBackend,
INIBackend, andload,loads,dump,dumps,backend_for,get_backend
andbackend_names. AConfigBackendsubclass that setsnameregisters
itself;replace=Truetakes over a built-in. Its errors are
ConfigError(withpath,lineno,colnoand no document text),
UnsupportedFormatErrorandConfigDependencyError, induho.exceptions.duho.ConfigArgs, a preset that adds--config/-c FILEand reads the file it
names. The path must exist, or the command line is a usage error._config_backends_on a root class, to limit the formats a config file may be
in, or to read them under other names and suffixes; the module functions take the
same set asbackends=.- The
yamlextra (PyYAML), andtomli-win theconfigextra, for writing TOML.
Changed
- A config path ending
.yaml,.yml,.inior.cfgis read as that format; it
was read as TOML. A name no format claims is still TOML. - A class gets the reversible
--no-*form of itsboolfields when any of
_config_,_config_env_or_config_field_is set; it was only_config_.
Full Changelog: v0.7.1...v0.7.2