Skip to content

Commit b6f6031

Browse files
authored
Merge branch 'main' into fix-labelling
2 parents 13a5d63 + 3652611 commit b6f6031

File tree

16 files changed

+131
-77
lines changed

16 files changed

+131
-77
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
TODO:
44
* [ ] Add unit tests and/or doctests in docstrings
55
* [ ] Add docstrings and API docs for any new/modified user-facing classes and functions
6-
* [ ] New/modified features documented in docs/tutorial.rst
7-
* [ ] Changes documented in docs/release.rst
6+
* [ ] New/modified features documented in `docs/user-guide/*.rst`
7+
* [ ] Changes documented in `docs/release-notes.rst`
88
* [ ] GitHub Actions have all passed
99
* [ ] Test coverage is 100% (Codecov passes)

.github/dependabot.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
---
22
version: 2
33
updates:
4-
# Updates for v3 branch (the default branch)
5-
- package-ecosystem: "pip"
6-
directory: "/"
7-
schedule:
8-
interval: "daily"
9-
groups:
10-
actions:
11-
patterns:
12-
- "*"
4+
# Updates for main
135
- package-ecosystem: "github-actions"
146
directory: "/"
157
schedule:
@@ -19,19 +11,19 @@ updates:
1911
patterns:
2012
- "*"
2113

22-
# Same updates, but for main branch
14+
# Updates for support/v2 branch
2315
- package-ecosystem: "pip"
2416
directory: "/"
25-
target-branch: "main"
17+
target-branch: "support/v2"
2618
schedule:
27-
interval: "daily"
19+
interval: "weekly"
2820
groups:
2921
requirements:
3022
patterns:
3123
- "*"
3224
- package-ecosystem: "github-actions"
3325
directory: "/"
34-
target-branch: "main"
26+
target-branch: "support/v2"
3527
schedule:
3628
interval: "weekly"
3729
groups:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ci:
66
default_stages: [pre-commit, pre-push]
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.8.6
9+
rev: v0.9.1
1010
hooks:
1111
- id: ruff
1212
args: ["--fix", "--show-fixes"]

docs/conf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515

1616
import os
1717
import sys
18+
from importlib.metadata import version as get_version
1819
from typing import Any
1920

2021
import sphinx
2122
import sphinx.application
2223

23-
from importlib.metadata import version as get_version
24-
25-
import sphinx
26-
2724
# If extensions (or modules to document with autodoc) are in another directory,
2825
# add these directories to sys.path here. If the directory is relative to the
2926
# documentation root, use os.path.abspath to make it absolute, like shown here.

docs/release-notes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ Bug fixes
1111
~~~~~~~~~
1212
* Fixes ``order`` argument for Zarr format 2 arrays (:issue:`2679`).
1313

14+
* Fixes a bug that prevented reading Zarr format 2 data with consolidated metadata written using ``zarr-python`` version 2 (:issue:`2694`).
15+
16+
* Ensure that compressor=None results in no compression when writing Zarr format 2 data (:issue:`2708`)
17+
1418
Behaviour changes
1519
~~~~~~~~~~~~~~~~~
1620

21+
Other
22+
~~~~~
23+
* Removed some unnecessary files from the source distribution
24+
to reduce its size. (:issue:`2686`)
25+
26+
1727
.. _release_3.0.0:
1828

1929
3.0.0

pyproject.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

5+
[tool.hatch.build.targets.sdist]
6+
exclude = [
7+
"/.github",
8+
"/bench",
9+
"/docs",
10+
"/notebooks"
11+
]
512

