Skip to main content

CasConf

Cascading Configuration Manager

CasConf is a flexible configuration management tool that deep-merges configuration files across multiple directories following a cascading pattern.

Overview

CasConf scans a configurable list of directories for matching configuration files and intelligently deep-merges them based on discovery order. The result is a single, unified configuration that respects the cascade hierarchy you define.

Key Features

  • Deep Merging: Recursively merges nested configuration structures
  • Format Agnostic: Supports JSON, YAML, TOML, and INI formats
  • Configurable Discovery: Define your own directory scan order

Use Cases

  • Application configuration across development, staging, and production environments
  • User-specific configuration overrides (system → user → project)
  • Plugin or module configuration aggregation
  • Multi-tenant configuration management
  • Dotfile management and system configuration

Documentation

Installation

# From PyPI
pip install casconf

# From source
pip install git+https://github.com/ConsoleCatzirl/casconf.git@main

Basic Usage

Command-Line Interface

# Merge configs and output to stdout (default)
casconf --discovery-config ./casconf.yaml

# Output to a file
casconf --discovery-config ./casconf.yaml --output ./merged.json

# Specify output format
casconf --discovery-config ./casconf.yaml --format yaml

# Configure with environment variables
export CASCONF_DISCOVERY=./casconf.yaml
export CASCONF_OUTPUT=./merged.json
export CASCONF_FORMAT=json
casconf

# Pipe to other tools
casconf | jq '.database'

Library Usage

from casconf import merge_configs

# Merge and return configuration data
config_data = merge_configs(discovery_config='./casconf.yaml')

# Merge and write to file in one call
merge_configs(
    discovery_config='./casconf.yaml',
    output='./output/config.json',
    output_format='json'
)
from casconf import merge_configs, DiscoveryConfig

# Build a DiscoveryConfig programmatically (no file required)
discovery = DiscoveryConfig(
    directories=[
        '/etc/myapp/defaults',
        '/etc/myapp/$ENVIRONMENT',   # expanded at runtime, e.g. production
        '~/.config/myapp',
    ],
    patterns=['config.json', 'config.yaml'],
    merge_strategy='deep',
)

config = merge_configs(discovery_config=discovery)

Discovery Configuration

CasConf uses a discovery configuration file to determine where to search for configuration files:

# casconf.yaml
directories:
  - /etc/myapp/defaults        # site-wide defaults
  - /etc/myapp/$ENVIRONMENT    # environment-specific overrides, e.g. production, staging
  - /etc/myapp/$HOSTNAME       # host-specific overrides, e.g. web-01.example.com
  - ~/.config/myapp            # user overrides (highest priority)

patterns:
  - "config.json"
  - "config.yaml"
  - "*.conf.json"

merge_strategy: deep  # or 'shallow'

Directory paths support ~ expansion and $VAR / ${VAR} environment variable expansion. Missing directories are skipped with a warning — no error is raised. See USAGE.md for a full walkthrough.

License

This project is dual-licensed:

  • MIT License: When used as a standalone executable (CLI tool)
  • GNU General Public License v3.0 (GPL-3.0): When imported or linked as a library

See LICENSE for full details.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

This project follows PEP 8 style guidelines and emphasizes simplicity and maintainability.

Metadata

Release files for casconf 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for casconf 1.0.2
File Size Uploaded Provenance Actions
casconf-1.0.2.tar.gz 55.7 kB With provenance Details for casconf-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for casconf 1.0.2
File Interpreter ABI Platform Actions
casconf-1.0.2-py3-none-any.whl Python 3 none any Details for casconf-1.0.2-py3-none-any.whl

Total release size: 84.8 kB

Release files / casconf-1.0.2.tar.gz

Download URL casconf-1.0.2.tar.gz
Size 55.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c0819ea1e42a60b69a86bb90fbb7ecaae16fe927d3cdaa1bdc84760ab8092943
BLAKE2b-256 checksum
How to use checksums
d314b2e20d664c48e0ee3925f4ca95648ad1757bc29506234b4284ae81c470fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / casconf-1.0.2-py3-none-any.whl

Download URL casconf-1.0.2-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a962d1f9dbf6436da0958bcbe1e27e1f4f46e99b3fc2e572afd8003de319ffa
BLAKE2b-256 checksum
How to use checksums
19c0eb31c1c09b9a77007f5df122616a92f9dc65b8a0a5e342a3531e1dd9b81b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for casconf 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for casconf-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page