Unpacking list templates outside `cmd`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- yaml
- Domain
- tooling
Research direction
Start by reproducing the two deps examples in dvc.yaml with the those list from params.yaml, using dvc repro. Read the templating documentation linked in the issue and trace how list interpolation is handled; done means the supported behavior is implemented or clearly documented, with the requested syntax decision reflected in the examples.
Written by the indexing model from the issue text.
Description
For one project, I am running a foreach stage, where each step may have a different list of dependencies. I wanted to use templating to fill in the list of dependencies, but it seems for whatever I tried, the syntax was not supported. Below is a simple example that doesn't include the foreach:
# params.yaml
those:
- script.py
- script2.py
I first tried
# dvc.yaml
stages:
hello_world:
cmd: python script.py
deps:
- ${those}
outs:
- hello.txt
Running dvc repro I get
>>> dvc repro
ERROR: failed to parse 'stages.hello_world.deps' in 'dvc.yaml':
Cannot interpolate data of type 'list'
This wouldn't have made that much sense to me anyways since it reads like I'm expanding a list within an entry of another list.
I also tried
stages:
hello_world:
cmd: python script.py
deps: ${those}
outs:
- hello.txt
and got
>>> dvc repro
'./dvc.yaml' validation failed.
expected a list, in stages -> hello_world -> deps, line 3,
column 5
2 hello_world:
3 │ cmd: python script.py
4 │ deps: ${those}
This one makes more sense since it reads similar to how the expansion in foreach stages works.
Please let me know
- Is what I'm trying to achieve already supported? In that case the templating documentation should be updated, since this behavior is not described anywhere.
- If this is not currently supported, can this be supported in the future? The latter syntax would be a natural extension of the syntax for templating in
foreachstages.
- Dominant language
- Python
- Stars
- 15.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from treeverse/dvc
-
A bare `!` line in .dvcignore kills every command with `unexpected error` (git accepts it silently) Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Typo in the docs Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100