Skip to content

Commit 2880647

Browse files
committed
Merge remote-tracking branch 'origin/pre-commit-ci-update-config' into pre-commit-ci-update-config
2 parents 6b1ee7e + a6804c1 commit 2880647

9 files changed

Lines changed: 89 additions & 11 deletions

File tree

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
name: python-package-distributions
6868
path: dist/
6969
- name: Sign the dists with Sigstore
70-
uses: sigstore/gh-action-sigstore-python@v3.0.0
70+
uses: sigstore/gh-action-sigstore-python@v3.0.1
7171
with:
7272
inputs: >-
7373
./dist/*.tar.gz

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
- id: python-no-log-warn
2929
- id: text-unicode-replacement-char
3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.12.0
31+
rev: v0.12.4
3232
hooks:
3333
- id: ruff-format
3434
- id: ruff

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
55
releases are available on [PyPI](https://pypi.org/project/pytask) and
66
[Anaconda.org](https://anaconda.org/conda-forge/pytask).
77

8+
## 0.5.5 - 2025-07-25
9+
10+
- {pull}`692` documents how to use pytask with workspaces.
11+
- {pull}`694` fixes {issue}`693` so that missing dependencies are detected in some cases. Thanks to {user}`timmens` for the report!
12+
813
## 0.5.4 - 2025-06-08
914

1015
- {pull}`676` ensures compatibility with click >8.2.0.

docs/source/how_to_guides/bp_structure_of_a_research_project.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ As an example, look at two repositories from a COVID-19 forecasting project.
2323
- [sid](https://github.com/covid-19-impact-lab/sid) contains the code for the
2424
epidemiological model which is applied in the research project.
2525

26+
```{seealso}
27+
Nowadays, consider using [workspaces](using_workspaces.md) instead of separate repositories.
28+
```
29+
2630
Separating the model code from the research project provided several benefits.
2731

2832
- The model code is isolated and has its own test suite. Assessing and ensuring the code

docs/source/how_to_guides/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ provisional_nodes_and_task_generators
2323
writing_custom_nodes
2424
extending_pytask
2525
the_data_catalog
26+
using_workspaces
2627
```
2728

2829
## Best Practice Guides
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Using workspaces
2+
3+
There are situations where you want to structure your project as a multi-package
4+
workspace. Reasons are
5+
6+
- You are developing a scientific package alongside the project that you want to publish
7+
later.
8+
- The code for dealing with the dataset should be reused in other projects.
9+
- You want to strictly separate the pytask tasks from the remaining code to be able to
10+
switch to another build system.
11+
12+
In those instances, a workspace might be the right choice.
13+
14+
```text
15+
project
16+
├── packages
17+
│ ├── data
18+
│ │ ├── pyproject.toml
19+
│ │ └── src
20+
│ │ └── data
21+
│ │ ├── __init__.py
22+
│ │ └── ...
23+
│ ├── analysis
24+
│ │ ├── pyproject.toml
25+
│ │ └── src
26+
│ │ └── analysis
27+
│ │ ├── __init__.py
28+
│ │ └── ...
29+
│ └── tasks
30+
│ ├── pyproject.toml
31+
│ └── src
32+
│ └── tasks
33+
│ ├── __init__.py
34+
│ └── ...
35+
36+
├── pyproject.toml
37+
├── README.md
38+
├── ...
39+
```
40+
41+
## Using workspaces with uv
42+
43+
uv provides excellent support for workspaces which you can read more about in the
44+
[uv documentation](https://docs.astral.sh/uv/concepts/projects/workspaces).
45+
46+
## Using workspaces with pixi
47+
48+
pixi is still working on a native workspace experience, but there are workarounds.
49+
50+
- [https://pixi.sh/latest/build/workspace/](https://pixi.sh/latest/build/workspace/)
51+
- [https://github.com/prefix-dev/pixi/discussions/387](https://github.com/prefix-dev/pixi/discussions/387)
52+
- [https://github.com/Andre-Medina/python-pixi-mono-template](https://github.com/Andre-Medina/python-pixi-mono-template)

docs/source/tutorials/set_up_a_project.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ tutorial explains the minimal setup.
66
If you want to use pytask with a collection of scripts, you can skip this lesson and
77
move to the next section of the tutorials.
88

9+
```{seealso}
10+
In case you are thinking about developing multiple packages in the project that should be separated (one for dealing with the data, one for the analysis and a package for the pytask tasks), consider using a [workspace](../how_to_guides/using_workspaces.md).
11+
```
12+
13+
## The directory structure
14+
915
The following directory tree gives an overview of the project's different parts.
1016

1117
```text
@@ -83,6 +89,10 @@ version = "0.1.0"
8389
requires-python = ">=3.9"
8490
dependencies = ["pytask"]
8591
92+
[build-system]
93+
requires = ["uv_build"]
94+
build-backend = "uv_build"
95+
8696
[tool.pytask.ini_options]
8797
paths = ["src/my_project"]
8898
```
@@ -104,6 +114,10 @@ requires-python = ">=3.9"
104114
channels = ["conda-forge"]
105115
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
106116
117+
[build-system]
118+
requires = ["hatchling"]
119+
build-backend = "hatchling.build"
120+
107121
[dependencies]
108122
pytask = "*"
109123
python = ">=3.9"
@@ -120,16 +134,16 @@ paths = ["src/my_project"]
120134
Create a `pyproject.toml` file for project configuration:
121135
122136
```toml
123-
[build-system]
124-
requires = ["hatchling"]
125-
build-backend = "hatchling.build"
126-
127137
[project]
128138
name = "my_project"
129139
version = "0.1.0"
130140
requires-python = ">=3.9"
131141
dependencies = ["pytask"]
132142
143+
[build-system]
144+
requires = ["hatchling"]
145+
build-backend = "hatchling.build"
146+
133147
[tool.pytask.ini_options]
134148
paths = ["src/my_project"]
135149
```
@@ -162,15 +176,15 @@ dependencies:
162176
And a `pyproject.toml` file for project configuration:
163177
164178
```toml
165-
[build-system]
166-
requires = ["hatchling"]
167-
build-backend = "hatchling.build"
168-
169179
[project]
170180
name = "my_project"
171181
version = "0.1.0"
172182
requires-python = ">=3.9"
173183
184+
[build-system]
185+
requires = ["hatchling"]
186+
build-backend = "hatchling"
187+
174188
[tool.pytask.ini_options]
175189
paths = ["src/my_project"]
176190
```

src/_pytask/execute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def pytask_execute_task_setup(session: Session, task: PTask) -> None: # noqa: C
162162
has_changed = has_node_changed(task=task, node=node, state=node_state)
163163
if has_changed:
164164
needs_to_be_executed = True
165-
break
166165

167166
if not needs_to_be_executed:
168167
collect_provisional_products(session, task)

tests/test_execute.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,9 @@ def task2() -> None: pass
637637
assert result.exit_code == ExitCode.OK
638638

639639

640+
@pytest.mark.xfail(
641+
sys.platform == "linux" and sys.version_info[:2] == (3, 9), reason="flakey"
642+
)
640643
def test_pytask_on_a_module_that_uses_the_functional_api(tmp_path):
641644
source = """
642645
from pytask import task, ExitCode, build

0 commit comments

Comments
 (0)