YAML config parser
Project description
ymlconf
What is it for?
Using YAML configuration files for python require less boilerplate code, and accessing the values by dot notation.
Installation
pip install comfyconf
Usage
Basic
Create a config file in YAML and name it foo.yaml:
test:
title: 'test'
ip: '127.0.0.1'
port: 5000
production:
title: 'My amazing server'
ip: '1234.255.255.1'
port: 1234
Now, load it using make_config
:
>>> from comfyconf import make_config
>>> config = make_config('foo.yaml')
>>> config.test.ip
'127.0.0.1'
>>> config.production.port
1234
Note that numerical keys are not allowed (even if they're strings in YAML), doing so will raise a ValueError
Using ruamel.yaml as parser instead of pyyaml
If you prefer ruamel.yaml or need to parse YAML 1.2 document you can use:
>>> config = make_config('foo.yaml', reader='ruamel')
Contribute
If you find a bug or have a feature request, please raise on issue on Github.
Contributions are more than welcome, but please:
- Write unittest (pytest)
- Write Numpy styled docstrings
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
comfyconf-0.0.1.tar.gz
(6.9 kB
view hashes)
Built Distribution
Close
Hashes for comfyconf-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abe0adc0fddce9333cc3b595c5964a581c3aad78ce209c9e41c10e1cc709cabd |
|
MD5 | 2938b06a402b5d43b11cafa3ff56f3a7 |
|
BLAKE2b-256 | 2bd6fdf574efc6d9c741b0795d81f5858ab5cf2351773cade54ec424e121c850 |