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.1

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.1
File Size Uploaded Provenance Actions
casconf-1.0.1.tar.gz 55.6 kB With provenance Details for casconf-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 84.7 kB

Release files / casconf-1.0.1.tar.gz

Download URL casconf-1.0.1.tar.gz
Size 55.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8fd7c38bf79dfeffdcfa28ba9156294d587cd1ff947094006ca0ebda8c508a96
BLAKE2b-256 checksum
How to use checksums
3dedac43fd091bd050517fff69831b9d1f516a97401115e9ef78266f82d8e986
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.1-py3-none-any.whl

Download URL casconf-1.0.1-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5982020373dc141ca7635581106a0e989b7948bed2af1310a585b83f31acf3c8
BLAKE2b-256 checksum
How to use checksums
958e2bc4238418a09f878e9e7197e4a1275e89add1dd4d9dd1b90143fb50cf22
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.1

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.1.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