Skip to main content

Priority-based config loader for qdata ecosystem — hunts config.yaml/.env from home dir upward through parent dirs

Project description

qcload

Priority-based config loader for qdata ecosystem.

Quick start

from qcload import config, load_config, load_from_path

# Auto-search (global singleton, lazy load)
db_url = config["DATABASE_URL"]

# Functional call (new instance each time)
cfg = load_config()

# Load from specific file path
cfg = load_from_path("/path/to/my/config.yaml")

# Reload the global singleton
config = reload_config()

Search priority

qcload searches for config files in this order (first found wins):

  1. ~/config.yaml (user home)
  2. ~/.env
  3. ./config.yaml (current directory)
  4. ./.env
  5. ../config.yaml (parent)
  6. ../.env
  7. ../../config.yaml (grandparent)
  8. ../../.env

Config object

cfg = load_config()

# Dict access
cfg["DATABASE_URL"]

# Attribute access (nested yaml)
cfg.database.host

# Type helpers
cfg.get_int("PORT", 8080)
cfg.get_bool("DEBUG", False)
cfg.get_float("RATE", 0.0)
cfg.get_list("HOSTS", [])

# Metadata
cfg.source       # Path to the loaded file
cfg.file_type    # "yaml" or "env"
cfg.is_empty     # True if no keys loaded

License

MIT

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

qcload-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

qcload-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file qcload-0.1.0.tar.gz.

File metadata

  • Download URL: qcload-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for qcload-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56a248f465821d4740e5b995cef9ba7c0f71f75a725b3a57969e599214c2d7a3
MD5 e588feaf59932eca69ffaae01bc97467
BLAKE2b-256 b9312ad77d0319031346a26427e93f7a9f246077596dddeb937970ec4fa0a42b

See more details on using hashes here.

File details

Details for the file qcload-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qcload-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for qcload-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 005cc0f0513903e91e2d3382865f8611afaee7dadcfefd97b4426ae2e74d7acd
MD5 ead2842ede8c52a2e2ba923deaab5ee9
BLAKE2b-256 5333873751e9964fd7a270fa275fb03b9d12797ef5842c39757108c265281b87

See more details on using hashes here.

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