No description
Find a file
2024-11-25 09:17:27 +01:00
docs copy type/params and multi if default value is a variable calculation (#9, #31 and #34) 2024-09-04 16:31:45 +02:00
locale fix: user_data plugins could have annotator function 2024-11-25 09:14:58 +01:00
src/rougail fix: dynamic variable could be optional 2024-11-25 09:17:27 +01:00
tests fix: do not modify a dynamic variable if has default value 2024-11-25 09:10:44 +01:00
.gitignore first cadoles' version 2019-11-24 20:25:09 +01:00
.pre-commit-config.yaml default dictionary yaml format version 2024-07-01 18:04:18 +02:00
.readthedocs.yaml feat: documentation 2023-12-17 20:42:03 +01:00
CHANGELOG.md bump: version 1.1.1 → 1.2.0a0 2024-11-08 08:13:27 +01:00
LICENSE fix: license 2024-11-01 09:06:29 +01:00
logo.png update logo 2022-11-11 11:04:31 +01:00
logo.svg add schema 2022-11-11 15:52:39 +01:00
pyproject.toml bump: version 1.1.1 → 1.2.0a0 2024-11-08 08:13:27 +01:00
README.md fix: README 2024-10-29 12:02:27 +01:00
setup.py Add silique copyright 2022-11-02 23:00:42 +01:00

Logo Rougail

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 theyre 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