Metadata-Version: 2.4
Name: configiverse
Version: 2.4.2
Summary: Manage multiple configs over multiple scopes
Author: Owen Cocjin
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: sectiprint>=2.0.0

# 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._ 

```python3
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.

```python3
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.
