Jinja templatingΒΆ

Any string value returned from your config will be run through a Jinja2 template resolver before being returned. Any missing variables in the templates will be looked up in the config using the current context.

config = SettingsManager({
        "basic": "Var {{someval}}",
        "someval": "default",
        "task": {"someval": "override"}
}, {"task"})

config.basic == "Var default"
with config.context("task"):
        config.basic == "Var override"

This could allow you to be more flexible when merging data from multiple sources such as default, org, and user level config files. You can even add custom filters to the environment such as

config = SettingsManager({
        "myval": "{{ (1, 3) | add_two_numbers }}"
})
config.add_filter("add_two_numbers", lambda tup: tup[0] + tup[1])
config.myval == "4"