Skip to content

Commit 71b1d52

Browse files
authored
Merge branch 'main' into use-macos-with-m1
2 parents 043ae67 + a5ac789 commit 71b1d52

File tree

157 files changed

+543
-572
lines changed

Some content is hidden

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

157 files changed

+543
-572
lines changed

.github/workflows/main.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ concurrency:
55
group: ${{ github.head_ref || github.run_id }}
66
cancel-in-progress: true
77

8-
env:
9-
CONDA_EXE: mamba
10-
118
on:
129
push:
1310
branches:
@@ -50,7 +47,7 @@ jobs:
5047
run: tox -e test -- -m "unit or (not integration and not end_to_end)" --cov=src --cov=tests --cov-report=xml -n auto
5148

5249
- name: Upload unit test coverage reports to Codecov with GitHub Action
53-
uses: codecov/codecov-action@v3
50+
uses: codecov/codecov-action@v4
5451
with:
5552
flags: unit
5653

@@ -59,7 +56,7 @@ jobs:
5956
run: tox -e test -- -m integration --cov=src --cov=tests --cov-report=xml -n auto
6057

6158
- name: Upload integration test coverage reports to Codecov with GitHub Action
62-
uses: codecov/codecov-action@v3
59+
uses: codecov/codecov-action@v4
6360
with:
6461
flags: integration
6562

@@ -68,6 +65,6 @@ jobs:
6865
run: tox -e test -- -m end_to_end --cov=src --cov=tests --cov-report=xml -n auto
6966

7067
- name: Upload end_to_end test coverage reports to Codecov with GitHub Action
71-
uses: codecov/codecov-action@v3
68+
uses: codecov/codecov-action@v4
7269
with:
7370
flags: end_to_end

.github/workflows/update-plugin-list.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: python scripts/update_plugin_list.py
3838

3939
- name: Create Pull Request
40-
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
40+
uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc
4141
with:
4242
commit-message: '[automated] Update plugin list'
4343
author: 'Tobias Raabe <[email protected]>'

.pre-commit-config.yaml

+5-19
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ repos:
2424
- id: python-check-mock-methods
2525
- id: python-no-log-warn
2626
- id: text-unicode-replacement-char
27-
- repo: https://github.com/asottile/reorder-python-imports
28-
rev: v3.12.0
29-
hooks:
30-
- id: reorder-python-imports
31-
args: [--py38-plus, --add-import, 'from __future__ import annotations']
32-
exclude: ^(docs_src/)
33-
- repo: https://github.com/asottile/reorder-python-imports
34-
rev: v3.12.0
35-
hooks:
36-
- id: reorder-python-imports
37-
args: [--py38-plus]
38-
files: ^(docs_src/)
3927
# - repo: https://github.com/tox-dev/pyproject-fmt
4028
# rev: 1.2.0
4129
# hooks:
@@ -45,18 +33,18 @@ repos:
4533
hooks:
4634
- id: sort-all
4735
- repo: https://github.com/astral-sh/ruff-pre-commit
48-
rev: v0.2.0
36+
rev: v0.3.2
4937
hooks:
5038
- id: ruff-format
5139
- id: ruff
5240
args: [--unsafe-fixes]
5341
- repo: https://github.com/dosisod/refurb
54-
rev: v1.28.0
42+
rev: v2.0.0
5543
hooks:
5644
- id: refurb
5745
args: [--ignore, FURB126]
5846
- repo: https://github.com/pre-commit/mirrors-mypy
59-
rev: v1.8.0
47+
rev: v1.9.0
6048
hooks:
6149
- id: mypy
6250
additional_dependencies: [
@@ -90,14 +78,12 @@ repos:
9078
]
9179
files: (docs/.)
9280
- repo: https://github.com/nbQA-dev/nbQA
93-
rev: 1.7.1
81+
rev: 1.8.4
9482
hooks:
95-
- id: nbqa-black
96-
- id: nbqa-isort
9783
- id: nbqa-mypy
9884
args: [--ignore-missing-imports]
9985
- repo: https://github.com/kynan/nbstripout
100-
rev: 0.6.2
86+
rev: 0.7.1
10187
hooks:
10288
- id: nbstripout
10389
exclude: (docs)

docs/source/changes.md

+12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
1616
passed via the command line are relative to CWD and paths in the configuration
1717
relative to the config file.
1818
- {pull}`555` uses new-style hook wrappers and requires pluggy 1.3 for typing.
19+
- {pull}`557` fixes an issue with `@task(after=...)` in notebooks and terminals.
20+
- {pull}`566` makes universal-pathlib an official dependency.
21+
- {pull}`568` restricts `task_files` to a list of patterns and raises a better error.
22+
- {pull}`569` removes the hooks related to the creation of the DAG.
23+
- {pull}`571` removes redundant calls to `PNode.state()` which causes a high penalty for
24+
remote files.
25+
- {pull}`573` removes the `pytask_execute_create_scheduler` hook.
26+
27+
## 0.4.6 - 2024-03-13
28+
29+
- {pull}`576` fixes accidentally collecting `pytask.MarkGenerator` when using
30+
`from pytask import mark`.
1931

