Overview

YAML configuration file reader with basic variable interpolation.

Requires PyYAML <http://pyyaml.org/wiki/PyYAML>

Example

/etc/dummy_config.yaml

main:
name: 'Napoleon' age: 15 skills: ['Ninja', 'Dancing', 'Nunchucks', $default_skills] net_worth: $10
>>> from yamlconfig import YamlConfig
>>> defaults = {'default_skills': 'KickBall'}
>>> config = YamlConfig('/etc/dummy_config.yaml', defaults)
>>> config['main']['name']
'Napoleon'
>>> type(config['main']['name'])
<class 'str'>
>>> config['main']['age']
15
>>> type(config['main']['age'])
<class 'int'>
>>> config['main']['skills']
['Ninja', 'Dancing', 'Nunchucks', 'KickBall']
>>> type(config['main']['skills'])
<class 'list'>
>>> config['main']['net_worth']
'$10'
>>> type(config['main']['net_worth'])
<class 'str'>