Stable - A convenience utility for working with JSON config files, with file syncing.
Python Makefile
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
examples
json_config
tests
.coveragerc
.editorconfig
.gitignore
.requirements.diff
.travis.yml
AUTHORS.rst
CONTRIBUTING.rst
HISTORY.rst
LICENSE
MANIFEST.in
Makefile
README.rst
requirements.in
requirements.txt
requirements_dev.in
requirements_dev.txt
setup.cfg
setup.py
tox.ini

README.rst

json_config

Latest Version Development Status Build Status Coverage Status Documentation Status

A convenience utility for working with JSON config files.

Features

  • Automatically syncs file on changes.
  • Automatically handles complicated nested data structures.
  • Designed to be easily extended. Use different serializer libraries to easily switch to yaml, ini, etc.
  • Lightweight (<5KB) and Fast.
  • Takes advantage of Python's native dictionary syntax.
  • Tested against python 2.6, 2.7, 3.3, 3.4, 3.5, and PYPY!
  • Unit Tested with high coverage.
  • Idiomatic, self-descriptive code & api
>>> import json_config
>>> config = json_config.connect('categories.json')
>>> config
Connect({})
>>> config['comics']['dc']['batman']['antagonists'] = ['Scarecrow', 'The Joker', 'Bane']
>>> config['comics']['marvel']['ironman']['antagonists'] = 'Ultron'
>>> print(config.serialize())
{
  "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

Or, if you have virtualenvwrapper installed

$ mkvirtualenv json_config
$ pip install json_config

Uninstall

$ pip uninstall json_config

Usage

To use json_config in a project:

import json_config

config = json_config.connect('config.json')
config['root'] = '/var/www/html/'

print(config['root'])
#OUT: '/var/www/html/'
config
#OUT:  Connect({'root': '/var/www/html/'})

Credits

Tools used in rendering this package: