You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the (experimental) load_from_file feature, it seems like the object data must be accessed immediately. The data cannot be stored into a context. I doubt that the issue is in load_from_file, it seems more likely to be a limitation of the Jinja subscripting support, but I wasn't sure of the best way to create an object inline that would represent this issue so it is likely that there is a simpler MWE available.
The problem can be demonstrated by copying these two files into a directory:
# recipe.yamlcontext:
pyproject_data: ${{ load_from_file("pyproject.toml") }}# Uncomment these to test the different options below#name: ${{ pyproject_data.project.name }}#version: ${{ pyproject_data.project.version }}package:
# Does not work#name: ${{ pyproject_data.project.name }}#version: ${{ pyproject_data.project.version }}# Also does not work (assumes that the above#name: ${{ name }}#version: ${{ version }}# This worksname: ${{ load_from_file("pyproject.toml").project.name }}version: ${{ load_from_file("pyproject.toml").project.version }}source:
path: .build:
number: 0script: | echo "The name is ${{ name }}" echo "The data is ${{ version }}"
The text was updated successfully, but these errors were encountered:
Hey @vyasr - it's not actually an issue with Jinja in this case, but how we are doing things in the context (where we are forcing things to be either string, integer or boolean).
There is a PR to support lists in #1402.
We could similarly support maps in the context. I am just wondering wether it's a good idea...
When using the (experimental)
load_from_file
feature, it seems like the object data must be accessed immediately. The data cannot be stored into a context. I doubt that the issue is inload_from_file
, it seems more likely to be a limitation of the Jinja subscripting support, but I wasn't sure of the best way to create an object inline that would represent this issue so it is likely that there is a simpler MWE available.The problem can be demonstrated by copying these two files into a directory:
The text was updated successfully, but these errors were encountered: