Skip to content

Commit 2bb28c6

Browse files
authored
Document new interface. (#392)
1 parent 58b49c8 commit 2bb28c6

File tree

76 files changed

+1849
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1849
-236
lines changed

.pre-commit-config.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ repos:
2828
hooks:
2929
- id: reorder-python-imports
3030
args: [--py38-plus, --add-import, 'from __future__ import annotations']
31+
exclude: ^(docs_src/)
32+
- repo: https://github.com/asottile/reorder-python-imports
33+
rev: v3.9.0
34+
hooks:
35+
- id: reorder-python-imports
36+
args: [--py38-plus]
37+
files: ^(docs_src/)
3138
- repo: https://github.com/asottile/setup-cfg-fmt
3239
rev: v2.4.0
3340
hooks:
@@ -49,8 +56,8 @@ repos:
4956
rev: 1.5.0
5057
hooks:
5158
- id: interrogate
52-
args: [-vv, --fail-under=75]
53-
exclude: ^(tests/|docs/|scripts/)
59+
args: [-v, --fail-under=75]
60+
exclude: ^(tests/|docs/|scripts/|docs_src/)
5461
- repo: https://github.com/pre-commit/mirrors-mypy
5562
rev: 'v1.5.1'
5663
hooks:
@@ -93,13 +100,18 @@ repos:
93100
docs/source/how_to_guides/how_to_influence_build_order.md|
94101
docs/source/how_to_guides/migrating_from_scripts_to_pytask.md|
95102
docs/source/how_to_guides/repeating_tasks_with_different_inputs_the_pytest_way.md|
103+
docs/source/how_to_guides/using_task_returns.md|
104+
docs/source/how_to_guides/writing_custom_nodes.md|
105+
docs/source/how_to_guides/hashing_inputs_of_tasks.md|
96106
docs/source/reference_guides/hookspecs.md|
97107
docs/source/tutorials/configuration.md|
108+
docs/source/tutorials/debugging.md|
98109
docs/source/tutorials/defining_dependencies_products.md|
99110
docs/source/tutorials/making_tasks_persist.md|
100111
docs/source/tutorials/repeating_tasks_with_different_inputs.md|
101112
docs/source/tutorials/selecting_tasks.md|
102-
docs/source/tutorials/set_up_a_project.md
113+
docs/source/tutorials/set_up_a_project.md|
114+
docs/source/tutorials/write_a_task.md
103115
)$
104116
- repo: https://github.com/kynan/nbstripout
105117
rev: 0.6.1

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ exclude *.yml
1010
exclude tox.ini
1111

1212
prune docs
13+
prune docs_src
1314
prune scripts
1415
prune tests

docs/source/_static/css/custom.css

+6-86
Original file line numberDiff line numberDiff line change
@@ -18,94 +18,14 @@ li pre {
1818
padding-left: 20px
1919
}
2020

