A Python library for DRY configuration management with inheritance patterns and secure configuration merging.
Project description
Welcome to configcraft Documentation
A Python library for DRY (Do not repeat yourself) configuration management with inheritance patterns and secure configuration merging.
📚 Full documentation is available at HERE
Key Features:
🔄 Configuration Inheritance: Use _defaults sections to eliminate duplication across environments
🔒 Secure Config Merging: Safely combine non-sensitive config with secrets without exposing credentials
🎯 JSON Path Patterns: Apply defaults with flexible *.field and env.field patterns
📋 List Merging: Intelligently merge lists by position to maintain data relationships
🛡️ Type Safety: Structure-aware merging with validation and clear error messages
Quick Example
Configuration Inheritance:
from configcraft.api import apply_inheritance
config = {
"_defaults": {
"*.port": 8080,
"*.timeout": 30
},
"dev": {
"host": "localhost"
},
"prod": {
"host": "api.company.com",
"port": 443
}
}
apply_inheritance(config)
# Result:
# {
# "dev": {
# "host": "localhost",
# "port": 8080,
# "timeout": 30
# },
# "prod": {
# "host": "api.company.com",
# "port": 443,
# "timeout": 30
# }
# }
Secure Configuration Merging:
from configcraft.api import deep_merge
# config.json (safe to commit)
base_config = {
"database": {
"host": "prod-db.com",
"port": 5432
}
}
# secrets.json (never commit)
secrets = {
"database": {
"password": "secret123"
}
}
final_config = deep_merge(base_config, secrets)
# Result:
# {
# "database": {
# "host": "prod-db.com",
# "port": 5432,
# "password": "secret123"
# }
# }
Install
configcraft is released on PyPI, so all you need is to:
$ pip install configcraft
To upgrade to latest version:
$ pip install --upgrade configcraft
Project details
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
Built Distribution
File details
Details for the file configcraft-0.1.2.tar.gz
.
File metadata
- Download URL: configcraft-0.1.2.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
619e86c3b3efed176a576a33f8eff16c27dfe265831d52dc4c2b1d6e834e4f21
|
|
MD5 |
366175bdae03986d374e40fb664f0a7d
|
|
BLAKE2b-256 |
5276b26843e274c44f75073b1385a99c59cf48b442de835cf55684f80bfba8e4
|
File details
Details for the file configcraft-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: configcraft-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bd5664db080476b9da581147d79f9dc2dc079386a843d0b08267ee46adf2487f
|
|
MD5 |
de90554f6231fec0b1bdcfb319f64d16
|
|
BLAKE2b-256 |
f7542e4f76297738c8fef64f388eb3819f8ec42b54b9eef486d87d4e4646bb02
|