Skip to content

Commit ac44212

Browse files
authored
Some changes to the docs. (#538)
1 parent 846d0ab commit ac44212

25 files changed

+378
-410
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ repos:
7676
additional_dependencies: [
7777
mdformat-gfm,
7878
mdformat-black,
79+
mdformat-pyproject,
7980
]
80-
args: [--wrap, "88"]
8181
files: (README\.md)
8282
- repo: https://github.com/executablebooks/mdformat
8383
rev: 0.7.17
@@ -86,31 +86,9 @@ repos:
8686
additional_dependencies: [
8787
mdformat-myst,
8888
mdformat-black,
89+
mdformat-pyproject,
8990
]
90-
args: [--wrap, "88"]
9191
files: (docs/.)
92-
exclude: |
93-
(?x)^(
94-
docs/source/index.md|
95-
docs/source/how_to_guides/bp_structure_of_task_files.md|
96-
docs/source/how_to_guides/how_to_influence_build_order.md|
97-
docs/source/how_to_guides/migrating_from_scripts_to_pytask.md|
98-
docs/source/how_to_guides/repeating_tasks_with_different_inputs_the_pytest_way.md|
99-
docs/source/how_to_guides/using_task_returns.md|
100-
docs/source/how_to_guides/writing_custom_nodes.md|
101-
docs/source/how_to_guides/hashing_inputs_of_tasks.md|
102-
docs/source/how_to_guides/remote_files.md|
103-
docs/source/reference_guides/hookspecs.md|
104-
docs/source/tutorials/configuration.md|
105-
docs/source/tutorials/debugging.md|
106-
docs/source/tutorials/defining_dependencies_products.md|
107-
docs/source/tutorials/making_tasks_persist.md|
108-
docs/source/tutorials/repeating_tasks_with_different_inputs.md|
109-
docs/source/tutorials/selecting_tasks.md|
110-
docs/source/tutorials/set_up_a_project.md|
111-
docs/source/tutorials/using_a_data_catalog.md|
112-
docs/source/tutorials/write_a_task.md
113-
)$
11492
- repo: https://github.com/nbQA-dev/nbQA
11593
rev: 1.7.1
11694
hooks:

docs/source/changes.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
2323
- {pull}`528` improves the codecov setup and coverage.
2424
- {pull}`535` reenables and fixes tests with Jupyter.
2525
- {pull}`536` allows partialed functions to be task functions.
26+
- {pull}`538` updates the documentation. For example, colon fences are replaced by
27+
backticks to allow formatting all pages by mdformat.
2628
- {pull}`539` implements the {confval}`hook_module` configuration value and
2729
`--hook-module` commandline option to register hooks.
2830
- {pull}`540` changes the CLI entry-point and allow `pytask.build(tasks=task_func)` as
@@ -124,7 +126,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
124126
- {pull}`413` removes scripts to generate `.svg`s.
125127
- {pull}`414` allow more ruff rules.
126128
- {pull}`416` removes `.from_annot` again.
127-
- {pull}`417` deprecates {func}`pytask.mark.task` in favor of {func}`pytask.task`.
129+
- {pull}`417` deprecates `pytask.mark.task` in favor of {func}`pytask.task`.
128130
- {pull}`418` fixes and error and simplifies code in `dag.py`.
129131
- {pull}`420` converts `DeprecationWarning`s to `FutureWarning`s for the deprecated
130132
decorators.
@@ -170,7 +172,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
170172
- {pull}`376` enhances the documentation for `pytask dag`.
171173
- {pull}`378` conditionally skips test on MacOS.
172174
- {pull}`381` deprecates `@pytask.mark.parametrize`. (Closes {issue}`233`.)
173-
- {pull}`501` removes {class}`pytask.MetaNode`.
175+
- {pull}`501` removes `pytask.MetaNode`.
174176

175177
## 0.3.1 - 2023-12-25
176178

@@ -254,7 +256,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
254256
arguments. It also implements {class}`_pytask.models.CollectionMetadata` to carry
255257
parametrized arguments to the task class.
256258
- {pull}`228` removes `task.pytaskmark` and moves the information to
257-
{attr}`_pytask.models.CollectionMetadata.markers`.
259+
{attr}`pytask.CollectionMetadata.markers`.
258260
- {pull}`229` implements a new loop-based approach to parametrizations using the
259261
{func}`@pytask.mark.task <pytask.mark.task>` decorator.
260262
- {pull}`230` implements {class}`_pytask.logging._TimeUnit` as a
@@ -337,8 +339,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
337339
the direction of the DAG.
338340
- {pull}`186` enhance live displays by deactivating auto-refresh, among other things.
339341
- {pull}`187` allows to enable and disable showing tracebacks and potentially different
340-
styles in the future with {confval}`show_traceback=True|False`.
341-
- {pull}`188` refactors some code related to {class}`_pytask.enums.ExitCode`.
342+
styles in the future with `show_traceback=True|False`.
343+
- {pull}`188` refactors some code related to {class}`pytask.ExitCode`.
342344
- {pull}`189` do not display a table in the execution if no task was run.
343345
- {pull}`190` updates the release notes.
344346

@@ -389,8 +391,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
389391

390392
## 0.1.1 - 2021-08-25
391393

392-
- {pull}`138` changes the default {confval}`verbosity` to `1` which displays the live
393-
table during execution and `0` display the symbols for outcomes (e.g. `.`, `F`, `s`).
394+
- {pull}`138` changes the default `verbosity` to `1` which displays the live table
395+
during execution and `0` display the symbols for outcomes (e.g. `.`, `F`, `s`).
394396
- {pull}`139` enables rich's auto-refresh mechanism for live objects which causes almost
395397
no performance penalty for the live table compared to the symbolic output.
396398

docs/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@
8585
"click": ("https://click.palletsprojects.com/en/8.0.x/", None),
8686
"deepdiff": ("https://zepworks.com/deepdiff/current/", None),
8787
"networkx": ("https://networkx.org/documentation/stable", None),
88+
"nx": ("https://networkx.org/documentation/stable", None),
8889
"pandas": ("https://pandas.pydata.org/docs", None),
90+
"pd": ("https://pandas.pydata.org/docs", None),
8991
"pluggy": ("https://pluggy.readthedocs.io/en/latest", None),
9092
"pygraphviz": ("https://pygraphviz.github.io/documentation/stable/", None),
9193
"python": ("https://docs.python.org/3.10", None),
9294
}
9395

