Configuration library for the molcrafts ecosystem
Project description
molcfg
Layered configuration for Python — predictable loading, merging, validation, and source tracking.
molcfg loads configuration from dicts, files, environment variables, and CLI
arguments into a single layered Config, remembering where every value came
from. It adds schema validation, string-tag construction, interpolation, and
thread-safe access on top.
Capabilities
| Module | Capability |
|---|---|
config |
Config container — attribute and dotted-path access, freeze, snapshot/rollback, change notification, JSON/TOML/YAML round-trip |
source |
Config sources — DictSource, JsonFileSource, TomlFileSource, YamlFileSource, EnvSource, CliSource behind a common Source interface |
merge |
OVERRIDE / APPEND / DEEP_MERGE strategies, ConfigLoader for layered loading, and ProfileLoader for profile-based config |
validation |
Type-and-constraint validation — Range, OneOf, Pattern, Length descriptors, Build, and the validate entry point |
registry |
Registry — maps string keys (e.g. "silu") to factories, resolving short and long forms into classes or instances |
concurrency |
ThreadSafeConfig wrapper, POSIX FileLock, and the ${path} / ${env:VAR} interpolate engine |
paths |
project_config_dir — resolves and creates the shared ~/.molcrafts/<name>/config/ directory |
errors |
Exception hierarchy — ConfigError, FrozenConfigError, CircularReferenceError, ValidationError |
Install
pip install molcrafts-molcfg
Requires Python 3.12+. The only runtime dependency is pyyaml.
Quick start
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")}
Documentation
Full documentation lives in docs/:
MolCrafts ecosystem
| Project | Role |
|---|---|
| molpy | Python toolkit — the shared molecular data model & workflow layer |
| molrs | Rust core — molecular data structures & compute kernels (native + WASM) |
| molpack | Packmol-grade molecular packing (Rust + Python) |
| molvis | WebGL molecular visualization & editing |
| molexp | Workflow & experiment-management platform |
| molnex | Molecular machine-learning framework |
| molq | Unified job queue — local / SLURM / PBS / LSF |
| molcfg | Layered configuration library — this repo |
| mollog | Structured logging, stdlib-compatible |
| molhub | Molecular dataset hub |
| molmcp | MCP server for the ecosystem |
| molrec | Atomistic record specification |
Contributing
See CONTRIBUTING.md.
License
BSD-3-Clause — see LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file molcrafts_molcfg-1.4.2.tar.gz.
File metadata
- Download URL: molcrafts_molcfg-1.4.2.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75c351ca03c78552487d4866394d1ef63c07e2f853ba02f91ec2991e8c19e3dd
|
|
| MD5 |
38bd3b8758207c1204ba0f67e8cfef60
|
|
| BLAKE2b-256 |
5c2726d42088d70c0da60277ad720e65c9bd5f786a75a5f670aad595ac8fa450
|
Provenance
The following attestation bundles were made for molcrafts_molcfg-1.4.2.tar.gz:
Publisher:
release.yml on MolCrafts/molcfg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molcfg-1.4.2.tar.gz -
Subject digest:
75c351ca03c78552487d4866394d1ef63c07e2f853ba02f91ec2991e8c19e3dd - Sigstore transparency entry: 2033092931
- Sigstore integration time:
-
Permalink:
MolCrafts/molcfg@68d8b75f5ee5c607f5a2428b721a60ed19dd0bf5 -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@68d8b75f5ee5c607f5a2428b721a60ed19dd0bf5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file molcrafts_molcfg-1.4.2-py3-none-any.whl.
File metadata
- Download URL: molcrafts_molcfg-1.4.2-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30170debb26ca77afc24ca543aaf259e801be0ad729df1a44f4af53bd60c20f6
|
|
| MD5 |
70e245fea9fe7b44ce3ec531fa6c81ea
|
|
| BLAKE2b-256 |
e5ae195b755fa697ee1fdb3bcdf7d525dc1e1a07f19bab9c6b02c70801d93d46
|
Provenance
The following attestation bundles were made for molcrafts_molcfg-1.4.2-py3-none-any.whl:
Publisher:
release.yml on MolCrafts/molcfg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molcfg-1.4.2-py3-none-any.whl -
Subject digest:
30170debb26ca77afc24ca543aaf259e801be0ad729df1a44f4af53bd60c20f6 - Sigstore transparency entry: 2033093123
- Sigstore integration time:
-
Permalink:
MolCrafts/molcfg@68d8b75f5ee5c607f5a2428b721a60ed19dd0bf5 -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@68d8b75f5ee5c607f5a2428b721a60ed19dd0bf5 -
Trigger Event:
push
-
Statement type: