Skip to main content

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.

Files for trabConfig, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size trabConfig-0.1.5-py2.py3-none-any.whl (4.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size trabConfig-0.1.5.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page