Skip to content

Commit a5b6873

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 0a18445 + 5ff3fbe commit a5b6873

File tree

23 files changed

+191
-98
lines changed

23 files changed

+191
-98
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ repos:
3737
- obstore>=0.5.1
3838
# Tests
3939
- pytest
40+
- hypothesis
4041
- repo: https://github.com/scientific-python/cookie
4142
rev: 2025.01.22
4243
hooks:

changes/2962.fix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Internally use `typesize` constructor parameter for :class:`numcodecs.blosc.Blosc` to improve compression ratios back to the v2-package levels.

changes/2978.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed sharding with GPU buffers.

changes/3045.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed the typing of ``dimension_names`` arguments throughout so that it now accepts iterables that contain `None` alongside `str`.

docs/user-guide/arrays.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ prints additional diagnostics, e.g.::
209209
Serializer : BytesCodec(endian=<Endian.little: 'little'>)
210210
Compressors : (BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0),)
211211
No. bytes : 400000000 (381.5M)
212-
No. bytes stored : 9696520
213-
Storage ratio : 41.3
212+
No. bytes stored : 3558573
213+
Storage ratio : 112.4
214214
Chunks Initialized : 100
215215

216216
.. note::

pyproject.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ test = [
8383
remote_tests = [
8484
'zarr[remote]',
8585
"botocore",
86-
"s3fs",
86+
"s3fs>=2023.10.0",
8787
"moto[s3,server]",
8888
"requests",
8989
]
@@ -104,7 +104,7 @@ docs = [
104104
# Optional dependencies to run examples
105105
'numcodecs[msgpack]',
106106
'rich',
107-
's3fs',
107+
's3fs>=2023.10.0',
108108
'astroid<4'
109109
]
110110

@@ -348,27 +348,27 @@ python_version = "3.11"
348348
ignore_missing_imports = true
349349
namespace_packages = false
350350

351-
352351
strict = true
353352
warn_unreachable = true
354-
355353
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
356354

355+
357356
[[tool.mypy.overrides]]
358357
module = [
359-
"zarr.v2.*",
358+
"tests.package_with_entrypoint.*",
359+
"zarr.testing.stateful",
360+
"tests.test_codecs.test_transpose",
361+
"tests.test_config"
360362
]
361-
ignore_errors = true
363+
strict = false
362364

365+
# TODO: Move the next modules up to the strict = false section
366+
# and fix the errors
363367
[[tool.mypy.overrides]]
364368
module = [
365-
"zarr.testing.stateful", # lots of hypothesis decorator errors
366-
"tests.package_with_entrypoint.*",
367369
"tests.test_codecs.test_codecs",
368-
"tests.test_codecs.test_transpose",
369370
"tests.test_metadata.*",
370371
"tests.test_store.*",
371-
"tests.test_config",
372372
"tests.test_group",
373373
"tests.test_indexing",
374374
"tests.test_properties",

src/zarr/api/asynchronous.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
JSON,
1717
AccessModeLiteral,
1818
ChunkCoords,
19+
DimensionNames,
1920
MemoryOrder,
2021
ZarrFormat,
2122
_default_zarr_format,
@@ -865,7 +866,7 @@ async def create(
865866
| None
866867
) = None,
867868
codecs: Iterable[Codec | dict[str, JSON]] | None = None,
868-
dimension_names: Iterable[str] | None = None,
869+
dimension_names: DimensionNames = None,
869870
storage_options: dict[str, Any] | None = None,
870871
config: ArrayConfigLike | None = None,
871872
**kwargs: Any,

src/zarr/api/synchronous.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
JSON,
3434
AccessModeLiteral,
3535
ChunkCoords,
36+
DimensionNames,
3637
MemoryOrder,
3738
ShapeLike,
3839
ZarrFormat,
@@ -626,7 +627,7 @@ def create(
626627
| None
627628
) = None,
628629
codecs: Iterable[Codec | dict[str, JSON]] | None = None,
629-
dimension_names: Iterable[str] | None = None,
630+
dimension_names: DimensionNames = None,
630631
storage_options: dict[str, Any] | None = None,
631632
config: ArrayConfigLike | None = None,
632633
**kwargs: Any,
@@ -761,7 +762,7 @@ def create_array(
761762
zarr_format: ZarrFormat | None = 3,
762763
attributes: dict[str, JSON] | None = None,
763764
chunk_key_encoding: ChunkKeyEncodingLike | None = None,
764-
dimension_names: Iterable[str] | None = None,
765+
dimension_names: DimensionNames = None,
765766
storage_options: dict[str, Any] | None = None,
766767
overwrite: bool = False,
767768
config: ArrayConfigLike | None = None,
@@ -926,7 +927,7 @@ def from_array(
926927
zarr_format: ZarrFormat | None = None,
927928
attributes: dict[str, JSON] | None = None,
928929
chunk_key_encoding: ChunkKeyEncodingLike | None = None,
929-
dimension_names: Iterable[str] | None = None,
930+
dimension_names: DimensionNames = None,
930931
storage_options: dict[str, Any] | None = None,
931932
overwrite: bool = False,
932933
config: ArrayConfigLike | None = None,

src/zarr/codecs/blosc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import numcodecs
1010
from numcodecs.blosc import Blosc
11+
from packaging.version import Version
1112

1213
from zarr.abc.codec import BytesBytesCodec
1314
from zarr.core.buffer.cpu import as_numpy_array_wrapper
@@ -163,6 +164,9 @@ def _blosc_codec(self) -> Blosc:
163164
"shuffle": map_shuffle_str_to_int[self.shuffle],
164165
"blocksize": self.blocksize,
165166
}
167+
# See https://github.com/zarr-developers/numcodecs/pull/713
168+
if Version(numcodecs.__version__) >= Version("0.16.0"):
169+
config_dict["typesize"] = self.typesize
166170
return Blosc.from_config(config_dict)
167171

168172
async def _decode_single(

src/zarr/codecs/sharding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ def _get_index_chunk_spec(self, chunks_per_shard: ChunkCoords) -> ArraySpec:
683683
config=ArrayConfig(
684684
order="C", write_empty_chunks=False
685685
), # Note: this is hard-coded for simplicity -- it is not surfaced into user code,
686-
prototype=numpy_buffer_prototype(),
686+
prototype=default_buffer_prototype(),
687687
)
688688

689689
def _get_chunk_spec(self, shard_spec: ArraySpec) -> ArraySpec:

0 commit comments

Comments
 (0)