-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
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:
# pyproject.toml
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools",
]
[project]
name = "test"
version = "0.1.0"
# recipe.yaml
context:
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 works
name: ${{ load_from_file("pyproject.toml").project.name }}
version: ${{ load_from_file("pyproject.toml").project.version }}
source:
path: .
build:
number: 0
script: |
echo "The name is ${{ name }}"
echo "The data is ${{ version }}"
Metadata
Metadata
Assignees
Labels
No labels