Skip to main content

Configiverse

Manage multiple configs across scopes

Configiverse is a library meant to make managing multiple config files easier. It allows the user to assign priorities to different config files, determining which configs setting to give priority to.


Installation

Install as any normal Python package:

pip install configiverse

Usage

Quick Start

You first create a Configiverse object to hold all the configs. Then you can add the config objects. You can also pass a list of Config objects directly to the Configiverse initialization if you want.

Note: You need to know the path to the config file at a minimum.

from configiverse import Configiverse

#Create the initial Configiverse instance
config = Configiverse()

#Add config objects
config.addConfig(TOMLConfig(
	name="global",
	path="/etc/configs/global.toml",
	priority=0
	))
config.addConfig(Config(
	name="user",
	path="/home/user/.config/user.toml",
	priority=10
))

#Note that the "user" Config has a higher priority value than "global". The "user"s config values will overwrite "global"s wherever they match

Once you've added some Configs, you can parse them to generate a dictionary, similar to how most (all?) config parsers in Python work. The Configiverse.parse() method will save the generated dict to Configiverse.config as well as return the dict.

You can also access the items directly through the Configiverse object.

config.parse()

print(config.config)  #Prints the whole config dict
print(config["config_item"])  #Gets a single config item

Advanced Usage

Priority & Parsing Order

Parsing order does matter somewhat, especially with many configs with the same priority.

When running Configiverse.parse(), it will sort the list in priority ascending order. If two priorities match, they will be compared in the order they were added.

It is advised to always use unique priorities for all configs that are added to prevent confusing priority collision situations like this.

Metadata

Release files for configiverse 2.4.2

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

Built distribution (wheel)

Table of built distributions (wheels) for configiverse 2.4.2
File Interpreter ABI Platform Actions
configiverse-2.4.2-py3-none-any.whl Python 3 none any Details for configiverse-2.4.2-py3-none-any.whl

Release files / configiverse-2.4.2-py3-none-any.whl

Download URL configiverse-2.4.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18e0c95bd299d8c683109d940303c7cbc6cb681ad165406d0a1fd5fa9a7d5058
BLAKE2b-256 checksum
How to use checksums
9efbc2a1c31134ef358355ebe918e0542b87eb64b5b18ed32f15bfcfc8e13096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for configiverse 2.4.2

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.

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