Skip to content

Commit be7ed27

Browse files
committed
Modernize the package.
1 parent cc0b3bf commit be7ed27

File tree

9 files changed

+48
-56
lines changed

9 files changed

+48
-56
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ jobs:
3030
python-version-file: .python-version
3131
allow-prereleases: true
3232
cache: pip
33+
- name: Install just
34+
uses: extractions/setup-just@v2
3335
- run: pip install tox-uv
34-
- run: tox -e typing
36+
- name: Run type checking
37+
run: just typing
3538

3639
run-tests:
3740

@@ -51,24 +54,13 @@ jobs:
5154
python-version: ${{ matrix.python-version }}
5255
cache: pip
5356
allow-prereleases: true
57+
- name: Install just
58+
uses: extractions/setup-just@v2
5459
- run: pip install tox
5560

56-
# Unit, integration, and end-to-end tests.
57-
58-
- name: Run unit tests and doctests.
61+
- name: Run tests
5962
shell: bash -l {0}
60-
run: tox -e test -- tests -m "unit or (not integration and not end_to_end)" --cov=src --cov=tests --cov-report=xml
63+
run: just test
6164

62-
- name: Upload unit test coverage reports to Codecov with GitHub Action
65+
- name: Upload test coverage reports to Codecov with GitHub Action
6366
uses: codecov/codecov-action@v5
64-
with:
65-
flags: unit
66-
67-
- name: Run end-to-end tests.
68-
shell: bash -l {0}
69-
run: tox -e test -- tests -m end_to_end --cov=src --cov=tests --cov-report=xml
70-
71-
- name: Upload end_to_end test coverage reports to Codecov with GitHub Action
72-
uses: codecov/codecov-action@v5
73-
with:
74-
flags: end_to_end

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ repos:
2727
hooks:
2828
- id: ruff
2929
- id: ruff-format
30-
- repo: https://github.com/dosisod/refurb
31-
rev: v2.1.0
32-
hooks:
33-
- id: refurb
3430
- repo: https://github.com/kynan/nbstripout
3531
rev: 0.8.1
3632
hooks:

justfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Install all dependencies
2+
install:
3+
uv sync --all-groups
4+
5+
# Run tests
6+
test:
7+
uv run --group test pytest --cov=src --cov=tests --cov-report=xml
8+
9+
# Run type checking
10+
typing:
11+
uv run --group typing --group test ty check
12+
13+
# Run linting and formatting
14+
lint:
15+
uvx --with pre-commit-uv pre-commit run -a
16+
17+
# Run all checks (format, lint, typing, test)
18+
check: lint typing test
19+
20+
# Run tests with lowest dependency resolution
21+
test-lowest:
22+
uv run --group test --resolution lowest-direct pytest
23+
24+
# Run tests with highest dependency resolution
25+
test-highest:
26+
uv run --group test --resolution highest pytest