9496
# MyST
95-
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath"]
97+
myst_enable_extensions = ["deflist", "dollarmath"]
9698
myst_footnote_transition = False
9799

98100
# Open Graph

docs/source/how_to_guides/bp_structure_of_task_files.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ are looking for orientation or inspiration, here are some tips.
1313
- Task functions should be at the top of a task module to easily identify what the
1414
module is for.
1515

16-
:::{seealso}
16+
```{seealso}
1717
The only exception might be for {doc}`repetitions <bp_scaling_tasks>`.
18-
:::
18+
```
1919

2020
- The purpose of the task function is to handle IO operations like loading and saving
2121
files and calling Python functions on the task's inputs. IO should not be handled in
@@ -44,11 +44,11 @@ module are re-run. If the runtime of all tasks in the module is high, you wait l
4444
for your tasks to finish or until an error occurs which prolongs your feedback loops and
4545
hurts your productivity.
4646

47-
:::{seealso}
47+
```{seealso}
4848
Use {func}`@pytask.mark.persist <pytask.mark.persist>` if you want to avoid accidentally
4949
triggering an expensive task. It is also explained in [this
5050
tutorial](../tutorials/making_tasks_persist).
51-
:::
51+
```
5252

5353
### Structure of the module
5454

@@ -86,11 +86,11 @@ Here is an example of a task module which conforms to all advices.
8686
```{literalinclude} ../../../docs_src/how_to_guides/bp_structure_of_task_files.py
8787
```
8888

