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.post2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cfgstack-0.2.post2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-amd64

File hashes

Hashes for cfgstack-0.2.post2.tar.gz
Algorithm Hash digest
SHA256 45f274ab517fa5d983a81a6dfc26ba2070fcc2ca8c4e7ce5e129e06980f22d5a
MD5 781ec5fd727938173fd4b119e44be6d0
BLAKE2b-256 10857c6f0573b728558de256d815fb4d613ad6e64da80d9865ee617f7a09c2be

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cfgstack-0.2.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c549c1b0707ae954f0339190eef23fd8080081463aeb79380648492af4b3195
MD5 73dd4b418ff9c7b92aeee310605fcc5c
BLAKE2b-256 32e61ae93b0124844721e55e76d9158dc69406efbbc63c6c3beb8a9bbe4d8e21

See more details on using hashes here.

Supported by

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