pyproject.toml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ classifiers = [
1111
requires-python = ">=3.9"
1212
dependencies = [
1313
"attrs>=21.3.0",
14-
"click",
14+
"click>=8.1.8,!=8.2.0",
1515
"cloudpickle",
1616
"loky",
1717
"pluggy>=1.0.0",
@@ -24,7 +24,7 @@ dynamic = ["version"]
2424
name = "Tobias Raabe"
2525
2626

27-
[project.optional-dependencies]
27+
[dependency-groups]
2828
coiled = ["coiled>=0.9.4"]
2929
dask = ["dask[complete]", "distributed"]
3030
docs = [
@@ -40,7 +40,17 @@ docs = [
4040
"sphinx-toolbox",
4141
"sphinxext-opengraph",
4242
]
43-
test = ["pytask-parallel[coiled,dask]", "nbmake", "pytest", "pytest-cov"]
43+
test = [
44+
"nbmake",
45+
"pytest>=8.4.0",
46+
"pytest-cov>=5.0.0",
47+
{include-group = "coiled"},
48+
{include-group = "dask"},
49+
]
50+
typing = [
51+
"pytask-parallel",
52+
"ty",
53+
]
4454

4555
[project.readme]
4656
file = "README.md"
@@ -105,7 +115,6 @@ disallow_untyped_defs = false
105115
ignore_errors = true
106116

107117
[tool.ruff]
108-
target-version = "py39"
109118
fix = true
110119
unsafe-fixes = true
111120

@@ -134,9 +143,6 @@ addopts = ["--nbmake"]
134143
testpaths = ["tests"]
135144
markers = [
136145
"wip: Tests that are work-in-progress.",
137-
"unit: Flag for unit tests which target mainly a single function.",
138-
"integration: Flag for integration tests which may comprise of multiple unit tests.",
139-
"end_to_end: Flag for tests that cover the whole program.",
140146
]
141147
norecursedirs = [".idea", ".tox"]
142148

tests/test_backends.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
import textwrap
22

3-
import pytest
43
from pytask import ExitCode
54
from pytask import cli
65

76
from pytask_parallel import ParallelBackend
87
from pytask_parallel import registry
98

109

11-
@pytest.mark.end_to_end
1210
def test_error_requesting_custom_backend_without_registration(runner, tmp_path):
1311
tmp_path.joinpath("task_example.py").write_text("def task_example(): pass")
1412
result = runner.invoke(cli, [tmp_path.as_posix(), "--parallel-backend", "custom"])
1513
assert result.exit_code == ExitCode.FAILED
1614
assert "No registered parallel backend found" in result.output
1715

1816

19-
@pytest.mark.end_to_end
2017
def test_error_while_instantiating_custom_backend(runner, tmp_path):
2118
hook_source = """
2219
from pytask_parallel import ParallelBackend, registry
@@ -35,7 +32,6 @@ def task_example(): pass
3532
assert "Could not instantiate parallel backend 'custom'." in result.output
3633

3734

38-
@pytest.mark.end_to_end
3935
def test_register_custom_backend(runner, tmp_path):
4036
source = """
4137
from loky import get_reusable_executor

tests/test_capture.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pytask_parallel import ParallelBackend
88

99

10-
@pytest.mark.end_to_end
1110
@pytest.mark.parametrize(
1211
"parallel_backend",
1312
[

tests/test_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from pytask_parallel import ParallelBackend
1111

1212

13-
@pytest.mark.end_to_end
1413
@pytest.mark.parametrize(
1514
("pdb", "n_workers", "expected"),
1615
[
@@ -26,7 +25,6 @@ def test_interplay_between_debugging_and_parallel(tmp_path, pdb, n_workers, expe
2625
assert session.config["n_workers"] == expected
2726

2827

29-
@pytest.mark.end_to_end
3028
@pytest.mark.parametrize(
3129
("configuration_option", "value", "exit_code"),
3230
[

tests/test_execute.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
]
2626

2727

28-
@pytest.mark.end_to_end
2928
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
3029
def test_parallel_execution(tmp_path, parallel_backend):
3130
source = """
@@ -47,7 +46,6 @@ def task_2(path: Annotated[Path, Product] = Path("out_2.txt")):
4746
assert tmp_path.joinpath("out_2.txt").exists()
4847

4948

50-
@pytest.mark.end_to_end
5149
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
5250
def test_parallel_execution_w_cli(runner, tmp_path, parallel_backend):
5351
source = """
@@ -77,7 +75,6 @@ def task_2(path: Annotated[Path, Product] = Path("out_2.txt")):
7775
assert tmp_path.joinpath("out_2.txt").exists()
7876

7977

80-
@pytest.mark.end_to_end
8178
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
8279
def test_stop_execution_when_max_failures_is_reached(tmp_path, parallel_backend):
8380
source = """
@@ -105,7 +102,6 @@ def task_3(): time.sleep(3)
105102
assert len(session.execution_reports) == 2
106103

107104

108-
@pytest.mark.end_to_end
109105
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
110106
def test_task_priorities(tmp_path, parallel_backend):
111107
source = """
@@ -146,7 +142,6 @@ def task_5():
146142
assert last_task_name.endswith(("task_2", "task_5"))
147143

148144

149-
@pytest.mark.end_to_end
150145
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
151146
@pytest.mark.parametrize("show_locals", [True, False])
152147
def test_rendering_of_tracebacks_with_rich(
@@ -172,7 +167,6 @@ def task_raising_error():
172167
assert ("[0, 1, 2, 3, 4]" in result.output) is show_locals
173168

174169

175-
@pytest.mark.end_to_end
176170
@pytest.mark.parametrize(
177171
"parallel_backend",
178172
# Capturing warnings is not thread-safe.
@@ -207,7 +201,6 @@ def task_example(produces):
207201
assert "task_example.py::task_example[1]" in warnings_block
208202

209203

210-
@pytest.mark.unit
211204
def test_sleeper():
212205
sleeper = _Sleeper(timings=[1, 2, 3], timing_idx=0)
213206

@@ -229,7 +222,6 @@ def test_sleeper():
229222
assert 1 <= end - start <= 2
230223

231224

232-
@pytest.mark.end_to_end
233225
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
234226
def test_task_that_return(runner, tmp_path, parallel_backend):
235227
source = """
@@ -249,7 +241,6 @@ def task_example() -> Annotated[str, Path("file.txt")]:
249241
)
250242

251243

252-
@pytest.mark.end_to_end
253244
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
254245
def test_task_without_path_that_return(runner, tmp_path, parallel_backend):
255246
source = """
@@ -270,7 +261,6 @@ def test_task_without_path_that_return(runner, tmp_path, parallel_backend):
270261
)
271262

272263

273-
@pytest.mark.end_to_end
274264
@pytest.mark.parametrize("flag", ["--pdb", "--trace", "--dry-run"])
275265
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
276266
def test_parallel_execution_is_deactivated(runner, tmp_path, flag, parallel_backend):
@@ -283,7 +273,6 @@ def test_parallel_execution_is_deactivated(runner, tmp_path, flag, parallel_back
283273
assert "Started 2 workers" not in result.output
284274

285275

286-
@pytest.mark.end_to_end
287276
@pytest.mark.parametrize("code", ["breakpoint()", "import pdb; pdb.set_trace()"])
288277
@pytest.mark.parametrize(
289278
"parallel_backend",
@@ -298,7 +287,6 @@ def test_raise_error_on_breakpoint(runner, tmp_path, code, parallel_backend):
298287
assert "You cannot use 'breakpoint()'" in result.output
299288

300289

301-
@pytest.mark.end_to_end
302290
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
303291
def test_task_partialed(runner, tmp_path, parallel_backend):
304292
source = """
@@ -321,7 +309,6 @@ def create_text(text):
321309
assert tmp_path.joinpath("file.txt").exists()
322310

323311

324-
@pytest.mark.end_to_end
325312
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
326313
def test_execute_tasks_and_pass_values_by_python_node_return(
327314
runner, tmp_path, parallel_backend
@@ -349,7 +336,6 @@ def task_create_file(
349336
assert tmp_path.joinpath("file.txt").read_text() == "This is the text."
350337

351338

352-
@pytest.mark.end_to_end
353339
@pytest.mark.parametrize("parallel_backend", _IMPLEMENTED_BACKENDS)
354340
def test_execute_tasks_and_pass_values_by_python_node_product(
355341
runner, tmp_path, parallel_backend

tests/test_remote.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def custom_builder(n_workers):
2424
tmp_path.joinpath("config.py").write_text(textwrap.dedent(source))
2525

2626

27-
@pytest.mark.end_to_end
2827
def test_python_node(runner, tmp_path):
2928
source = """
3029
from pathlib import Path
@@ -65,7 +64,6 @@ def task_third(
6564
assert tmp_path.joinpath("output.txt").read_text() == "Hello World!"
6665

6766

68-
@pytest.mark.end_to_end
6967
def test_local_path_as_input(runner, tmp_path):
7068
source = """
7169
from pathlib import Path
@@ -92,7 +90,6 @@ def task_example(path: Path = Path("in.txt")) -> Annotated[str, Path("output.txt
9290
assert tmp_path.joinpath("output.txt").read_text() == "Hello World!"
9391

9492

95-
@pytest.mark.end_to_end
9693
def test_local_path_as_product(runner, tmp_path):
9794
source = """
9895
from pytask import Product
@@ -119,7 +116,6 @@ def task_example(path: Annotated[Path, Product] = Path("output.txt")):
119116
assert tmp_path.joinpath("output.txt").read_text() == "Hello World!"
120117

121118

122-
@pytest.mark.end_to_end
123119
def test_local_path_as_return(runner, tmp_path):
124120
source = """
125121
from pathlib import Path
@@ -145,7 +141,6 @@ def task_example() -> Annotated[str, Path("output.txt")]:
145141
assert tmp_path.joinpath("output.txt").read_text() == "Hello World!"
146142

147143

148-
@pytest.mark.end_to_end
149144
def test_pickle_node_with_local_path_as_input(runner, tmp_path):
150145
source = """
151146
from pytask import PickleNode
@@ -175,7 +170,6 @@ def task_example(
175170
assert tmp_path.joinpath("output.txt").read_text() == "Hello World!"
176171

177172

178-
@pytest.mark.end_to_end
179173
def test_pickle_node_with_local_path_as_product(runner, tmp_path):
180174
source = """
181175
from pytask import PickleNode, Product
@@ -204,7 +198,6 @@ def task_example(
204198
assert pickle.loads(tmp_path.joinpath("data.pkl").read_bytes()) == "Hello World!" # noqa: S301
205199

206200

207-
@pytest.mark.end_to_end
208201
def test_pickle_node_with_local_path_as_return(runner, tmp_path):
209202
source = """
210203
from pytask import PickleNode

0 commit comments

Comments
 (0)