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.1.tar.gz (37.1 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.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: molcrafts_molcfg-1.4.1.tar.gz
  • Upload date:
  • Size: 37.1 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.1.tar.gz
Algorithm Hash digest
SHA256 1b289fc89c50c9c27b5126a869cd106e4e314e6090dd8dc61c21a508d41698ed
MD5 356408b5afece45dce5c0920b27f52e5
BLAKE2b-256 c0aaaf8bdb1bf3372e63ba1eb0a3ab8e7cf77dfc54ba524bc9b3803349ef95f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_molcfg-1.4.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for molcrafts_molcfg-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d6a041be9af0f44d6aef769dee8997f39b5b034c4e054c826fff2343c0e1fd98
MD5 14ae6a256c9daaa58c231095109ccefc
BLAKE2b-256 d3b895d9328c26e197e1481838d7f7ec8252482c9ddbcc169c331a7353b275eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_molcfg-1.4.1-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