Skip to content

Commit

Permalink
ref: more realistic params_show(stages) example
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeorpinel committed Jun 25, 2022
1 parent 2e02967 commit 5baf055
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions content/docs/api-reference/params_show.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,26 @@ The function parameters (below) let you restrict what's retrieved.

## Example: Filter by stage name(s)

> Working on https://github.com/iterative/example-get-started
> Working on https://github.com/iterative/example-get-started, file
> `src/featurization.py`.
`stages` can be a single name (string):

```py
import json
import dvc.api
params = dvc.api.get_params(stages="featurize")
print(json.dumps(params, indent=2))
```git
+import json
-import yaml
-params = yaml.safe_load(open("params.yaml"))["featurize"]
+import dvc.api
+
+params = dvc.api.get_params(stages="featurize")
+params = json.dumps(params, indent=2)
...
-max_features = params["max_features"]
-ngrams = params["ngrams"]
+max_features = params["featurize"]["max_features"]
+ngrams = params["featurize"]["ngrams"]
```

```json
Expand Down

0 comments on commit 5baf055

Please sign in to comment.