No project description provided
Project description
Schemed YAML Config
Schemed YAML Config is a library to read and validate YAML based configuration files against JSON Schema specifications.
Install
Schemed-yaml-config can be installed via PIP
# pip install schemed-yaml-config
Under the hood
Schemed YAML Config works by converting YAML files into a dictionarie by mean of the well known PyYAML framework and then by applying JSON Schema specifications before of returning it to rest of the script.
The beauty of this approach is it combines the human friendly serialization of YAML with the power of JSON Schema.
A few tricks has been added to make the library even more human friendly. For instance when the a configuration file is missing and a default is created, order and comments of the keys from the schema are borrowed to the YAML file.
Syntax
Python 3.7.4 (default, Aug 21 2019, 16:01:23)
[GCC 9.2.1 20190813] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from schemed_yaml_config import get_config
>>> config = get_config('config.yml', 'schema.yml')
>>> print(config)
{'listen': {'host': 'localhost', 'port': 8080}, 'tmpdir': '/tmp/'}
>>>
TOML
Despite its name Schemed YAML Config also supports TOML configuration files as experimental feature since v0.1.0. TOML schemas are not supported yet!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for schemed-yaml-config-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77131de111e34bbd2eaafec29ff821cce69af532661be93046073da9e1ed3366 |
|
MD5 | d016f0c50bd70731a4232926f8d7353e |
|
BLAKE2b-256 | 792a55a65010b7ae174860166e67485cd5204d9e8f839721335e52acf1ce5570 |