2032
## 0.4.5 - 2024-01-09
2133

docs/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html
55
66
"""
7+
78
from __future__ import annotations
89

910
import inspect

docs/source/how_to_guides/remote_files.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@ lots of use cases to deal with remote files.
77
get started. So, some tasks reference remote files instead of local files.
88
- You store the workflow results in remote storage to save and distribute them.
99

10-
pytask uses [universal_pathlib](https://github.com/fsspec/universal_pathlib) to work
10+
pytask uses [universal-pathlib](https://github.com/fsspec/universal_pathlib) to work
1111
with remote files. The package provides a {mod}`pathlib`-like interface, making it very
1212
easy to interact with files from an HTTP(S)-, Dropbox-, S3-, GCP-, Azure-based
1313
filesystem, and many more.
1414

15-
```{warning}
16-
universal_pathlib does currently not support Python 3.12. To track progress, check the
17-
[releases `>0.1.4`](https://github.com/fsspec/universal_pathlib/releases).
18-
```
19-
2015
## HTTP(S)-based filesystem
2116

2217
As an example for dealing with an HTTP(S)-based filesystem, we will download the iris

docs/source/reference_guides/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ strict_markers = true
242242
Change the pattern which identify task files.
243243
244244
```toml
245-
task_files = "task_*.py" # default
245+
task_files = ["task_*.py"] # default
246246
247247
task_files = ["task_*.py", "tasks_*.py"]
248248
```

docs/source/reference_guides/hookspecs.md

-20
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,13 @@ The following hooks traverse directories and collect tasks from files.
6262
.. autofunction:: pytask_collect_log
6363
```
6464

65-
## Resolving Dependencies
66-
67-
The following hooks are designed to build a DAG from tasks and dependencies and check
68-
which files have changed and need to be re-run.
69-
70-
```{warning}
71-
This step is still experimental and likely to change in the future. If you are planning
72-
to write a plugin which extends pytask in this dimension, please, start a discussion
73-
before writing a plugin. It may make your life easier if changes in pytask anticipate
74-
your plugin.
75-
```
76-
77-
```{eval-rst}
78-
.. autofunction:: pytask_dag
79-
.. autofunction:: pytask_dag_create_dag
80-
.. autofunction:: pytask_dag_log
81-
82-
```
83-
8465
## Execution
8566

8667
The following hooks execute the tasks and log information on the result in the terminal.
8768

8869
```{eval-rst}
8970
.. autofunction:: pytask_execute
9071
.. autofunction:: pytask_execute_log_start
91-
.. autofunction:: pytask_execute_create_scheduler
9272
.. autofunction:: pytask_execute_build
9373
.. autofunction:: pytask_execute_task_protocol
9474
.. autofunction:: pytask_execute_task_log_start

docs/source/tutorials/defining_dependencies_products.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ task has finished, pytask will check whether the file exists.
7272
7373
````
7474
75-
````{tab-item} prodouces
75+
````{tab-item} produces
7676
:sync: produces
7777
7878
```{literalinclude} ../../../docs_src/tutorials/defining_dependencies_products_products_produces.py
@@ -132,7 +132,7 @@ annotation are dependencies of the task.
132132
133133
````
134134
135-
````{tab-item} prodouces
135+
````{tab-item} produces
136136
:sync: produces
137137
138138
To specify that the task relies on the data set `data.pkl`, you can add the path to the
@@ -178,7 +178,7 @@ are assumed to point to a location relative to the task module.
178178
179179
````
180180
181-
````{tab-item} prodouces
181+
````{tab-item} produces
182182
:sync: produces
183183
184184
```{literalinclude} ../../../docs_src/tutorials/defining_dependencies_products_relative_produces.py

docs/source/tutorials/making_tasks_persist.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ in the database such that the subsequent execution will skip the task successful
1313

1414
## When is this useful?
1515

16-
- You ran a formatter like Black on the files in your project and want to prevent the
16+
- You ran a formatter like ruff on the files in your project and want to prevent the
1717
longest-running tasks from being rerun.
1818
- You extend a repetition of a task function but do not want to rerun all tasks.
1919
- You want to integrate a task that you have already run elsewhere. Copy over the

docs/source/tutorials/repeating_tasks_with_different_inputs.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,17 @@ auto-generated ids are used.
9393

9494
### Auto-generated ids
9595

96-
pytask construct ids by extending the task name with representations of the values used
96+
pytask constructs ids by extending the task name with representations of the values used
9797
for each iteration. Booleans, floats, integers, and strings enter the task id directly.
9898
For example, a task function that receives four arguments, `True`, `1.0`, `2`, and
99-
`"hello"`, one of each dtype, has the following id.
99+
`"hello"`, one of each data type, has the following id.
100100

101101
```
102102
task_data_preparation.py::task_create_random_data[True-1.0-2-hello]
103103
```
104104

105-
Arguments with other dtypes cannot be converted to strings and, thus, are replaced with
106-
a combination of the argument name and the iteration counter.
105+
Arguments with other data types cannot be converted to strings and, thus, are replaced
106+
with a combination of the argument name and the iteration counter.
107107

108108
For example, the following function is parametrized with tuples.
109109

@@ -136,7 +136,7 @@ For example, the following function is parametrized with tuples.
136136

137137
Since the tuples are not converted to strings, the ids of the two tasks are
138138

139-
```
139+
```text
140140
task_data_preparation.py::task_create_random_data[seed0]
141141
task_data_preparation.py::task_create_random_data[seed1]
142142
```
@@ -177,7 +177,7 @@ a unique name for the iteration.
177177

178178
produces these ids
179179

180-
```
180+
```text
181181
task_data_preparation.py::task_create_random_data[first]
182182
task_data_preparation.py::task_create_random_data[second]
183183
```

docs/source/tutorials/using_a_data_catalog.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The following tabs show you how to use the data catalog given the interface you
6161
````{tab-item} Python 3.10+
6262
:sync: python310plus
6363
64-
Use `data_catalog["key"]` as an default argument to access the
64+
Use `data_catalog["data"]` as an default argument to access the
6565
{class}`~pytask.PickleNode` within the task. When you are done transforming your
6666
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
6767
@@ -74,7 +74,7 @@ Use `data_catalog["key"]` as an default argument to access the
7474
````{tab-item} Python 3.8+
7575
:sync: python38plus
7676
77-
Use `data_catalog["key"]` as an default argument to access the
77+
Use `data_catalog["data"]` as an default argument to access the
7878
{class}`~pytask.PickleNode` within the task. When you are done transforming your
7979
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
8080
@@ -87,7 +87,7 @@ Use `data_catalog["key"]` as an default argument to access the
8787
````{tab-item} ​produces
8888
:sync: produces
8989
90-
Use `data_catalog["key"]` as an default argument to access the
90+
Use `data_catalog["data"]` as an default argument to access the
9191
{class}`~pytask.PickleNode` within the task. When you are done transforming your
9292
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
9393
@@ -125,7 +125,7 @@ Following one of the interfaces gives you immediate access to the
125125
````{tab-item} Python 3.10+
126126
:sync: python310plus
127127
128-
Use `data_catalog["key"]` as an default argument to access the
128+
Use `data_catalog["data"]` as an default argument to access the
129129
{class}`~pytask.PickleNode` within the task. When you are done transforming your
130130
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
131131
@@ -138,7 +138,7 @@ Use `data_catalog["key"]` as an default argument to access the
138138
````{tab-item} Python 3.8+
139139
:sync: python38plus
140140
141-
Use `data_catalog["key"]` as an default argument to access the
141+
Use `data_catalog["data"]` as an default argument to access the
142142
{class}`~pytask.PickleNode` within the task. When you are done transforming your
143143
{class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`.
144144

docs_src/how_to_guides/bp_scaling_tasks_1.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from my_project.config import BLD
55
from my_project.config import SRC
66

7-
87
DATA = {
98
"data_0": {"subset": "subset_1"},
109
"data_1": {"subset": "subset_2"},

docs_src/how_to_guides/bp_scaling_tasks_3.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from my_project.config import BLD
55
from my_project.data_preparation.config import DATA
66

7-
87
_MODELS = ["linear_probability", "logistic_model", "decision_tree"]
98

109

docs_src/how_to_guides/bp_structure_of_task_files.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def task_prepare_census_data(
2626
df.to_pickle(path_to_census)
2727

2828

29-
def _clean_data(df: pd.DataFrame) -> None:
30-
...
29+
def _clean_data(df: pd.DataFrame) -> None: ...
3130

3231

33-
def _create_new_variables(df: pd.DataFrame) -> None:
34-
...
32+
def _create_new_variables(df: pd.DataFrame) -> None: ...

docs_src/how_to_guides/interfaces/dependencies_annotation.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
from pytask import PathNode
55

66

7-
def task_example(path: Annotated[Path, PathNode(path=Path("input.txt"))]) -> None:
8-
...
7+
def task_example(path: Annotated[Path, PathNode(path=Path("input.txt"))]) -> None: ...
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pathlib import Path
22

33

4-
def task_example(path: Path = Path("input.txt")) -> None:
5-
...
4+
def task_example(path: Path = Path("input.txt")) -> None: ...

docs_src/how_to_guides/interfaces/dependencies_task_kwargs.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55

66
@task(kwargs={"path": Path("input.txt")})
7-
def task_example(path: Path) -> None:
8-
...
7+
def task_example(path: Path) -> None: ...

docs_src/how_to_guides/migrating_from_scripts_to_pytask_1.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Content of task_data_management.py
22
import pandas as pd
33

4-
54
df = pd.read_csv("data.csv")
65

76
# Many operations.

docs_src/how_to_guides/remote_files/https.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from upath import UPath
55

6-
76
url = UPath("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data")
87

98

docs_src/how_to_guides/using_task_returns_example_2_task.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from pytask import task
44

5-
65
func = lambda *x: "This is the content of the text file."
76

87

docs_src/how_to_guides/using_task_returns_example_3_task.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from pytask import task
44

5-
65
func = lambda *x: "This is the first content.", "This is the second content."
76

87

0 commit comments

Comments
 (0)