A consistency handling system that was initially designed in the configuration management
Project description
Rougail
Description
Rougail is a free full-featured configuration manager library written in python3.
The configuration is describe in YAML dictionary files.
Those dictionaries are converted into Tiramisu objects.
Rougail can be incorporated with other technologies and stacks regardless of whether they’re written in Python or not.
Simple example
Create a directory:
# mkdir dict
Dictionary
A dictionary is a variables description file.
Create the file dict/dictionary.yml
:
---
version: 1.1
# describe a variable my_first_variable
# and a family with a variable my_second_variable
my_first_variable: my_value
my_family:
my_second_variable: 1
Generate variable
With commandline:
# rougail -m dict
Variables:
┣━━ 📓 my_first_variable: my_value
┗━━ 📂 my_family
┗━━ 📓 my_second_variable: 1
With default value:
Here is a python3 example file:
from rougail import Rougail, RougailConfig
from pprint import pprint
RougailConfig['dictionaries_dir'] = ['dict']
rougail = Rougail()
config = rougail.run()
pprint(config.value.get(), sort_dicts=False)
The result is:
{<TiramisuOption path="rougail">: {<TiramisuOption path="rougail.my_first_variable">: 'my_value',
<TiramisuOption path="rougail.my_family">: {<TiramisuOption path="rougail.my_family.my_second_variable">: 1}}}
With modified value
Use Tiramisu API to change values:
from rougail import Rougail, RougailConfig
from pprint import pprint
RougailConfig['dictionaries_dir'] = ['dict']
rougail = Rougail()
config = rougail.get_config()
config.option('rougail.my_first_variable').value.set('modified_value')
config.option('rougail.my_family.my_second_variable').value.set(2)
pprint(config.value.get(), sort_dicts=False)
The destination file is generated with new values:
{<TiramisuOption path="rougail">: {<TiramisuOption path="rougail.my_first_variable">: 'modified_value',
<TiramisuOption path="rougail.my_family">: {<TiramisuOption path="rougail.my_family.my_second_variable">: 2}}}
Link
Related projects
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 rougail-1.1.0.tar.gz
.
File metadata
- Download URL: rougail-1.1.0.tar.gz
- Upload date:
- Size: 753.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb0a6a69693e99eafe1ce0317eb75417d7df5e6fd5359342f0a8818935382006 |
|
MD5 | abe2476f2e515696c2b07717dbb21a47 |
|
BLAKE2b-256 | b3a7350d6a06188524f6877b8561cba2f5e5dd1dc89449b13b8ac49b5a9927d6 |
File details
Details for the file rougail-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: rougail-1.1.0-py3-none-any.whl
- Upload date:
- Size: 63.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6d9a3eebf24fd707eb5e3c2b8a176d4f1b4729dbb5010d54fe9fdc3cdfed548 |
|
MD5 | f8dd5e74f4b5aaf03b04b917a5239e54 |
|
BLAKE2b-256 | 0074d58753ebbfcf9061d5ba312288812ac747fd4b035b7abb31e1ea9c6b8d72 |