Skip to main content

A convenience utility for working with JSON config files.

Project description

Development Status https://travis-ci.org/bionikspoon/json_config.svg?branch=develop https://img.shields.io/pypi/v/json_config.svg https://coveralls.io/repos/bionikspoon/json_config/badge.svg?branch=develop Documentation Status

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.2, 3.3, 3.4, and PYPY.

  • Saves silently in the background.

  • Unit Tested with high coverage.

  • Fully documented at https://json-config.readthedocs.org

>>> 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

Next Release

  • Stay Tuned.

1.2.0 (2015-05-18)

  • Feature: Improved compatibility to PY27, PY32, PY33, PY34, and PYPY

  • Feature: Supports multiple config files.

  • Feature: Writes less, smarter logic on deciding if a write is necessary.

  • Feature: Delegates writes to a background process.

  • Testing: Renamed tests to be more descriptive of expectations.

  • Testing: Added a bunch of tests describing different scenarios.

  • Massive Refactoring

1.1.0 (2015-04-15)

  • Massive improvement to documentation and presentation.

1.0.0 (2015-04-13)

  • First working version.

0.1.0 (2015-04-11)

  • First release on PyPI.

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.2.0.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

json_config-1.2.0-py2.py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page