Skip to main content

ConfigMaster

Build Status PyPI version PyPI DailyDownloads Coverage 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 supports the following formats built-in:

  • YAML Config Files (through the PyYAML module)

  • JSON Config Files (through json)

  • INI Config Files (through ConfigParser)

  • Networked versions of YAML/JSON files.

Support for different types of config files grows all the time - feel free to fork and add support!

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 git, use:
pip install git+ssh://cloning@git.sundwarf.me/SunDwarf/configmaster
For the latest dev version, use:
pip install git+ssh://cloning@git.sundwarf.me/SunDwarf/configmaster@develop

After installing, running the tests is recommended.

py.test -rfEsxXw -v --strict test.py

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

Networked config files are supported too.

>>> from configmaster import JSONConfigFile
>>> cfg = JSONConfigFile.NetworkedJSONConfigFile("http://example.com/data.json")

To access config values, 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. Note: This will fail with an exc.NetworkedFileException on networked files!

>>> 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, run .dump().

>>> cfg.dump()

Have a networked file that you need to save? Use the method save_to_file.

>>> cfg.save_to_file("example.json")

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}

Metadata

Release files for ConfigMaster 2.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ConfigMaster 2.3.6
File Size Uploaded Provenance Actions
ConfigMaster-2.3.6.tar.gz 8.8 kB Without provenance Details for ConfigMaster-2.3.6.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ConfigMaster 2.3.6
File Actions
ConfigMaster-2.3.6-py3.5.egg Legacy Egg format - - Details for ConfigMaster-2.3.6-py3.5.egg
ConfigMaster-2.3.6-py3.4.egg Legacy Egg format - - Details for ConfigMaster-2.3.6-py3.4.egg
ConfigMaster-2.3.6-py3.3.egg Legacy Egg format - - Details for ConfigMaster-2.3.6-py3.3.egg
ConfigMaster-2.3.6-py3.2.egg Legacy Egg format - - Details for ConfigMaster-2.3.6-py3.2.egg

Total release size: 107.8 kB

Release files / ConfigMaster-2.3.6.tar.gz

Download URL ConfigMaster-2.3.6.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
89c151bc9fbfefe20883e70391fc5fb4a2ad63c339e9d9cc89af6bcb89fb98f0
BLAKE2b-256 checksum
How to use checksums
7eec13fab43645bacc027f864ecddac0a3b353442ffed9a87344132818084139
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ConfigMaster-2.3.6-py3.5.egg

Download URL ConfigMaster-2.3.6-py3.5.egg
Size 24.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
527942c41250c66511e6818e112c8c7423d169dc1932b0ed4110ef3c58c3e3ee
BLAKE2b-256 checksum
How to use checksums
f7a544b2876a99d204d0c0cbc623c892ec1cfb3305f1935d82130020cc4322e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ConfigMaster-2.3.6-py3.4.egg

Download URL ConfigMaster-2.3.6-py3.4.egg
Size 24.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
bf233e0a5beacc09b9ab58a7d11f68583eca0bd0c9a827c89d742e4f9117d9d8
BLAKE2b-256 checksum
How to use checksums
3453f1effc4316dde332981eeafb658fb0e5aa2d3e55a21ba968732073096793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ConfigMaster-2.3.6-py3.3.egg

Download URL ConfigMaster-2.3.6-py3.3.egg
Size 25.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
17aadb561e3d5a9c60d544677c646027c9496a55e1dd6bb9f9d0fb8cb7a27ad1
BLAKE2b-256 checksum
How to use checksums
7a2d202dbe206ef55acd175bea315b4f3d17b335be702a205802426977cf4c32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ConfigMaster-2.3.6-py3.2.egg

Download URL ConfigMaster-2.3.6-py3.2.egg
Size 24.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
39660066f24acc5b0990abd6a12bd0f10d62f82fcc2bce63c728943882412d21
BLAKE2b-256 checksum
How to use checksums
8b686e191476493ee0854dca73ef2f57d4e005d5233b395d751603664fbc6247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ConfigMaster 2.3.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.3.6 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page