89-
:::{seealso}
89+
```{seealso}
9090
The structure of the task module is greatly inspired by John Ousterhout's "A Philosopy
9191
of Software Design" in which he coins the name "deep modules". In short, deep modules
9292
have simple interfaces which are defined by one or a few {term}`public functions <public
9393
function>` (or classes) which provide the functionality. The complexity is hidden inside
9494
the module in {term}`private functions <private function>` which are called by the
9595
{term}`public functions <public function>`.
96-
:::
96+
```

docs/source/how_to_guides/hashing_inputs_of_tasks.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ If an input is not parsed by any more specific node type, the general
1111
In the following example, the argument `text` will be parsed as a
1212
{class}`~pytask.PythonNode`.
1313

14-
:::::{tab-set}
14+
`````{tab-set}
1515
16-
::::{tab-item} Python 3.10+
16+
````{tab-item} Python 3.10+
1717
1818
```{literalinclude} ../../../docs_src/how_to_guides/hashing_inputs_of_tasks_example_1_py310.py
1919
```
2020
21-
::::
22-
:::::
21+
````
22+
`````
2323

2424
By default, pytask does not detect changes in {class}`~pytask.PythonNode` and if the
2525
value would change (without changing the task module), pytask would not rerun the task.
@@ -28,15 +28,15 @@ We can also hash the value of {class}`~pytask.PythonNode` s so that pytask knows
2828
the input changed. For that, we need to use the {class}`~pytask.PythonNode` explicitly
2929
and set `hash = True`.
3030

31-
:::::{tab-set}
31+
`````{tab-set}
3232
33-
::::{tab-item} Python 3.10+
33+
````{tab-item} Python 3.10+
3434
3535
```{literalinclude} ../../../docs_src/how_to_guides/hashing_inputs_of_tasks_example_2_py310.py
3636
```
3737
38-
::::
39-
:::::
38+
````
39+
`````
4040

