Skip to main content

A Python library for DRY configuration management with inheritance patterns and secure configuration merging.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

configcraft-0.1.2.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

configcraft-0.1.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

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

Hashes for configcraft-0.1.2.tar.gz
Algorithm Hash digest
SHA256 619e86c3b3efed176a576a33f8eff16c27dfe265831d52dc4c2b1d6e834e4f21
MD5 366175bdae03986d374e40fb664f0a7d
BLAKE2b-256 5276b26843e274c44f75073b1385a99c59cf48b442de835cf55684f80bfba8e4

See more details on using hashes here.

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

Hashes for configcraft-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bd5664db080476b9da581147d79f9dc2dc079386a843d0b08267ee46adf2487f
MD5 de90554f6231fec0b1bdcfb319f64d16
BLAKE2b-256 f7542e4f76297738c8fef64f388eb3819f8ec42b54b9eef486d87d4e4646bb02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page