Skip to content

Commit 59eadcf

Browse files
authored
Fix documentation on complex repetitions. (#671)
1 parent bef357f commit 59eadcf

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

docs/source/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
1212
`attributes` field on `PNode` and `PProvisionalNode` that will be mandatory on custom
1313
nodes in v0.6.0.
1414
- {pull}`662` adds the `.pixi` folder to be ignored by default during the collection.
15+
- {pull}`671` enhances the documentation on complex repetitions. Closes {issue}`670`.
1516

1617
## 0.5.2 - 2024-12-19
1718

docs/source/how_to_guides/bp_complex_task_repetitions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ caption: task_example.py
7474
As you see, we lost a level of indentation and we moved all the generations of names and
7575
paths to the dimensions and multi-dimensional objects.
7676

77+
Using a {class}`~pytask.PythonNode` allows us to hash the model and reexecute the task
78+
if we define other model settings.
79+
7780
## Adding another level
7881

7982
Extending a dimension by another level is usually quickly done. For example, if we have
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
from pathlib import Path
12
from typing import Annotated
23
from typing import Any
34

45
from myproject.config import EXPERIMENTS
6+
from myproject.config import Model
57
from myproject.config import data_catalog
68

9+
from _pytask.nodes import PythonNode
710
from pytask import task
811

912
for experiment in EXPERIMENTS:
1013

1114
@task(id=experiment.name)
1215
def task_fit_model(
13-
path_to_data: experiment.dataset.path,
16+
model: Annotated[Model, PythonNode(hash=True)] = experiment.model,
17+
path_to_data: Path = experiment.dataset.path,
1418
) -> Annotated[Any, data_catalog[experiment.fitted_model_name]]: ...

docs_src/how_to_guides/bp_complex_task_repetitions/experiment.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)