A configuration library for python using trafaret and yaml
Project description
- Status:
- Beta
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
from trafaret_config import read_and_validate
TRAFARET = trafaret.Dict({'x': trafaret.String()})
try:
config = read_and_validate('config.yaml', TRAFARET)
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@0.1.0
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
trafaret-config-0.1.0.tar.gz
(3.8 kB
view details)
File details
Details for the file trafaret-config-0.1.0.tar.gz.
File metadata
- Download URL: trafaret-config-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aba4e46613d701951f8340ac60b5bdc869c9cad61330ef78e6cb4a699a9fe21c
|
|
| MD5 |
74d85def72663f6874038c51ae8fd937
|
|
| BLAKE2b-256 |
c20db068243aa5af072bcec108856ace63fc22e9da364ec97f8623eac10fea64
|