Skip to main content

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:

History

Next Release

  • Stay tuned

2.0.0 (2016-01-01)

  • BREAKING: (Internal API) connect.block removed

  • BREAKING: (Internal API) connect.write_file renamed to connect.save

  • Feature: Rewrote the entire library to encapsulate logic

  • Feature: Extendable serializer contract, to allow any config format.

  • Feature: Upgrade to stable.

  • Feature: Removed threading in favor of a smarter locking mechanism

  • Feature: Add support for py26 and py35

  • Feature: Pin dependencies

  • Feature: Reorganized package and tests

  • Fix: Updated doc builds

  • Fix: Readme badge links

  • 2.0.1: Fix: Failed deploy (travis requirements)

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.

Metadata

Release files for json_config 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json_config 2.0.1
File Size Uploaded Provenance
json_config-2.0.1.tar.gz 32.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for json_config 2.0.1
File Interpreter ABI Platform
json_config-2.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 42.3 kB

Release files / json_config-2.0.1.tar.gz

Download URL json_config-2.0.1.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2b71cfd942720054f2c3dfb0a2fd610241ddd1b61f1c28197f35841d920fdd1e
BLAKE2b-256 checksum
How to use checksums
7c07ac294f4a9c5a533c6a6810c2064f4d6be2197b91c36f3df4d383be649c56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / json_config-2.0.1-py2.py3-none-any.whl

Download URL json_config-2.0.1-py2.py3-none-any.whl
Size 9.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
db006461ba2dc77bb63ee65f483da30f31b8ad8b4a2e724f6db2898c7456e679
BLAKE2b-256 checksum
How to use checksums
6a1e3d254b26a773d1ee4ddf110ab5c947b22b6634a04503811294ac9497c30b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for json_config 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page