If the value contains a variable, it is processed through Templar.template
a. Templar.template is powered by jinja2, and historically only has the ability to return strings
b. Because jinja2 has historically only had the ability to template strings, we do some magic to try and convert strings that look like python data structures to python data structures
c. The string now becomes a python dictionary
You can work around this, although it’s a bit more complex:
I believe that was explained. The “magic” as you call it, only affects jinja2 templating, because historically jinja2 could only ever generate strings, but the intention was often to generate python data types.
We don’t do that for things that don’t go through templating, because the author can define it explicitly as the type they want.
Thank you. I try to understand the logic. In summary (up till now),
"The magic only affects jinja2 templating; to try and convert
strings that look like python data structures to python data
structures."
How do you decide what looks like python data structure? For example,
only the second string below is converted to dictionary, despite the
fact that both are valid YAML dictionaries