Skip to main content

Load stacks of JSON, TOML or YAML data

Project description

CfgStack is a configfile system reader. System? Yeah. In reading and parsing one file, CfgStack can be directed to go read other files and to incorporate their contents into the growing dataset.

CfgStack ("somefile")

Attempts to load the named file as JSON/YAML/TOML with default extensions of json/yaml/yml/toml (can be over-ridden). The loaded object must be a dictionary. The “data” member of the resulting object is an addict Dict of the loaded dataset. So far so simple.

_include_:
  - file1
  - file2
_default_:
  zero: 0
  one: 1
foo:
  this: that
  zero: null
var: value
bar:
  _default_:
    inner: inside_bar
  inside:
    oh: boy
    yep: really
baz:
  _include_:
    - file3

A few things going on here:

  • “_include_” keys are assumed to list additional data files which will be loaded and their contents merged with the dictionary at the same level. If multiple files are listed, they will be applied in order from the top down. Files are searched for in the CWD or optionally in a list of passed paths.

  • “_default_” keys provide default key:value pairs for all dictionary values at the current level

Note that all includes are applied first, then all defaults. Higher level values override lower level values, across both includes and defaults (includes first) and both for contents and data-type.

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

cfgstack-0.2.post5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

cfgstack-0.2.post5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file cfgstack-0.2.post5.tar.gz.

File metadata

  • Download URL: cfgstack-0.2.post5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.12.21-amd64

File hashes

Hashes for cfgstack-0.2.post5.tar.gz
Algorithm Hash digest
SHA256 ba264e868cc9588dbc3ffb7c6e66e0ec9aa3536035c93f81135879039553465f
MD5 ff1cc95039052ad91a728a8745385534
BLAKE2b-256 4d54387ae220a8e2746a96142a17ccfd5182bbb21415cc518c2b2495eb4d98cb

See more details on using hashes here.

File details

Details for the file cfgstack-0.2.post5-py3-none-any.whl.

File metadata

  • Download URL: cfgstack-0.2.post5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.12.21-amd64

File hashes

Hashes for cfgstack-0.2.post5-py3-none-any.whl
Algorithm Hash digest
SHA256 1b3753580f220647ff948ba467579451727bac064713cca2800cac54b757b322
MD5 d8cc0df15d8f9279646c762c407175f9
BLAKE2b-256 1e6b68cf6765442c3211d52149ba67efaff6a5d32cc2fda21d210b3783fd277a

See more details on using hashes here.

Supported by

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