21-
.termynal-comment {
22-
color: #4a968f;
23-
font-style: italic;
24-
display: block;
21+
.highlight {
22+
background: #f5f5f5
2523
}
2624

27-
.termy [data-termynal] {
28-
white-space: pre-wrap;
25+
.highlight button.copybtn{
26+
background-color: #f5f5f5;
2927
}
3028

31-
a.external-link::after {
32-
/* \00A0 is a non-breaking space
33-
to make the mark be on the same line as the link
34-
*/
35-
content: "\00A0[↪]";
36-
}
37-
38-
a.internal-link::after {
39-
/* \00A0 is a non-breaking space
40-
to make the mark be on the same line as the link
41-
*/
42-
content: "\00A0↪";
43-
}
44-
45-
46-
:root {
47-
--termynal-green: #137C39;
48-
--termynal-red: #BF2D2D;
49-
--termynal-yellow: #F4C041;
50-
--termynal-white: #f2f2f2;
51-
--termynal-black: #0c0c0c;
52-
--termynal-blue: #11a8cd;
53-
--termynal-grey: #7f7f7f;
54-
}
55-
56-
57-
.termynal-failed {
58-
color: var(--termynal-red);
59-
}
60-
61-
.termynal-failed-textonly {
62-
color: var(--termynal-white);
63-
background: var(--termynal-red);
64-
font-weight: bold;
65-
}
66-
67-
.termynal-success {
68-
color: var(--termynal-green);
69-
}
70-
71-
.termynal-success-textonly {
72-
color: var(--termynal-white);
73-
background: var(--termynal-green);
74-
font-weight: bold;
75-
}
76-
77-
.termynal-skipped {
78-
color: var(--termynal-yellow);
79-
}
80-
81-
.termynal-skipped-textonly {
82-
color: var(--termynal-black);
83-
background: var(--termynal-yellow);
84-
font-weight: bold;
85-
}
86-
87-
.termynal-warning {
88-
color: var(--termynal-yellow);
89-
}
90-
.termynal-command {
91-
color: var(--termynal-green);
92-
font-weight: bold;
93-
}
94-
.termynal-option {
95-
color: var(--termynal-yellow);
96-
font-weight: bold;
97-
}
98-
.termynal-switch {
99-
color: var(--termynal-red);
100-
font-weight: bold;
101-
}
102-
.termynal-metavar {
103-
color: yellow;
104-
font-weight: bold;
105-
}
106-
.termynal-dim {
107-
color: var(--termynal-grey);
108-
}
109-
.termynal-number {
110-
color: var(--termynal-blue);
29+
.highlight button.copybtn:hover {
30+
background-color: #f5f5f5;
11131
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.termynal-comment {
2+
color: #4a968f;
3+
font-style: italic;
4+
display: block;
5+
}
6+
7+
.termy [data-termynal] {
8+
white-space: pre-wrap;
9+
}
10+
11+
a.external-link::after {
12+
/* \00A0 is a non-breaking space
13+
to make the mark be on the same line as the link
14+
*/
15+
content: "\00A0[↪]";
16+
}
17+
18+
a.internal-link::after {
19+
/* \00A0 is a non-breaking space
20+
to make the mark be on the same line as the link
21+
*/
22+
content: "\00A0↪";
23+
}
24+
25+
:root {
26+
--termynal-green: #137C39;
27+
--termynal-red: #BF2D2D;
28+
--termynal-yellow: #F4C041;
29+
--termynal-white: #f2f2f2;
30+
--termynal-black: #0c0c0c;
31+
--termynal-blue: #11a8cd;
32+
--termynal-grey: #7f7f7f;
33+
}
34+
35+
.termynal-failed {
36+
color: var(--termynal-red);
37+
}
38+
39+
.termynal-failed-textonly {
40+
color: var(--termynal-white);
41+
background: var(--termynal-red);
42+
font-weight: bold;
43+
}
44+
45+
.termynal-success {
46+
color: var(--termynal-green);
47+
}
48+
49+
.termynal-success-textonly {
50+
color: var(--termynal-white);
51+
background: var(--termynal-green);
52+
font-weight: bold;
53+
}
54+
55+
.termynal-skipped {
56+
color: var(--termynal-yellow);
57+
}
58+
59+
.termynal-skipped-textonly {
60+
color: var(--termynal-black);
61+
background: var(--termynal-yellow);
62+
font-weight: bold;
63+
}
64+
65+
.termynal-warning {
66+
color: var(--termynal-yellow);
67+
}
68+
69+
.termynal-command {
70+
color: var(--termynal-green);
71+
font-weight: bold;
72+
}
73+
74+
.termynal-option {
75+
color: var(--termynal-yellow);
76+
font-weight: bold;
77+
}
78+
79+
.termynal-switch {
80+
color: var(--termynal-red);
81+
font-weight: bold;
82+
}
83+
84+
.termynal-metavar {
85+
color: yellow;
86+
font-weight: bold;
87+
}
88+
89+
.termynal-dim {
90+
color: var(--termynal-grey);
91+
}
92+
93+
.termynal-number {
94+
color: var(--termynal-blue);
95+
}

docs/source/conf.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@
7272
}
7373

7474
intersphinx_mapping = {
75-
"python": ("https://docs.python.org/3.9", None),
7675
"click": ("https://click.palletsprojects.com/en/8.0.x/", None),
77-
"pluggy": ("https://pluggy.readthedocs.io/en/latest", None),
7876
"networkx": ("https://networkx.org/documentation/stable", None),
77+
"pandas": ("https://pandas.pydata.org/docs", None),
78+
"pluggy": ("https://pluggy.readthedocs.io/en/latest", None),
7979
"pygraphviz": ("https://pygraphviz.github.io/documentation/stable/", None),
80+
"python": ("https://docs.python.org/3.10", None),
8081
}
8182

8283
# MyST
@@ -96,7 +97,7 @@
9697
# Add any paths that contain custom static files (such as style sheets) here, relative
9798
# to this directory. They are copied after the built-in static files, so a file named
9899
# "default.css" will overwrite the built-in "default.css".
99-
html_css_files = ["css/termynal.css", "css/custom.css"]
100+
html_css_files = ["css/termynal.css", "css/termynal_custom.css", "css/custom.css"]
100101

101102
html_js_files = ["js/termynal.js", "js/custom.js"]
102103

docs/source/glossary.md

+5
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ private function
3838
public function
3939
A function whose does not start with an underscore. The function can be imported
4040
in other modules.
41+
42+
PyTree
43+
A PyTree is a tree-like structure built out of tuples, lists, and dictionaries and
44+
other container types if registered. Any other object that is not a registered
45+
container is treated as a node in the tree.
4146
```

docs/source/how_to_guides/bp_scalable_repetitions_of_tasks.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The task file `task_prepare_data.py` uses these objects to build the parametriza
8585
```python
8686
# Content of task_prepare_data.py
8787

88-
import pytask
88+
from pytask import task
8989

9090
from my_project.data_preparation.config import DATA
9191
from my_project.data_preparation.config import path_to_input_data
@@ -107,14 +107,13 @@ _ID_TO_KWARGS = _create_parametrization(DATA)
107107

108108
for id_, kwargs in _ID_TO_KWARGS.items():
109109

110-
@pytask.mark.task(id=id_, kwargs=kwargs)
110+
@task(id=id_, kwargs=kwargs)
111111
def task_prepare_data(depends_on, produces):
112112
...
113113
```
114114

115-
All arguments for the loop and the {func}`@pytask.mark.task <pytask.mark.task>`
116-
decorator is built within a function to keep the logic in one place and the module's
117-
namespace clean.
115+
All arguments for the loop and the {func}`@task <pytask.task>` decorator is built within
116+
a function to keep the logic in one place and the module's namespace clean.
118117

119118
Ids are used to make the task {ref}`ids <ids>` more descriptive and to simplify their
120119
selection with {ref}`expressions <expressions>`. Here is an example of the task ids with
@@ -163,7 +162,7 @@ And here is the task file.
163162
```python
164163
# Content of task_estimate_models.py
165164

166-
import pytask
165+
from pytask import task
167166

168167
from my_project.data_preparation.config import path_to_processed_data
169168
from my_project.estimations.config import ESTIMATIONS
@@ -190,7 +189,7 @@ _ID_TO_KWARGS = _create_parametrization(ESTIMATIONS)
190189

191190
for id_, kwargs in _ID_TO_KWARGS.items():
192191

193-
@pytask.mark.task(id=id_, kwargs=kwars)
192+
@task(id=id_, kwargs=kwars)
194193
def task_estmate_models(depends_on, model, produces):
195194
if model == "linear_probability":
196195
...

0 commit comments

Comments
 (0)