Metadata-Version: 2.4
Name: molcrafts-molcfg
Version: 1.4.0
Summary: Configuration library for the molcrafts ecosystem
Author: Roy Kid
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/MolCrafts/molcfg
Project-URL: Documentation, https://github.com/MolCrafts/molcfg/tree/master/docs
Project-URL: Repository, https://github.com/MolCrafts/molcfg
Project-URL: Issues, https://github.com/MolCrafts/molcfg/issues
Project-URL: Changelog, https://github.com/MolCrafts/molcfg/blob/master/CHANGELOG.md
Keywords: config,configuration,environment,validation,merge
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.11; extra == "dev"
Provides-Extra: docs
Requires-Dist: zensical>=0.0.32; extra == "docs"
Dynamic: license-file

# molcfg

[![CI](https://github.com/MolCrafts/molcfg/actions/workflows/ci.yml/badge.svg)](https://github.com/MolCrafts/molcfg/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/molcrafts-molcfg.svg)](https://pypi.org/project/molcrafts-molcfg/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Python](https://img.shields.io/badge/python-3.12%2B-3776AB.svg?logo=python&logoColor=white)](./pyproject.toml)
[![License](https://img.shields.io/badge/license-BSD--3--Clause-16A34A.svg)](./LICENSE)

Configuration library for Python — layered sources, profiles, validation, and source tracking.

## Quick Start

```python
from molcfg import CliSource, ConfigLoader, DictSource, EnvSource

cfg = ConfigLoader([
    DictSource({"db": {"host": "localhost", "port": 5432}}, name="defaults"),
    EnvSource(prefix="APP", name="env"),
    CliSource(["--db.port=6432"], name="cli"),
]).load()

assert cfg["db.port"] == 6432
assert cfg.meta("db.port") == {"source": "cli", "history": ("defaults", "cli")}
```

```bash
pip install molcrafts-molcfg
```

## Features

- Layered loading from dicts, JSON/TOML/YAML files, environment variables, and CLI arguments
- `DEEP_MERGE`, `OVERRIDE`, and `APPEND` strategies — all return isolated copies
- Recursive schema validation with defaults, strict mode, and built-in constraints
- `Registry` + `Build` to resolve config strings like `"silu"` into classes or instances
- Source tracking via `Config.meta()` for every value
- Attribute and dotted-path access, freeze, snapshot, and rollback
- Thread-safe wrapper and POSIX file lock
- `${path.to.key}` and `${env:VAR}` interpolation

---

Built with love by [MolCrafts](https://github.com/MolCrafts)
