Multi-profile supported, flexible config library
Project description
octoconf
Multi-profile supported, flexible config library for Python 2 & 3.
Features
Allow multiple config profiles in one YAML file
Allow include multiple YAML files
Overridable profile selection from code for special use-cases (e.g. config for testing)
Inheritable config profiles, what makes profile merges by dictionaries. (the native YAML bookmarking is also available)
Can use variables in the config file
Installation
pip install octoconf
Config format
An octoconf config file is pure YAML file with some reserved keywords:
- USED_CONFIG>: <node_name> in the file root
you can specify the name of default config profile
- <INCLUDE: <yml_path(s)> in the file root
this octoconf file(s) will be included
- <BASE: <node_name> in the 2nd level
this will used for making (merge based) inheritance between profiles
The profile nodes should be on 1st level!
Usage
- You can load config from string with loads():
import octoconf config = octoconf.loads(yaml_string) print(config)
- Or directly from StringIO (e.g. from file) with load():
import octoconf with open('config.yml') as fd: config = octoconf.load(fd) print(config)
Please check the features docs for explain octoconf’s features.
Examples YAML files
USED_CONFIG>: UserConfig
<INCLUDE: vendor.defaults.yml
# This config overrides the production preset (from vendor.defaults.yml file)
UserConfig:
<BASE: ProductionConfig
App:
TITLE: "Amazing Foobar"
Flask:
SQLALCHEMY_DATABASE_URI: "sqlite:///${SERVER}/app.sqlite"
For more examples, please check the examples directory.
Bugs
Bugs or suggestions? Visit the issue tracker.
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
Built Distribution
File details
Details for the file octoconf-0.2.2.tar.gz
.
File metadata
- Download URL: octoconf-0.2.2.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48163c2c03775c4904650bed40403d187602d90a958193f2c5458781be5dc970 |
|
MD5 | a4d4aa3537a8fd4ba12b8e3946be9153 |
|
BLAKE2b-256 | 44c3e6cfc400c01129d0950c8bc75371482d5ef94fcf0bd5408e2b4ddba770e3 |
File details
Details for the file octoconf-0.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: octoconf-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6468868972a1229650781cc91ac48eb7f9df7094e79bc5f7bc968edd3364859c |
|
MD5 | caaa04f8fe731d71ac23789bb00b60e2 |
|
BLAKE2b-256 | 59be51a2956a229a915d8452209e342389fffe192f6265428bc850af414279e5 |