Skip to content

Commit 73352f8

Browse files
authored
Merge branch 'main' into ig/shard_order
2 parents 09e2bc5 + c9b534a commit 73352f8

12 files changed

Lines changed: 310 additions & 24 deletions

File tree

.github/workflows/gpu_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ jobs:
7272
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
7373
with:
7474
token: ${{ secrets.CODECOV_TOKEN }}
75+
flags: gpu
7576
verbose: true # optional (default = false)

.github/workflows/hypothesis.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
uses: codecov/codecov-action@v5
8282
with:
8383
token: ${{ secrets.CODECOV_TOKEN }}
84+
flags: tests
8485
verbose: true # optional (default = false)
8586

8687
- name: Generate and publish the report

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
uses: codecov/codecov-action@v5
7272
with:
7373
token: ${{ secrets.CODECOV_TOKEN }}
74+
flags: tests
7475
verbose: true # optional (default = false)
7576

7677
test-upstream-and-min-deps:
@@ -110,6 +111,7 @@ jobs:
110111
uses: codecov/codecov-action@v5
111112
with:
112113
token: ${{ secrets.CODECOV_TOKEN }}
114+
flags: tests
113115
verbose: true # optional (default = false)
114116

115117
doctests:

changes/2720.doc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document removal of `zarr.storage.init_group` in v3 migration guide, with replacement using `zarr.open_group`/`zarr.create_group`.

changes/3845.doc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove result="ansi" from code blocks in the user guide that were causing empty output cells in the rendered documentation.

codecov.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@ coverage:
88
default:
99
target: auto
1010
threshold: 0.1
11+
flags:
12+
- tests
13+
flags:
14+
tests:
15+
paths:
16+
- src/
17+
carryforward: true
18+
gpu:
19+
paths:
20+
- src/
21+
carryforward: true
1122
codecov:
1223
notify:
13-
after_n_builds: 10 # Wait for all 10 reports before updating the status
24+
# 6 = test.yml: 3 (optional+ubuntu) + 2 (upstream + min_deps), hypothesis: 1
25+
after_n_builds: 6
1426
wait_for_ci: yes
1527
comment:
1628
layout: "diff, files"

docs/user-guide/experimental.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ such as a remote store for source data and a local store for persistent caching.
5555

5656
The CacheStore provides significant performance improvements for repeated data access:
5757

58-
```python exec="true" session="experimental" source="above" result="ansi"
58+
```python exec="true" session="experimental" source="above"
5959
import time
6060

