Skip to content

Commit 252dac9

Browse files
authored
Upgrade to tensorstore 0.1.72 and drop Python 3.9 (#1277)
* upgrade to tensorstore 0.1.72 and drop py3.9 * docs * changelog * fixes * automatic changes * manual changes * format * uv.lock * manual fixes * partial revert * format * upgrade numpy * fix aws credentials? * typing * fixes * fixes
1 parent 33b5676 commit 252dac9

File tree

128 files changed

+2685
-3525
lines changed

Some content is hidden

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

128 files changed

+2685
-3525
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
max-parallel: 4
3939
matrix:
4040
executors: [multiprocessing, slurm, kubernetes, dask]
41-
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
41+
python-version: ["3.13", "3.12", "3.11", "3.10"]
4242
defaults:
4343
run:
4444
working-directory: cluster_tools
@@ -157,7 +157,7 @@ jobs:
157157
strategy:
158158
max-parallel: 4
159159
matrix:
160-
python-version: ["3.12", "3.13", "3.11", "3.10", "3.9"]
160+
python-version: ["3.12", "3.13", "3.11", "3.10"]
161161
group: [1, 2, 3]
162162
fail-fast: false
163163
defaults:

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
max-parallel: 4
1313
matrix:
14-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1515
group: [1, 2, 3]
1616
fail-fast: false
1717
defaults:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- uses: actions/setup-python@v4
2222
with:
23-
python-version: "3.10"
23+
python-version: "3.12"
2424
architecture: 'x64'
2525

2626
- name: Setup git config

.github/workflows/verify_published.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
17+
python-version: ["3.13", "3.12", "3.11", "3.10"]
1818
extras: ["", "[all]"]
1919
steps:
2020
- name: Set up Python ${{ matrix.python-version }}

cluster_tools/cluster_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ def get_executor(environment: str, **kwargs: Any) -> "Executor":
117117
return SequentialPickleExecutor(**kwargs)
118118
elif environment == "multiprocessing_with_pickling":
119119
return MultiprocessingPickleExecutor(**kwargs)
120-
raise Exception("Unknown executor: {}".format(environment))
120+
raise Exception(f"Unknown executor: {environment}")

cluster_tools/cluster_tools/_utils/call.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import subprocess
2-
from typing import Optional, Tuple
32

43

5-
def call(command: str, stdin: Optional[str] = None) -> Tuple[str, str, int]:
4+
def call(command: str, stdin: str | None = None) -> tuple[str, str, int]:
65
"""Invokes a shell command as a subprocess, optionally with some
76
data sent to the standard input. Returns the standard output data,
87
the standard error, and the return code.
@@ -31,14 +30,10 @@ def __init__(self, command: str, code: int, stderr: str):
3130
self.stderr = stderr
3231

3332
def __str__(self) -> str:
34-
return "%s exited with status %i: %s" % (
35-
repr(self.command),
36-
self.code,
37-
repr(self.stderr),
38-
)
33+
return f"{self.command!r} exited with status {self.code}: {self.stderr!r}"
3934

4035

41-
def chcall(command: str, stdin: Optional[str] = None) -> Tuple[str, str]:
36+
def chcall(command: str, stdin: str | None = None) -> tuple[str, str]:
4237
"""Like ``call`` but raises an exception when the return code is
4338
nonzero. Only returns the stdout and stderr data.
4439
"""

cluster_tools/cluster_tools/_utils/file_wait_thread.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import os
33
import threading
44
import time
5-
from typing import TYPE_CHECKING, Callable, Dict
5+
from collections.abc import Callable
6+
from typing import TYPE_CHECKING
67

78
if TYPE_CHECKING:
89
from cluster_tools.schedulers.cluster_executor import ClusterExecutor
@@ -28,8 +29,8 @@ def __init__(
2829
threading.Thread.__init__(self)
2930
self.callback = callback
3031
self.interval = interval
31-
self.waiting: Dict[str, str] = {}
32-
self.retryMap: Dict[str, int] = {}
32+
self.waiting: dict[str, str] = {}
33+
self.retryMap: dict[str, int] = {}
3334
self.lock = threading.Lock()
3435
self.shutdown = False
3536
self.executor = executor
@@ -85,17 +86,11 @@ def handle_completed_job(
8586
if self.retryMap[filename] <= FileWaitThread.MAX_RETRY:
8687
# Retry by looping again
8788
logging.warning(
88-
"Job state is completed, but {} couldn't be found. Retrying {}/{}".format(
89-
filename,
90-
self.retryMap[filename],
91-
FileWaitThread.MAX_RETRY,
92-
)
89+
f"Job state is completed, but {filename} couldn't be found. Retrying {self.retryMap[filename]}/{FileWaitThread.MAX_RETRY}"
9390
)
9491
else:
9592
logging.error(
96-
"Job state is completed, but {} couldn't be found.".format(
97-
filename
98-
)
93+
f"Job state is completed, but {filename} couldn't be found."
9994
)
10095
handle_completed_job(job_id, filename, True)
10196

cluster_tools/cluster_tools/_utils/multiprocessing_logging_handler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import threading
77
import traceback
88
import warnings
9+
from collections.abc import Callable, Sequence
910
from logging import getLogger
1011
from logging.handlers import QueueHandler
1112
from queue import Empty as QueueEmpty
1213
from queue import Queue
13-
from typing import Any, Callable, List
14+
from typing import Any
1415

1516
# Inspired by https://stackoverflow.com/a/894284
1617

@@ -106,7 +107,7 @@ def close(self) -> None:
106107

107108

108109
def _setup_logging_multiprocessing(
109-
queues: List[Queue], levels: List[int], filters: List[Any]
110+
queues: list[Queue], levels: list[int], filters: Sequence[Any]
110111
) -> None:
111112
"""Re-setup logging in a multiprocessing context (only needed if a start_method other than
112113
fork is used) by setting up QueueHandler loggers for each queue and level

cluster_tools/cluster_tools/_utils/pickling.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pickle
22
import sys
3-
from typing import Any, BinaryIO, Optional
3+
from typing import Any, BinaryIO
44

55
from cluster_tools._utils.warning import warn_after
66

@@ -26,25 +26,25 @@ def dump(*args: Any, **kwargs: Any) -> None:
2626

2727
@warn_after("pickle.loads", WARNING_TIMEOUT)
2828
def loads(*args: Any, **kwargs: Any) -> Any:
29-
assert (
30-
"custom_main_path" not in kwargs
31-
), "loads does not implement support for the argument custom_main_path"
29+
assert "custom_main_path" not in kwargs, (
30+
"loads does not implement support for the argument custom_main_path"
31+
)
3232
return pickle.loads(*args, **kwargs)
3333

3434

3535
class _RenameUnpickler(pickle.Unpickler):
36-
custom_main_path: Optional[str]
36+
custom_main_path: str | None
3737

3838
def find_class(self, module: str, name: str) -> Any:
3939
renamed_module = module
4040
if module == "__main__" and self.custom_main_path is not None:
4141
renamed_module = self.custom_main_path
4242

43-
return super(_RenameUnpickler, self).find_class(renamed_module, name)
43+
return super().find_class(renamed_module, name)
4444

4545

4646
@warn_after("pickle.load", WARNING_TIMEOUT)
47-
def load(f: BinaryIO, custom_main_path: Optional[str] = None) -> Any:
47+
def load(f: BinaryIO, custom_main_path: str | None = None) -> Any:
4848
unpickler = _RenameUnpickler(f)
4949
unpickler.custom_main_path = custom_main_path
5050
return unpickler.load()

cluster_tools/cluster_tools/_utils/reflection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from typing import Callable
2+
from collections.abc import Callable
33

44
WARNING_TIMEOUT = 10 * 60 # seconds
55

0 commit comments

Comments
 (0)