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
Metadata
Release files for configcraft 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| configcraft-0.1.2.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| configcraft-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.3 kB
Release files / configcraft-0.1.2.tar.gz
| Download URL | configcraft-0.1.2.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
619e86c3b3efed176a576a33f8eff16c27dfe265831d52dc4c2b1d6e834e4f21
|
|
BLAKE2b-256 checksum How to use checksums |
5276b26843e274c44f75073b1385a99c59cf48b442de835cf55684f80bfba8e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|
Release files / configcraft-0.1.2-py3-none-any.whl
| Download URL | configcraft-0.1.2-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd5664db080476b9da581147d79f9dc2dc079386a843d0b08267ee46adf2487f
|
|
BLAKE2b-256 checksum How to use checksums |
f7542e4f76297738c8fef64f388eb3819f8ec42b54b9eef486d87d4e4646bb02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|