Skip to content

Commit 313ab48

Browse files
authored
Merge branch 'main' into doc/tutorial
2 parents f1ab32a + 5f3a512 commit 313ab48

Some content is hidden

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

43 files changed

+100
-28
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
python-version: ['3.11', '3.12']
24+
python-version: ['3.11', '3.12', '3.13']
2525
numpy-version: ['1.25', '1.26', '2.0']
2626
dependency-set: ["minimal", "optional"]
2727

pyproject.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ classifiers = [
4949
'Programming Language :: Python :: 3',
5050
'Programming Language :: Python :: 3.11',
5151
'Programming Language :: Python :: 3.12',
52+
'Programming Language :: Python :: 3.13',
5253
]
5354
license = {text = "MIT License"}
5455
keywords = ["Python", "compressed", "ndimensional-arrays", "zarr"]
@@ -132,17 +133,17 @@ dependencies = [
132133
features = ["test", "extra"]
133134

134135
[[tool.hatch.envs.test.matrix]]
135-
python = ["3.11", "3.12"]
136+
python = ["3.11", "3.12", "3.13"]
136137
numpy = ["1.25", "1.26", "2.0"]
137138
version = ["minimal"]
138139

139140
[[tool.hatch.envs.test.matrix]]
140-
python = ["3.11", "3.12"]
141+
python = ["3.11", "3.12", "3.13"]
141142
numpy = ["1.25", "1.26", "2.0"]
142143
features = ["optional"]
143144

144145
[[tool.hatch.envs.test.matrix]]
145-
python = ["3.11", "3.12"]
146+
python = ["3.11", "3.12", "3.13"]
146147
numpy = ["1.25", "1.26", "2.0"]
147148
features = ["gpu"]
148149

@@ -152,7 +153,7 @@ run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pypro
152153
run = "run-coverage --no-cov"
153154
run-verbose = "run-coverage --verbose"
154155
run-mypy = "mypy src"
155-
run-hypothesis = "pytest --hypothesis-profile ci tests/v3/test_properties.py tests/v3/test_store/test_stateful*"
156+
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
156157
list-env = "pip list"
157158

158159
[tool.hatch.envs.gputest]
@@ -163,7 +164,7 @@ dependencies = [
163164
features = ["test", "extra", "gpu"]
164165

165166
[[tool.hatch.envs.gputest.matrix]]
166-
python = ["3.11", "3.12"]
167+
python = ["3.11", "3.12", "3.13"]
167168
numpy = ["1.25", "1.26", "2.0"]
168169
version = ["minimal"]
169170

@@ -172,7 +173,7 @@ run-coverage = "pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov=tests"
172173
run = "run-coverage --no-cov"
173174
run-verbose = "run-coverage --verbose"
174175
run-mypy = "mypy src"
175-
run-hypothesis = "pytest --hypothesis-profile ci tests/v3/test_properties.py tests/v3/test_store/test_stateful*"
176+
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
176177
list-env = "pip list"
177178

178179
[tool.hatch.envs.docs]
@@ -281,18 +282,17 @@ ignore_errors = true
281282

282283
[[tool.mypy.overrides]]
283284
module = [
284-
"tests.v2.*",
285-
"tests.v3.package_with_entrypoint.*",
286-
"tests.v3.test_codecs.test_codecs",
287-
"tests.v3.test_codecs.test_transpose",
288-
"tests.v3.test_metadata.*",
289-
"tests.v3.test_store.*",
290-
"tests.v3.test_config",
291-
"tests.v3.test_group",
292-
"tests.v3.test_indexing",
293-
"tests.v3.test_properties",
294-
"tests.v3.test_sync",
295-
"tests.v3.test_v2",
285+
"tests.package_with_entrypoint.*",
286+
"tests.test_codecs.test_codecs",
287+
"tests.test_codecs.test_transpose",
288+
"tests.test_metadata.*",
289+
"tests.test_store.*",
290+
"tests.test_config",
291+
"tests.test_group",
292+
"tests.test_indexing",
293+
"tests.test_properties",
294+
"tests.test_sync",
295+
"tests.test_v2",
296296
]
297297
ignore_errors = true
298298

src/zarr/codecs/pipeline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ async def decode_batch(
162162
) -> Iterable[NDBuffer | None]:
163163
chunk_bytes_batch: Iterable[Buffer | None]
164164
chunk_bytes_batch, chunk_specs = _unzip2(chunk_bytes_and_specs)
165-
166165
(
167166
aa_codecs_with_spec,
168167
ab_codec_with_spec,

src/zarr/codecs/sharding.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def get_chunk_slice(self, chunk_coords: ChunkCoords) -> tuple[int, int] | None:
129129
if (chunk_start, chunk_len) == (MAX_UINT_64, MAX_UINT_64):
130130
return None
131131
else:
132-
return (int(chunk_start), int(chunk_start) + int(chunk_len))
132+
return (int(chunk_start), int(chunk_len))
133133

134134
def set_chunk_slice(self, chunk_coords: ChunkCoords, chunk_slice: slice | None) -> None:
135135
localized_chunk = self._localize_chunk(chunk_coords)
@@ -203,7 +203,7 @@ def create_empty(
203203
def __getitem__(self, chunk_coords: ChunkCoords) -> Buffer:
204204
chunk_byte_slice = self.index.get_chunk_slice(chunk_coords)
205205
if chunk_byte_slice:
206-
return self.buf[chunk_byte_slice[0] : chunk_byte_slice[1]]
206+
return self.buf[chunk_byte_slice[0] : (chunk_byte_slice[0] + chunk_byte_slice[1])]
207207
raise KeyError
208208

209209
def __len__(self) -> int:
@@ -265,7 +265,8 @@ async def finalize(
265265
) -> Buffer:
266266
index_bytes = await index_encoder(self.index)
267267
if index_location == ShardingCodecIndexLocation.start:
268-
self.index.offsets_and_lengths[..., 0] += len(index_bytes)
268+
empty_chunks_mask = self.index.offsets_and_lengths[..., 0] == MAX_UINT_64
269+
self.index.offsets_and_lengths[~empty_chunks_mask, 0] += len(index_bytes)
269270
index_bytes = await index_encoder(self.index) # encode again with corrected offsets
270271
out_buf = index_bytes + self.buf
271272
else:

src/zarr/testing/utils.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Any, cast
3+
from collections.abc import Callable, Coroutine
4+
from typing import TYPE_CHECKING, Any, TypeVar, cast
45

56
import pytest
67

@@ -37,8 +38,16 @@ def has_cupy() -> bool:
3738
return False
3839

3940

41+
T_Callable = TypeVar("T_Callable", bound=Callable[[], Coroutine[Any, Any, None]])
42+
43+
4044
# Decorator for GPU tests
41-
def gpu_test(func: Any) -> Any:
42-
return pytest.mark.gpu(
43-
pytest.mark.skipif(not has_cupy(), reason="CuPy not installed or no GPU available")(func)
45+
def gpu_test(func: T_Callable) -> T_Callable:
46+
return cast(
47+
T_Callable,
48+
pytest.mark.gpu(
49+
pytest.mark.skipif(not has_cupy(), reason="CuPy not installed or no GPU available")(
50+
func
51+
)
52+
),
4453
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)