Release v0.1.2 (What’s new?).

Documentation Status https://github.com/MacHu-GWU/configcraft-project/actions/workflows/main.yml/badge.svg https://codecov.io/gh/MacHu-GWU/configcraft-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/configcraft.svg https://img.shields.io/pypi/l/configcraft.svg https://img.shields.io/pypi/pyversions/configcraft.svg https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to configcraft Documentation

https://configcraft.readthedocs.io/en/latest/_static/configcraft-logo.png

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

Table of Content

About the Author

(\ (\
( -.-)o
o_(")(")

Sanhe Hu is a seasoned software engineer with a deep passion for Python development since 2010. As an author and maintainer of 150+ open-source Python projects, with over 15 million monthly downloads, I bring a wealth of experience to the table. As a Senior Solution Architect and Subject Matter Expert in AI, Data, Amazon Web Services, Cloud Engineering, DevOps, I thrive on helping clients with platform design, enterprise architecture, and strategic roadmaps.

Talk is cheap, show me the code:

API Document