Skip to main content

Configuration library for the molcrafts ecosystem

Project description

molcfg

CI PyPI Ruff Python License

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

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")}
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

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

molcrafts_molcfg-1.4.0.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

molcrafts_molcfg-1.4.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file molcrafts_molcfg-1.4.0.tar.gz.

File metadata

  • Download URL: molcrafts_molcfg-1.4.0.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for molcrafts_molcfg-1.4.0.tar.gz
Algorithm Hash digest
SHA256 fa5583c7d322a19146fb6e6b3f4b6e08b66cc450788fbe9c3e8170d896e6277e
MD5 f8cea8a6808a5af8e29e4e6831052df1
BLAKE2b-256 f175c52d7d2c374a477df60337550bca52baf15ff47ac9ac6114f91b55597ebc

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_molcfg-1.4.0.tar.gz:

Publisher: release.yml on MolCrafts/molcfg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file molcrafts_molcfg-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for molcrafts_molcfg-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4ab8ccc692348472cf7f209cb0cfe61c0adfa7ce6b7c080f897b77413ca23e7
MD5 a976ce2e26d82767f48c75142e449aba
BLAKE2b-256 d6e2c6f935e5d35759581a7999d457f876998282a9506c337b9d7f607891ee80

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_molcfg-1.4.0-py3-none-any.whl:

Publisher: release.yml on MolCrafts/molcfg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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