613
[project]
714
name = "zarr"
@@ -221,11 +228,12 @@ See Spec 0000 for details and drop schedule: https://scientific-python.org/specs
221228
"""
222229
python = "3.11"
223230
dependencies = [
231+
'zarr[remote]',
224232
'packaging==22.*',
225233
'numpy==1.25.*',
226234
'numcodecs==0.14.*', # 0.14 needed for zarr3 codecs
227-
'fsspec==2022.10.0',
228-
's3fs==2022.10.0',
235+
'fsspec==2023.10.0',
236+
's3fs==2023.10.0',
229237
'universal_pathlib==0.0.22',
230238
'typing_extensions==4.9.*',
231239
'donfig==0.8.*',
@@ -319,8 +327,6 @@ ignore = [
319327
"Q003",
320328
"COM812",
321329
"COM819",
322-
"ISC001",
323-
"ISC002",
324330
]
325331

326332
[tool.ruff.lint.extend-per-file-ignores]

src/zarr/codecs/sharding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ async def get(
8686
self, prototype: BufferPrototype, byte_range: ByteRequest | None = None
8787
) -> Buffer | None:
8888
assert byte_range is None, "byte_range is not supported within shards"
89-
assert (
90-
prototype == default_buffer_prototype()
91-
), f"prototype is not supported within shards currently. diff: {prototype} != {default_buffer_prototype()}"
89+
assert prototype == default_buffer_prototype(), (
90+
f"prototype is not supported within shards currently. diff: {prototype} != {default_buffer_prototype()}"
91+
)
9292
return self.shard_dict.get(self.chunk_coords)
9393

9494

src/zarr/core/array.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
_parse_bytes_bytes_codec,
113113
get_pipeline_class,
114114
)
115-
from zarr.storage import StoreLike
116115
from zarr.storage._common import StorePath, ensure_no_existing_node, make_store_path
117116

118117
if TYPE_CHECKING:
@@ -4131,15 +4130,22 @@ def _parse_chunk_encoding_v3(
41314130

41324131

41334132
def _parse_deprecated_compressor(
4134-
compressor: CompressorLike | None, compressors: CompressorsLike
4133+
compressor: CompressorLike | None, compressors: CompressorsLike, zarr_format: int = 3
41354134
) -> CompressorsLike | None:
4136-
if compressor:
4135+
if compressor != "auto":
41374136
if compressors != "auto":
41384137
raise ValueError("Cannot specify both `compressor` and `compressors`.")
4139-
warn(
4140-
"The `compressor` argument is deprecated. Use `compressors` instead.",
4141-
category=UserWarning,
4142-
stacklevel=2,
4143-
)
4144-
compressors = (compressor,)
4138+
if zarr_format == 3:
4139+
warn(
4140+
"The `compressor` argument is deprecated. Use `compressors` instead.",
4141+
category=UserWarning,
4142+
stacklevel=2,
4143+
)
4144+
if compressor is None:
4145+
# "no compression"
4146+
compressors = ()
4147+
else:
4148+
compressors = (compressor,)
4149+
elif zarr_format == 2 and compressor == compressors == "auto":
4150+
compressors = ({"id": "blosc"},)
41454151
return compressors

src/zarr/core/group.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
create_array,
3232
)
3333
from zarr.core.attributes import Attributes
34-
from zarr.core.buffer import Buffer, default_buffer_prototype
34+
from zarr.core.buffer import default_buffer_prototype
3535
from zarr.core.common import (
3636
JSON,
3737
ZARR_JSON,
@@ -573,8 +573,8 @@ def _from_bytes_v2(
573573
v2_consolidated_metadata = json.loads(consolidated_metadata_bytes.to_bytes())
574574
v2_consolidated_metadata = v2_consolidated_metadata["metadata"]
575575
# We already read zattrs and zgroup. Should we ignore these?
576-
v2_consolidated_metadata.pop(".zattrs")
577-
v2_consolidated_metadata.pop(".zgroup")
576+
v2_consolidated_metadata.pop(".zattrs", None)
577+
v2_consolidated_metadata.pop(".zgroup", None)
578578

579579
consolidated_metadata: defaultdict[str, dict[str, Any]] = defaultdict(dict)
580580

@@ -1011,7 +1011,7 @@ async def create_array(
10111011
shards: ShardsLike | None = None,
10121012
filters: FiltersLike = "auto",
10131013
compressors: CompressorsLike = "auto",
1014-
compressor: CompressorLike = None,
1014+
compressor: CompressorLike = "auto",
10151015
serializer: SerializerLike = "auto",
10161016
fill_value: Any | None = 0,
10171017
order: MemoryOrder | None = None,
@@ -1114,8 +1114,9 @@ async def create_array(
11141114
AsyncArray
11151115
11161116
"""
1117-
1118-
compressors = _parse_deprecated_compressor(compressor, compressors)
1117+
compressors = _parse_deprecated_compressor(
1118+
compressor, compressors, zarr_format=self.metadata.zarr_format
1119+
)
11191120
return await create_array(
11201121
store=self.store_path,
11211122
name=name,
@@ -2244,7 +2245,7 @@ def create_array(
22442245
shards: ShardsLike | None = None,
22452246
filters: FiltersLike = "auto",
22462247
compressors: CompressorsLike = "auto",
2247-
compressor: CompressorLike = None,
2248+
compressor: CompressorLike = "auto",
22482249
serializer: SerializerLike = "auto",
22492250
fill_value: Any | None = 0,
22502251
order: MemoryOrder | None = "C",
@@ -2346,7 +2347,9 @@ def create_array(
23462347
-------
23472348
AsyncArray
23482349
"""
2349-
compressors = _parse_deprecated_compressor(compressor, compressors)
2350+
compressors = _parse_deprecated_compressor(
2351+
compressor, compressors, zarr_format=self.metadata.zarr_format
2352+
)
23502353
return Array(
23512354
self._sync(
23522355
self._async_group.create_array(

src/zarr/core/indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ def is_pure_orthogonal_indexing(selection: Selection, ndim: int) -> TypeGuard[Or
289289
def get_chunk_shape(chunk_grid: ChunkGrid) -> ChunkCoords:
290290
from zarr.core.chunk_grids import RegularChunkGrid
291291

292-
assert isinstance(
293-
chunk_grid, RegularChunkGrid
294-
), "Only regular chunk grid is supported, currently."
292+
assert isinstance(chunk_grid, RegularChunkGrid), (
293+
"Only regular chunk grid is supported, currently."
294+
)
295295
return chunk_grid.chunk_shape
296296

297297

0 commit comments

Comments
 (0)