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.5.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file trabConfig-0.1.5.tar.gz
.
File metadata
- Download URL: trabConfig-0.1.5.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a1664f98e5908f120fb4fdede15ac9bcbd9188d265c56d77d9ed763b7f48c2f |
|
MD5 | 33ec5d57801bc671be1c4040075afb5f |
|
BLAKE2b-256 | 20b32eceb43a89e20f99860ace424840bc63fbb433c550ea8c8d1c0e30ee3de3 |
File details
Details for the file trabConfig-0.1.5-py2.py3-none-any.whl
.
File metadata
- Download URL: trabConfig-0.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d39437b5fceb61007a0cf4d79506b2f4daa683fead85e0a6e1dca9c77e48bf42 |
|
MD5 | 57722536ba8bd56288ab51e8aafe0751 |
|
BLAKE2b-256 | e9ccceb21c36048e514bc18751550c4d92abd5ebb46cbb3b8b4abdb879e0a1d2 |