A simple config parser that supports JSON and YAML
Project description
A simple Config file parser that supports json, and yaml formats with auto-save feature.
Installation
from pip
pip install trabConfig
or the old fashioned way
python setup.py install
NOTE: wheels and source dists also available on pypi
Usage
Example -
from trabconfig import trabConfig
# load file verbatim
config = trabConfig("config.json", autosave=False, data='json')
# or just
config = trabConfig("config.json")
# for yaml
config = trabConfig("config.yml", data='yaml)
# autosave capability (saves on changes)
config.autosave = True
# or during instantiation
config = trabConfig("config.json", autosave=True)
# usage example
health = config['health']
config['health'] = 9999
mana = config.get('mana', None)
if mana is not None:
config['mana'] = 999
lvl = config.get('lvl')
config.set('lvl', 99)
config.new('items', [])
config['items'].append('gold')
config.delete('cloth')
config.save()
Notes
Created by - traBpUkciP 2016-2017
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
trabConfig-0.1.3.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for trabConfig-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50a8e42d7d10e73dbe7abf6679f6de29ad5bdc53d4f8d9020a2c7c155f111ea1 |
|
MD5 | 1b3383b4d2d77382cafab4addc12ea82 |
|
BLAKE2b-256 | 78dd90419f95dfa593a1df61386e21a6b6591a0c96259a50fedbbacd19abb42c |