A convenience utility for working with JSON config files.
Project description
A convenience utility for working with JSON configuration files.
Features
Automatically syncs file on changes
Automatically handles complicated nested data structures.
Lightweight (<5KB) and Fast.
Takes advantage of Python’s native dictionary syntax.
Tested against python 2.7, 3.4, and pypy. (2.6, 3.2, 3.3 are in the works)
>>> import json_config
>>> config = json_config.connect('categories.json')
>>> config
{}
>>> config['comics']['dc']['batman']['antagonists'] = ['Scarecrow', 'The Joker', 'Bane']
>>> config['comics']['marvel']['ironman']['antagonists'] = 'Ultron'
>>> config
{
"comics": {
"dc": {
"batman": {
"antagonists": [
"Scarecrow",
"The Joker",
"Bane"
]
}
},
"marvel": {
"ironman": {
"antagonists": "Ultron"
}
}
}
}
Installation
At the command line either via easy_install or pip:
$ pip install json_config
$ easy_install json_config
Uninstall
$ pip uninstall json_config
Getting Started
To use json_config in a project:
import json_config
config = json_config.connect('config.json')
config['root'] = '/var/www/html/'
print config['root'] # '/var/www/html/'
print config # { "root": "/var/www/html" }
Documentation
The full documentation is at https://json-config.readthedocs.org.
History
0.1.0 (2015-04-11)
First release on PyPI.
1.0.0 (2015-04-13)
First working version.
1.1.0 (2015-04-15)
Massive improvement to documentation and presentation.
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
json_config-1.1.0.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for json_config-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad9bd2282852ceedd7b13eb559d9fd8670ea38ced5c8ac1dd3eb68e3af7e7ce1 |
|
MD5 | 01a9e59e5168aa05b05bba4cd26e2fa2 |
|
BLAKE2b-256 | 7fed522ccfba5692f94a554d095457b4d28a4109359ad0b2cc4d4bbc016a472e |