Skip to content

Commit 0132057

Browse files
authored
Drop support for Python 3.8 and enable 3.13. (#114)
1 parent 23bfa7f commit 0132057

File tree

8 files changed

+32
-34
lines changed

8 files changed

+32
-34
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
fail-fast: false
4343
matrix:
4444
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
45-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
45+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
4646

4747
steps:
4848
- uses: actions/checkout@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ tests/test_jupyter/*.txt
2121
.pytest_cache
2222
.ruff_cache
2323
.venv
24+
uv.lock

pyproject.toml

+11-18
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ classifiers = [
66
"License :: OSI Approved :: MIT License",
77
"Operating System :: OS Independent",
88
"Programming Language :: Python :: 3",
9-
"Programming Language :: Python :: 3 :: Only"
9+
"Programming Language :: Python :: 3 :: Only",
1010
]
11-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1212
dependencies = [
1313
"attrs>=21.3.0",
1414
"click",
1515
"cloudpickle",
1616
"loky",
1717
"pluggy>=1.0.0",
18-
"pytask>=0.5.0",
18+
"pytask>=0.5.2",
1919
"rich",
2020
]
2121
dynamic = ["version"]
@@ -40,12 +40,7 @@ docs = [
4040
"sphinx-toolbox",
4141
"sphinxext-opengraph",
4242
]
43-
test = [
44-
"pytask-parallel[coiled,dask]",
45-
"nbmake",
46-
"pytest",
47-
"pytest-cov",
48-
]
43+
test = ["pytask-parallel[coiled,dask]", "nbmake", "pytest", "pytest-cov"]
4944

5045
[project.readme]
5146
file = "README.md"
@@ -70,9 +65,7 @@ build-backend = "hatchling.build"
7065

7166
[tool.rye]
7267
managed = true
73-
dev-dependencies = [
74-
"s3fs>=2024.3.1",
75-
]
68+
dev-dependencies = ["s3fs>=2024.3.1", "tox-uv>=1.7.0"]
7669

7770
[tool.rye.scripts]
7871
clean-docs = { cmd = "rm -rf docs/build" }
@@ -112,17 +105,17 @@ disallow_untyped_defs = false
112105
ignore_errors = true
113106

114107
[tool.ruff]
115-
target-version = "py38"
108+
target-version = "py39"
116109
fix = true
117110
unsafe-fixes = true
118111

119112
[tool.ruff.lint]
120113
extend-ignore = [
121-
"ANN101", # type annotating self
122-
"ANN102", # type annotating cls
123-
"ANN401", # flake8-annotate typing.Any
124-
"COM812", # Comply with ruff-format.
125-
"ISC001", # Comply with ruff-format.
114+
"ANN101", # type annotating self
115+
"ANN102", # type annotating cls
116+
"ANN401", # flake8-annotate typing.Any
117+
"COM812", # Comply with ruff-format.
118+
"ISC001", # Comply with ruff-format.
126119
]
127120
select = ["ALL"]
128121

src/pytask_parallel/backends.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def _deserialize_and_run_with_cloudpickle(fn: bytes, kwargs: bytes) -> Any:
2929
class _CloudpickleProcessPoolExecutor(ProcessPoolExecutor):
3030
"""Patches the standard executor to serialize functions with cloudpickle."""
3131

32-
# The type signature is wrong for Python >3.8. Fix when support is dropped.
33-
def submit( # type: ignore[override]
32+
def submit(
3433
self,
3534
fn: Callable[..., Any],
35+
/,
3636
*args: Any, # noqa: ARG002
3737
**kwargs: Any,
3838
) -> Future[Any]:

src/pytask_parallel/execute.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,14 @@ def _update_carry_over_node(
282282
return x
283283
raise NotImplementedError
284284

285-
structure_carry_over_products = tree_structure(carry_over_products)
286-
structure_produces = tree_structure(task.produces)
285+
structure_carry_over_products = tree_structure(carry_over_products) # type: ignore[arg-type]
286+
structure_produces = tree_structure(task.produces) # type: ignore[arg-type]
287287
# strict must be false when none is leaf.
288288
if structure_produces.is_prefix(structure_carry_over_products, strict=False):
289289
task.produces = tree_map(
290-
_update_carry_over_node, task.produces, carry_over_products
290+
_update_carry_over_node,
291+
task.produces, # type: ignore[arg-type]
292+
carry_over_products, # type: ignore[arg-type]
291293
) # type: ignore[assignment]
292294

293295

src/pytask_parallel/wrappers.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ def wrap_task_in_process( # noqa: PLR0913
106106
captured_stderr_buffer = StringIO()
107107

108108
# Catch warnings and store them in a list.
109-
with warnings.catch_warnings(record=True) as log, redirect_stdout(
110-
captured_stdout_buffer
111-
), redirect_stderr(captured_stderr_buffer):
109+
with (
110+
warnings.catch_warnings(record=True) as log,
111+
redirect_stdout(captured_stdout_buffer),
112+
redirect_stderr(captured_stderr_buffer),
113+
):
112114
# Apply global filterwarnings.
113115
for arg in session_filterwarnings:
114116
warnings.filterwarnings(*parse_warning_filter(arg, escape=False))
@@ -267,7 +269,7 @@ def _save_and_carry_over_product(
267269
node.save(value)
268270
return None
269271

270-
return tree_map_with_path(_save_and_carry_over_product, task.produces)
272+
return tree_map_with_path(_save_and_carry_over_product, task.produces) # type: ignore[arg-type]
271273

272274

273275
def _write_local_files_to_remote(
@@ -279,7 +281,7 @@ def _write_local_files_to_remote(
279281
to be resolved.
280282
281283
"""
282-
return tree_map(lambda x: x.load() if isinstance(x, RemotePathNode) else x, kwargs) # type: ignore[return-value]
284+
return tree_map(lambda x: x.load() if isinstance(x, RemotePathNode) else x, kwargs) # type: ignore[arg-type, return-value]
283285

284286

285287
def _delete_local_files_on_remote(kwargs: dict[str, PyTree[Any]]) -> None:
@@ -296,4 +298,4 @@ def _delete(potential_node: Any) -> None:
296298
os.close(potential_node.fd)
297299
Path(potential_node.remote_path).unlink(missing_ok=True)
298300

299-
tree_map(_delete, kwargs)
301+
tree_map(_delete, kwargs) # type: ignore[arg-type]

tests/test_jupyter/test_functional_interface.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"outputs": [],
99
"source": [
1010
"from pathlib import Path\n",
11+
"from typing import Annotated\n",
1112
"\n",
1213
"import pytask\n",
1314
"from pytask import ExitCode\n",
1415
"from pytask import PathNode\n",
15-
"from pytask import PythonNode\n",
16-
"from typing_extensions import Annotated"
16+
"from pytask import PythonNode"
1717
]
1818
},
1919
{

tests/test_jupyter/test_functional_interface_w_relative_path.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"outputs": [],
99
"source": [
1010
"from pathlib import Path\n",
11+
"from typing import Annotated\n",
1112
"\n",
1213
"import pytask\n",
1314
"from pytask import ExitCode\n",
1415
"from pytask import PathNode\n",
15-
"from pytask import PythonNode\n",
16-
"from typing_extensions import Annotated"
16+
"from pytask import PythonNode"
1717
]
1818
},
1919
{

0 commit comments

Comments
 (0)