4141
When `hash=True`, pytask will call the builtin {func}`hash` on the input that will call
4242
the `__hash__()` method of the object.
@@ -62,10 +62,10 @@ from interpreter session to interpreter session for security reasons (see
6262
```
6363

6464
{class}`list` and {class}`dict` are not hashable by default. Luckily, there are
65-
libraries who provide this functionality like {mod}`deepdiff`. We can use them to pass a
65+
libraries who provide this functionality like `deepdiff`. We can use them to pass a
6666
function to the {class}`~pytask.PythonNode` that generates a stable hash.
6767

68-
First, install {mod}`deepdiff`.
68+
First, install `deepdiff`.
6969

7070
```console
7171
$ pip install deepdiff
@@ -74,12 +74,12 @@ $ conda install deepdiff
7474

7575
Then, create the hash function and pass it to the node.
7676

77-
:::::{tab-set}
77+
`````{tab-set}
7878
79-
::::{tab-item} Python 3.10+
79+
````{tab-item} Python 3.10+
8080
8181
```{literalinclude} ../../../docs_src/how_to_guides/hashing_inputs_of_tasks_example_3_py310.py
8282
```
8383
84-
::::
85-
:::::
84+
````
85+
`````

docs/source/how_to_guides/how_to_influence_build_order.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# How to influence the build order
22

3-
:::{important}
3+
```{important}
44
This guide shows how to influence the order in which tasks are executed. The feature
55
should be treated with caution since it might make projects work whose dependencies and
66
products are not fully specified.
7-
:::
7+
```
88

99
You can influence the order in which tasks are executed by assigning preferences to
1010
tasks. Use {func}`@pytask.mark.try_first <pytask.mark.try_first>` to execute a task as
1111
early as possible and {func}`@pytask.mark.try_last <pytask.mark.try_last>` to defer
1212
execution.
1313

14-
:::{note}
14+
```{note}
1515
A little bit more background: Tasks, dependencies and products form a directed acyclic
1616
graph (DAG). A [topological ordering](https://en.wikipedia.org/wiki/Topological_sorting)
1717
determines the order in which tasks are executed such that tasks are not run until their
1818
predecessors have been executed. You should not assume a fixed ordering in which tasks
1919
are executed.
20-
:::
20+
```
2121

2222
As an example, here are two tasks where the decorator ensures that the output of the
2323
second task is always shown before the output of the first task.

docs/source/how_to_guides/migrating_from_scripts_to_pytask.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ An `if __name__ == "__main__"` block must be deleted.
5555
To let pytask know the order in which to execute tasks and when to re-run them, you'll
5656
need to specify task dependencies and products. Add dependencies as arguments to the
5757
function with default values. Do the same for products, but also add the special
58-
{obj}`~pytask.Product` annotation with {obj}`Annotated[Path, Product]`. For example:
58+
{obj}`~pytask.Product` annotation with `Annotated[Path, Product]`. For example:
5959

6060
```{literalinclude} ../../../docs_src/how_to_guides/migrating_from_scripts_to_pytask_4.py
6161
```
@@ -65,10 +65,10 @@ You can also use a dictionary to group multiple dependencies or products.
6565
```{literalinclude} ../../../docs_src/how_to_guides/migrating_from_scripts_to_pytask_5.py
6666
```
6767

68-
:::{seealso}
68+
```{seealso}
6969
If you want to learn more about dependencies and products, read the
7070
[tutorial](../tutorials/defining_dependencies_products.md).
71-
:::
71+
```
7272

7373
## Execution
7474

@@ -88,10 +88,10 @@ then automatically spawn multiple processes to run the workflow in parallel.
8888
$ pytask -n 4
8989
```
9090

91-
:::{seealso}
91+
```{seealso}
9292
You can find more information on pytask-parallel in the
9393
[readme](https://github.com/pytask-dev/pytask-parallel) on Github.
94-
:::
94+
```
9595

9696
## Bonus: From R script to task
9797

@@ -109,10 +109,10 @@ $ pip install pytask-r
109109
$ conda install -c conda-forge pytask-r
110110
```
111111

112-
:::{seealso}
112+
```{seealso}
113113
Checkout [pytask-julia](https://github.com/pytask-dev/pytask-julia) and
114114
[pytask-stata](https://github.com/pytask-dev/pytask-stata), too!
115-
:::
115+
```
116116

117117
And here is the R script `prepare_data.r` that we want to integrate.
118118

@@ -131,8 +131,8 @@ products.
131131
```{literalinclude} ../../../docs_src/how_to_guides/migrating_from_scripts_to_pytask_6.py
132132
```
133133

134-
pytask automatically makes the paths to the dependencies and products available to the
135-
R file via a JSON file. Let us amend the R script to load the information from the JSON
134+
pytask automatically makes the paths to the dependencies and products available to the R
135+
file via a JSON file. Let us amend the R script to load the information from the JSON
136136
file.
137137

138138
```r

docs/source/how_to_guides/remote_files.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ with remote files. The package provides a {mod}`pathlib`-like interface, making
1212
easy to interact with files from an HTTP(S)-, Dropbox-, S3-, GCP-, Azure-based
1313
filesystem, and many more.
1414

15-
:::{warning}
15+
```{warning}
1616
universal_pathlib does currently not support Python 3.12. To track progress, see [this
1717
PR](https://github.com/fsspec/universal_pathlib/pull/152) and check the [releases
1818
`>0.1.4`](https://github.com/fsspec/universal_pathlib/releases)
19-
:::
19+
```
2020

2121
## HTTP(S)-based filesystem
2222

@@ -63,11 +63,10 @@ After installing s3fs, rerun the command.
6363
```
6464

6565
Usually, you will need credentials to access files. Search in
66-
[fsspec's documentation](https://filesystem-spec.readthedocs.io/en/latest)
67-
or the plugin's documentation, here
68-
[s3fs](https://s3fs.readthedocs.io/en/latest/#credentials), for information on
69-
authentication. One way would be to set the environment variables `AWS_ACCESS_KEY_ID`
70-
and `AWS_SECRET_ACCESS_KEY`.
66+
[fsspec's documentation](https://filesystem-spec.readthedocs.io/en/latest) or the
67+
plugin's documentation, here [s3fs](https://s3fs.readthedocs.io/en/latest/#credentials),
68+
for information on authentication. One way would be to set the environment variables
69+
`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
7170

7271
## Detecting changes in remote files
7372

0 commit comments

Comments
 (0)