6161
# Benchmark reading with cache
@@ -121,7 +121,7 @@ cache = CacheStore(
121121

122122
**cache_set_data**: Controls whether written data is cached
123123

124-
```python exec="true" session="experimental" source="above" result="ansi"
124+
```python exec="true" session="experimental" source="above"
125125
# Cache data when writing (default)
126126
cache = CacheStore(
127127
store=source_store,
@@ -141,7 +141,7 @@ cache = CacheStore(
141141

142142
The CacheStore provides statistics to monitor cache performance and state:
143143

144-
```python exec="true" session="experimental" source="above" result="ansi"
144+
```python exec="true" session="experimental" source="above"
145145
# Access some data to generate cache activity
146146
data = zarr_array[0:50, 0:50] # First access - cache miss
147147
data = zarr_array[0:50, 0:50] # Second access - cache hit
@@ -232,7 +232,7 @@ of source and cache stores for your specific use case.
232232

233233
Here's a complete example demonstrating cache effectiveness:
234234

235-
```python exec="true" session="experimental-final" source="above" result="ansi"
235+
```python exec="true" session="experimental-final" source="above"
236236
import numpy as np
237237
import time
238238
from tempfile import mkdtemp

docs/user-guide/v3_migration.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ The following sections provide details on breaking changes in Zarr-Python 3.
114114
- Use [`zarr.Group.require_array`][] in place of `zarr.Group.require_dataset`
115115
3. Disallow "." syntax for getting group members. To get a member of a group named `foo`,
116116
use `group["foo"]` in place of `group.foo`.
117+
4. The `zarr.storage.init_group` low-level helper function has been removed. Use
118+
[`zarr.open_group`][] or [`zarr.create_group`][] instead:
119+
120+
```diff
121+
- from zarr.storage import init_group
122+
- init_group(store, overwrite=True, path="my/path")
123+
+ import zarr
124+
+ zarr.open_group(store, mode="w", path="my/path")
125+
```
117126

118127
### The Store class
119128

pyproject.toml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,6 @@ hooks.vcs.version-file = "src/zarr/_version.py"
155155
dependency-groups = ["test"]
156156

157157
[tool.hatch.envs.test.env-vars]
158-
# Required to test with a pytest plugin; see https://pytest-cov.readthedocs.io/en/latest/plugins.html
159-
COV_CORE_SOURCE = "src"
160-
COV_CORE_CONFIG = ".coveragerc"
161-
COV_CORE_DATAFILE = ".coverage.eager"
162158

163159
[[tool.hatch.envs.test.matrix]]
164160
python = ["3.12", "3.13", "3.14"]
@@ -175,13 +171,23 @@ matrix.deps.dependency-groups = [
175171
]
176172

177173
[tool.hatch.envs.test.scripts]
178-
run-coverage = "pytest --cov-config=pyproject.toml --cov=src --cov-append --cov-report xml --junitxml=junit.xml -o junit_family=legacy"
179-
run-coverage-html = "pytest --cov-config=pyproject.toml --cov=src --cov-append --cov-report html"
180-
run = "run-coverage --no-cov --ignore tests/benchmarks"
174+
run-coverage = [
175+
"coverage run --source=src -m pytest --junitxml=junit.xml -o junit_family=legacy {args:}",
176+
"coverage xml",
177+
]
178+
run-coverage-html = [
179+
"coverage run --source=src -m pytest {args:}",
180+
"coverage html",
181+
]
182+
run = "pytest --ignore tests/benchmarks"
181183
run-verbose = "run-coverage --verbose"
182184
run-mypy = "mypy src"
183-
run-hypothesis = "run-coverage -nauto --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful*"
185+
run-hypothesis = [
186+
"coverage run --source=src -m pytest -nauto --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful* {args:}",
187+
"coverage xml",
188+
]
184189
run-benchmark = "pytest --benchmark-enable tests/benchmarks"
190+
serve-coverage-html = "python -m http.server -d htmlcov 8000"
185191
list-env = "pip list"
186192

187193
[tool.hatch.envs.gputest]
@@ -195,8 +201,11 @@ features = ["gpu"]
195201
python = ["3.12", "3.13"]
196202

197203
[tool.hatch.envs.gputest.scripts]
198-
run-coverage = "pytest -m gpu --cov-config=pyproject.toml --cov=src --cov-report xml --junitxml=junit.xml -o junit_family=legacy --ignore tests/benchmarks"
199-
run = "run-coverage --no-cov"
204+
run-coverage = [
205+
"coverage run --source=src -m pytest -m gpu --junitxml=junit.xml -o junit_family=legacy --ignore tests/benchmarks {args:}",
206+
"coverage xml",
207+
]
208+
run = "pytest -m gpu --ignore tests/benchmarks"
200209

201210
[tool.hatch.envs.upstream]
202211
template = 'test'

src/zarr/abc/codec.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,19 @@ def _check_codecjson_v2(data: object) -> TypeGuard[CodecJSON_V2[str]]:
6767

6868

6969
@runtime_checkable
70-
class SupportsSyncCodec(Protocol):
70+
class SupportsSyncCodec[CI: CodecInput, CO: CodecOutput](Protocol):
7171
"""Protocol for codecs that support synchronous encode/decode.
7272
73-
Codecs implementing this protocol provide ``_decode_sync`` and ``_encode_sync``
73+
Codecs implementing this protocol provide `_decode_sync` and `_encode_sync`
7474
methods that perform encoding/decoding without requiring an async event loop.
75+
76+
The type parameters mirror `BaseCodec`: `CI` is the decoded type and `CO` is
77+
the encoded type.
7578
"""
7679

77-
def _decode_sync(
78-
self, chunk_data: NDBuffer | Buffer, chunk_spec: ArraySpec
79-
) -> NDBuffer | Buffer: ...
80+
def _decode_sync(self, chunk_data: CO, chunk_spec: ArraySpec) -> CI: ...
8081

81-
def _encode_sync(
82-
self, chunk_data: NDBuffer | Buffer, chunk_spec: ArraySpec
83-
) -> NDBuffer | Buffer | None: ...
82+
def _encode_sync(self, chunk_data: CI, chunk_spec: ArraySpec) -> CO | None: ...
8483

8584

8685
class BaseCodec[CI: CodecInput, CO: CodecOutput](Metadata):

0 commit comments

Comments
 (0)