utility library to find and load configuration files
Project description
config-library
utility library to find and load configuration files
Installation
pip install config-library
pip install config-library[all]
pip install config-library[json5]
pip install config-library[toml]
pip install config-library[yaml]
Supported Config-Types
extension | requires | link |
---|---|---|
.ini /.conf /.config |
https://en.wikipedia.org/wiki/INI_file | |
.json |
https://en.wikipedia.org/wiki/JSON | |
.jsonc |
https://changelog.com/news/jsonc-is-a-superset-of-json-which-supports-comments-6LwR | |
.json5 |
config-library[json5] |
https://json5.org/ |
.toml |
config-library[toml] or python3.11+ |
https://toml.io/ |
.yaml |
config-library[yaml] |
https://en.wikipedia.org/wiki/YAML |
.xml |
https://en.wikipedia.org/wiki/XML |
How does configlib
work
Places to search for
/path/to/your/source/code/
/path/to/your/git-repo/
/home/<user>/
/etc/
And in these folders it searches for either directly the config file or a sub-folder that's named like your project.
Usage Example
import configlib
config = configlib.findAndLoad('app.conf', 'project')
system file-structure
/
├─ etc/
├─ home/user/
│ ├─ path/to/repo/
│ │ ├─ src/code/
│ │ │ ├─ main.py
│ ├─ .config/
places where config-library
searches for the config-file
- /home/user/path/to/repo/src/code/app.conf
- /home/user/path/to/repo/src/code/project/app.conf
- /home/user/path/to/repo/app.conf
- /home/user/path/to/repo/project/app.conf
- /home/user/.config/app.conf
- /home/user/.config/project/app.conf
- /etc/app.conf
- /etc/project/app.conf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
config-library-0.4.1.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for config_library-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5da796656b35176c5fc6f97de610abd6164c33faaf64c8b500d9b0e680470b1c |
|
MD5 | 915d18b6217eb5adcdc2ffa352aa90ff |
|
BLAKE2b-256 | bc1569e31f6580ac1ef39f91b819050f11d57237a7a11a53ff560fef8f8c0c86 |