Skip to main content

Handles configuration saved as JSON files.

Project description

ConfigViper is a set of Python classes for handling configuration files saved in JSON format. For example:

from configviper import ConfigViper

ConfigViper.configure()

conf = ConfigViper()
conf.set('a.b.c', 'd')

And the JSON file will looks like:

{
    "a": {
        "b": {
            "c": "d"
        }
    }
}

Goals

  1. Simple to define default values (avoiding “defaults” everywhere);

  2. Simple to write converters between Python and JSON types (even for complex Python types);

  3. Human editable format (JSON is readable enough);

  4. Portable configuration format (JSON is portable enough);

  5. Easy to add configuration options without destroying existing ones;

  6. Accessible anywhere in the app code (avoiding singleton’s boring discussions);

  7. Small and really simple.

Installation

Install ConfigViper using pip install ConfigViper command. If you downloaded the sources from PyPI go to ConfigViper-<version> directory and type python setup.py install command. You can also get the sources from BitBucket repository (you will need Mercurial SCM installed on your system):

hg clone https://bitbucket.org/danielgoncalves/configviper

More Documentation

For usage example and more information, please refer to the documentation available on-line.

Licensing

ConfigViper is licensed under GNU’s LGPL.

Change History

Version 0.1

  • Released 12 march 2012.

Version 0.2

  • Released 18 march 2012;

  • Documentation hosted on PyPI.

Version 0.3

  • Released 14 april 2012;

  • Default config-path separator changed from / to .;

  • Configuration values can be accessed like object attributes:

    # using the get() method
    conf.get('a.b.c')
    
    # or like object attributes
    conf.a.b.c

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

ConfigViper-0.3.tar.gz (30.7 kB view details)

Uploaded Source

File details

Details for the file ConfigViper-0.3.tar.gz.

File metadata

  • Download URL: ConfigViper-0.3.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ConfigViper-0.3.tar.gz
Algorithm Hash digest
SHA256 0445c6182a1857a0c266586cf778d7545dfeda072028e43a190bcd47d660c2e2
MD5 854b0b32abaebfca6462b1fc04df427e
BLAKE2b-256 768517c7b3048502e487521837ea370d62c4fd6669d366a66f78b0a412aef60a

See more details on using hashes here.

Supported by

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