Skip to main content

Programmatic configuration library for Python 3.

Project description

ConfigMaster

Build Status

What is ConfigMaster?

ConfigMaster is a simple library for accessing config files programmatically. No longer will you have to mess with list lookups and dict lookups when you wish to load a config file.
Instead, objects in the file are accessed as simple class attributes.

What is supported

ConfigMaster natively supports JSON and YAML formats.
The recommended format is YAML.

TODO

  • [STRIKEOUT:Add in support for python ConfigParser formats] Added in version 1.4.0

  • [STRIKEOUT:Add in networked JSON support] Added in version 1.3.0

  • Add more docstrings

  • Make proper documentation

  • [STRIKEOUT:Add tests] Added in version 1.3.1

How to install

For the latest stable version uploaded to PyPI, use:
pip install configmaster
For the latest stable version uploaded to bitbucket, use:
pip install hg+https://bitbucket.org/SunDwarf/configmaster
For the latest dev version, use:
pip install hg+https://bitbucket.org/SunDwarf/configmaster@dev

How to use

ConfigMaster handles everything for you. Simply specify the location of your file, and the values will be automatically loaded for you.

>>> from configmaster import YAMLConfigFile
>>> cfg = YAMLConfigFile.YAMLConfigFile("test.yml") # Created automatically if it doesn't exist

To access config values, simply get the attribute you want from the config object stored.

# YAML data is {"a": 1, "b": [1, 2], "c": {"d": 3}}
>>> cfg.config.a
1
>>> cfg.config.b[1]
2
>>> cfg.config.c.d
3

To populate your config data, just pass a dict to initial_populate. If the file is empty, this gives it default values, and returns True. If it isn’t, nothing happens.

>>> pop = cfg.initial_populate({"a": 1, "b": [1, 2], "c": {"d": 3})
>>> if pop: cfg.dump() and cfg.reload() # Dump data and reload from disk.

To save your data, simply run .dump().

>>> cfg.dump()

Need to get the raw dict form of a ConfigKey? Use .dump() on that!

>>> cfg.config.dump()
{"a": 1, "b": [1, 2], "c": {"d": 3}
>>> cfg.config.c.dump()
{"d": 3}

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

ConfigMaster-1.5.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distributions

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

ConfigMaster-1.5.0-py3.4.egg (21.3 kB view details)

Uploaded Egg

ConfigMaster-1.5.0-py3.3.egg (21.5 kB view details)

Uploaded Egg

ConfigMaster-1.5.0-py3.2.egg (21.0 kB view details)

Uploaded Egg

ConfigMaster-1.5.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file ConfigMaster-1.5.0.tar.gz.

File metadata

  • Download URL: ConfigMaster-1.5.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ConfigMaster-1.5.0.tar.gz
Algorithm Hash digest
SHA256 33d7639340fb59799875b66e984e5c14ad4cc54f815fb33205fd890343b55868
MD5 92165dffbc52429f6050faaad0a35658
BLAKE2b-256 6dc2aece24ceaccc43439e91287d3be8b5cb035a2ca6e18027c5fbea0b29249c

See more details on using hashes here.

File details

Details for the file ConfigMaster-1.5.0-py3.4.egg.

File metadata

File hashes

Hashes for ConfigMaster-1.5.0-py3.4.egg
Algorithm Hash digest
SHA256 b402c3f418aa5faaab3e4e9c08c02a25c8495b79321d81c5fadb1cd62a79ff3d
MD5 79595785d8bde786d551588a556c3c67
BLAKE2b-256 f346e61bba296680eefe7dd877bd4af16047795c0354ba611528add368e3b65a

See more details on using hashes here.

File details

Details for the file ConfigMaster-1.5.0-py3.3.egg.

File metadata

File hashes

Hashes for ConfigMaster-1.5.0-py3.3.egg
Algorithm Hash digest
SHA256 696b5e5c54f31e80accb0a81bdcba147d47d0e6b204dd4ea70c56c2224c8732d
MD5 4fc62024e41a2931dd6889b48c12d02d
BLAKE2b-256 b153011a92f58a105e620b1f0ef264fc258c38c8d7cfac365dae470516bd2fc3

See more details on using hashes here.

File details

Details for the file ConfigMaster-1.5.0-py3.2.egg.

File metadata

File hashes

Hashes for ConfigMaster-1.5.0-py3.2.egg
Algorithm Hash digest
SHA256 e66e151e2e5dfbbff8d1b66f8fdfa50f5fc84ffca3401656edb2113abc9b1508
MD5 d41e779ff221cee1f3634b9cb074a2b3
BLAKE2b-256 46427fbb1c625adf2b76d6c519032e921b807470f65f1c25c98bbce36c59f1ff

See more details on using hashes here.

File details

Details for the file ConfigMaster-1.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ConfigMaster-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46db0919940e082c13bc9fa6ad49f15da75a341a24d8f8c7f09e932e0cd1c772
MD5 d1a421cd80d99136d80cc01a111c993b
BLAKE2b-256 1db1fc74ba64ff736eb23370f1a963adbb3ed0324c57e8c88fd50bccfffa5f8f

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