configmanager 1.19.0
pip install configmanager==1.19.0
Released:
Extensible, object-oriented manager of configuration items and configuration trees of arbitrary depth
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Jazeps Basko
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
Project description
Don’t let standard library’s configparser drive your configuration value access design. Let it do what it does best – parse and write configuration files. And let configmanager do the rest.
Main Features
Every configuration item is an object with a type, a default value, a custom value and other metadata
No sections required
Any depth of sections allowed
INI (ConfigParser), JSON, YAML formats
click framework integration
Designed for humans
Documentation
Source Code and Issue Tracking
Quick Start
pip install configmanager
from configmanager import Config
config = Config({
'uploads': {
'threads': 1,
'enabled': False,
'db': {
'user': 'root',
'password': '',
'hostname': 'localhost',
'database': 'uploads',
},
},
'secret': {
'@required': True,
}
})
config.json.load('defaults.json', as_defaults=True)
config.configparser.load('env-config.ini')
config.yaml.load('user-config.yaml')
>>> config.uploads.threads.type
<_IntType ('int', 'integer')>
>>> config.uploads.enabled.type
<_BoolType ('bool', 'boolean')>
>>> config.uploads.enabled.value = 'yes'
>>> config.uploads.enabled
<Item enabled True>
>>> config.uploads.enabled.value
True
>>> config.uploads.enabled.is_default
False
>>> config.uploads.enabled.reset()
>>> config.uploads.enabled
<Item enabled False>
>>> config.secret.value
# ... stacktrace skipped ...
RequiredValueMissing: secret
>>> config.secret.get('f811b8ck-s3cr3t')
'f811b8ck-s3cr3t'
>>> config.secret.has_value
False
>>> config.dump_values(with_defaults=False)
{}
>>> config.dump_values()
{'uploads': {'db': {'database': 'uploads',
'hostname': 'localhost',
'password': '',
'user': 'root'},
'enabled': False,
'threads': 1}}
>>> config.yaml.dump('all-config.yaml', with_defaults=True)
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Jazeps Basko
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file configmanager-1.19.0.tar.gz
.
File metadata
- Download URL: configmanager-1.19.0.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e93cf3db89d25ade8455b493a457571f38189f4b04236b527ea3f8f2d9f39da3 |
|
MD5 | 0c26d8bb62ca3c0e6e131571adadbfb1 |
|
BLAKE2b-256 | f8a497a3c35bc0fbb9c41795084f3d7e1359bcb620f4ce853e958f0553502e70 |