Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templating: Add dict unpacking section. #3730

Merged
merged 1 commit into from
Jul 6, 2022
Merged

templating: Add dict unpacking section. #3730

merged 1 commit into from
Jul 6, 2022

Conversation

daavoo
Copy link
Contributor

@daavoo daavoo commented Jul 5, 2022

config: Add parsing section.

Per iterative/dvc#7907

@shcheklein shcheklein temporarily deployed to dvc-org-dict-unpacking-wbpep68 July 5, 2022 08:34 Inactive
@daavoo daavoo self-assigned this Jul 5, 2022
@daavoo daavoo requested review from a team and dberenbaum July 5, 2022 08:34
@daavoo daavoo added the C: guide Content of /doc/user-guide label Jul 5, 2022
@@ -156,6 +160,49 @@ stages:
DVC will track simple param values (numbers, strings, etc.) used in `${}` (they
will be listed by `dvc params diff`).

### Dict Unpacking
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was already too large but I think the extraction (#3670) should be addressed in a separate P.R.

@@ -156,6 +160,49 @@ stages:
DVC will track simple param values (numbers, strings, etc.) used in `${}` (they
will be listed by `dvc params diff`).

### Dict Unpacking

Only inside the `cmd` entries, you can also reference a dictionary inside `${}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget what happens if this is tried outside of cmd?

Copy link
Contributor Author

@daavoo daavoo Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like:

ResolveError("failed to parse 'stages.build.outs' in 'dvc.yaml':\nCannot interpolate data of type 'dict'")

@daavoo daavoo merged commit aee09a8 into main Jul 6, 2022
@daavoo daavoo deleted the dict-unpacking branch July 6, 2022 13:20
Copy link
Contributor

@jorgeorpinel jorgeorpinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was already too large but I think the extraction (#3670) should be addressed in a separate P.R.

Agree, still this probably doesn't need an H3 sub-section, we could summarize more.

Some edits base on the existing text for now:

Copy link
Contributor

@jorgeorpinel jorgeorpinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the config parsing ref...

p.s. #340 becomes even more urgent...

Comment on lines +252 to +254
- `parsing.bool` - Controls the templating syntax for boolean values when used
in
[dict unpacking](/doc/user-guide/project-structure/pipelines-files#dict-unpacking).

This comment was marked as resolved.

Copy link
Contributor

@jorgeorpinel jorgeorpinel Jul 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also for lists though, right @daavoo ? Any other types?

content/docs/command-reference/config.md Show resolved Hide resolved
Comment on lines +260 to +264
Given the following `params.yaml`:

```yaml
dict:
bool-true: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else should probably be a separate Example, not part of the parsing.bool bullet.

Comment on lines +288 to +296
- `parsing.list` - Controls the templating syntax for list values when used in
[dict unpacking](/doc/user-guide/project-structure/pipelines-files#dict-unpacking).

Valid values are `"nargs"` (default) and `"append"`, named after
[Python argparse actions](https://docs.python.org/3/library/argparse.html#action).

Given the following `params.yaml`:

```yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments for the parsing.list bullet

@jorgeorpinel jorgeorpinel added A: docs Area: user documentation (gatsby-theme-iterative) C: ref Content of /doc/*-reference labels Jul 9, 2022
@dberenbaum
Copy link
Contributor

Ping @daavoo . Could you take a look and address the comments from @jorgeorpinel in a new PR?

@jorgeorpinel
Copy link
Contributor

jorgeorpinel commented Jul 21, 2022

Oh thanks for the follow-up @dberenbaum . @daavoo note that I'm touching the Dictionary unpacking section in #3789 (feel free to contribute there or wait after it's merged).

jorgeorpinel added a commit that referenced this pull request Aug 1, 2022
jorgeorpinel added a commit that referenced this pull request Aug 1, 2022
@jorgeorpinel
Copy link
Contributor

@daavoo I started addressing my comments above in #3789, including the ones on the cmd ref before I realized that part should be a different PR. So I started #3858 for that and assigned you. Thanks 🙂

jorgeorpinel added a commit that referenced this pull request Oct 12, 2022
* initial plan and some content

* added content about stages

* title and restyle fixes

* added dag section

* depend to -> depend on

* added dependencies section

* Update content/docs/user-guide/pipelines/index.md

* Update content/docs/user-guide/pipelines/index.md

* Restyled by prettier (#3532)

Co-authored-by: Restyled.io <[email protected]>

* Update content/docs/user-guide/pipelines/index.md

Co-authored-by: Jorge Orpinel <[email protected]>

* added pipelines to sidebar

* updated the title

* fixed formatting

* updating for dvc.yaml first

* fed -> used

* dvc.yaml-first

* editing to tell dvc.yaml first

* minor fix

* url dependency

* dvc lock example

* section titles for deps

* section titles for outputs

* reproduction -> running

* adding hyperparameters section

* added experiments section

* adding url dependencies

* added outputs section content

* minor

* added running pipelines content

* moved outputs below running

* removed plots section header

* guide: Defining Data Pipelines

* guide: split up Data Pipelines section

* Update content/docs/command-reference/plots/templates.md

* guide: Data Pipes -> ML Pipes
per #3414 (review)

* guide: oops, remove op-pipes file

* guide: remoge ML Pipes intro
per #3414 (review)

* guide: mention both imports in Def ML Pipes
rel #3414 (review)

* guide: move DAG info from cmd ref
per #3414 (review)

* guide: move all info and links about DAG to ML Pipes
section about Dependency Graphs

* guide: point from some Stage links to ML Pipes
section on Stages (Defining Pipes)

* guide: delete Running ML Pipes (for now)

* nav: remove future ML Pipes guides

* guide: remove ML Pipes/ Experimental Pipes

* roll back unrelated changes...

* guide: roll back dvc.yaml page changes
per #3414 (review)

* guide: link ML Pipes/ Defining Stages to dvc.yaml/stages spec

* guide: some changes to start improving the dvc.yaml guide

* guide: edit Stages section (dvc.yaml guide) and
and move Stage entry spec to right after that.

* guide: link deps and params tooltip to ML Pipes/ Stages guide sections

* guide: links from dvc.yaml doc to ML Pipes/ Stages

* guide: update dvc.yaml Templating spec

* guide: a couple more admons for dvc.yaml doc

* guide: more links

* guide: oops, remove unused files

* remove unrelated change

* ref: update stage add/ run Descs

* guide: move stage definition details to ML Pipes
from cmd ref

* guide: move stage definition details to ML Pipes
from cmd ref

* guide: move stage command details into ML Pipes
re-link from existing places

* guide; update Stage entries spec descs.

* guide: admons for dvc.yaml page

* guide: roll back wrong change

* edits to dvc.yaml doc
per #3730 (review)

* ref: roll back unrelated changes

* .

* ref: few more links to dependency graph in guide

* ref: refactor run, stage add, and repro a little

* guide: drop old pipelines guide

* ref: revert files
one change moved to #4024

* pipelines: revert a bunch of files (for now)
per #3789 (comment)

* proper admons

Co-authored-by: iterative <[email protected]>
Co-authored-by: Emre Şahin <[email protected]>
Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: docs Area: user documentation (gatsby-theme-iterative) C: guide Content of /doc/user-guide C: ref Content of /doc/*-reference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants