A configuration library for python using trafaret and yaml

Project description

Status:
Beta
Documentation:

This is a wrapper that loads yaml and checks config using trafaret while keeping track of actual lines of file where error has happened. Additionally, it can pretty print the error.

Basic Usage:

import trafaret

TRAFARET = trafaret.Dict({'x': trafaret.String()})

try:
except ConfigError as e:
e.output()
sys.exit(1)

Example output (from a test.py which has better trafaret than example above):

bad.yaml:2: smtp.port: value can't be converted to int
bad.yaml:3: smtp.ssl_port: value can't be converted to int
bad.yaml:4: port: value can't be converted to int

Installation

pip install trafaret-config==1.0.0

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Project details

Uploaded source