A config loading and parsing package
Project description
Usage
The basic usage pattern is to extend these classes to create your own.
You need a loader:
from configyaml import loader
from .config.root import Root
class SibbellConfigLoader(loader.ConfigLoader):
config_root_class = Root
Then design your config using additional classes. You need at least 1 to serve as the root class:
from configyaml.config import DictNode
from .dependencies import Dependencies
from .notifications import Notifications
class Root(DictNode):
"""Root of the yaml file"""
def __init__(self, *args, **kwargs):
self._dict_fields = {
'dependencies': {
'class': Dependencies,
'required': True,
'default': [],
},
'notifications': {
'class': Notifications,
'required': True, # no point right now if no notifications
'default': [],
}
}
super(Root, self).__init__(*args, **kwargs)
def _context_to_inject(self):
"""Make dependencies list available to notifcations"""
return {'dependencies': self.dependencies}
Then to use it, simply create a loader using the configuration text content:
loader = SibbellConfigLoader(yaml_text)
# can now access the configuration and any other properties/method added to their classes
loader.is_valid()
loader.errors
loader.config_root.dependencies
History
0.2.0 (2017-04-05)
Cleanup package release tooling and documentation
Fix a bit of broken documentation
Start some basic Sphinx documentation for classes
0.1.0 (2017-03-30)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
configyaml-0.2.0.tar.gz
(13.2 kB
view details)
Built Distribution
File details
Details for the file configyaml-0.2.0.tar.gz
.
File metadata
- Download URL: configyaml-0.2.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 775fce4ae69547664743829eaa2eaa5f128ac5742c9a228892f055649660eda5 |
|
MD5 | fc4efa58b9aec694f4c13c430be1ddf1 |
|
BLAKE2b-256 | eef54d20a228f96262af764678db011c450e1cb6a238ec980d6ebfc3d0b89935 |
File details
Details for the file configyaml-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: configyaml-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db896f74d9b3bea6a17a4725b849a1c775c976d4fe352da8eb608662516bae63 |
|
MD5 | 347af8baa21938776e68d665fb391351 |
|
BLAKE2b-256 | b22860323b84bf53f4ebfcb85730aba4e488827fab256e39172f4d93bab81fed |