Skip to main content

configclass - A Python to class to hold configuration values

https://travis-ci.org/schettino72/configclass.png?branch=master https://coveralls.io/repos/schettino72/configclass/badge.png

A Config is a dict with a where:

  • existing items can be modified but no items can not be added

  • has make() method so you can easily created derived configs

  • make() has the same API as dict.update()

  • make() will merge values according to mergedict.ConfigDict.merge()

  • for convenience, make can take a None to perform a simple copy

>>> from configclass import Config

>>> c1 = Config({'a': 1, 'b': ['foo']})

# can't add new items to config
>>> c1.make({'a':2, 'c': [2]})
Traceback (most recent call last):
KeyError: 'New items can not be added to Config, invalid key:c'

# new config object created
>>> c2 = c1.make({'a':2})
>>> c2
Config({'a': 2, 'b': ['foo']})

# original object is not modified
>>> c1
Config({'a': 1, 'b': ['foo']})

# make() can take keyword arguments, note how lists are merged
>>> c2.make(b=['bar'])
Config({'a': 2, 'b': ['foo', 'bar']})

configclass.ConfigMixin can be used to create a Config class that is not based on mergedict.ConfigDict. Check unittests for usage.

Project Details

license

The MIT License Copyright (c) 2014 Eduardo Naufel Schettino

see LICENSE file

developers / contributors

  • Eduardo Naufel Schettino

install

$ pip install configclass

or download and:

$ python setup.py install

tests

Install dependencies in dev_requirements.txt.

To run the tests:

$ py.test

Release files for configclass 0.2.0

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

Source distribution (sdist)

Source distribution for configclass 0.2.0
File Size Uploaded
configclass-0.2.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for configclass 0.2.0
File Interpreter ABI Platform
configclass-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / configclass-0.2.0.tar.gz

Download URL configclass-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6a80ca06e0f12427976d5c025e1b1ee8509b0c3337d3f5daf29f6a46f0e45819
BLAKE2b-256 checksum
How to use checksums
1fb57972458f6dabe24fa0b957aa80348c1e1236db856d653810c4b2092f9d8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10

Release files / configclass-0.2.0-py3-none-any.whl

Download URL configclass-0.2.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c94dfebfe3dbb89e494eebc8b7c5de3d448790ba6436c49308efa2a30d3bae78
BLAKE2b-256 checksum
How to use checksums
5caddd5a109f1fb55b5f4188a9b8fa90bc20617e363ee87e0968fe13dc8ae3dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

1 release file

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