Skip to content

Commit be84ea6

Browse files
authored
Merge branch 'main' into chore/add-zizimor
2 parents f0f67bc + 2dc4036 commit be84ea6

File tree

7 files changed

+105
-143
lines changed

7 files changed

+105
-143
lines changed

changes/3833.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the warning that is emitted when any Numcodecs codec is instantiated.

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.

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

src/zarr/codecs/numcodecs/_codecs.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from dataclasses import dataclass, replace
3333
from functools import cached_property
3434
from typing import TYPE_CHECKING, Any, Self
35-
from warnings import warn
3635

3736
import numpy as np
3837

@@ -41,7 +40,6 @@
4140
from zarr.core.buffer.cpu import as_numpy_array_wrapper
4241
from zarr.core.common import JSON, parse_named_configuration, product
4342
from zarr.dtype import UInt8, ZDType, parse_dtype
44-
from zarr.errors import ZarrUserWarning
4543
from zarr.registry import get_numcodec
4644

4745
if TYPE_CHECKING:
@@ -102,12 +100,6 @@ def __init__(self, **codec_config: JSON) -> None:
102100
) # pragma: no cover
103101

104102
object.__setattr__(self, "codec_config", codec_config)
105-
warn(
106-
"Numcodecs codecs are not in the Zarr version 3 specification and "
107-
"may not be supported by other zarr implementations.",
108-
category=ZarrUserWarning,
109-
stacklevel=2,
110-
)
111103

112104
@cached_property
113105
def _codec(self) -> Numcodec:

tests/test_array.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,24 +1853,21 @@ def test_roundtrip_numcodecs() -> None:
18531853

18541854
# Create the array with the correct codecs
18551855
root = zarr.group(store)
1856-
warn_msg = "Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations."
1857-
with pytest.warns(ZarrUserWarning, match=warn_msg):
1858-
root.create_array(
1859-
"test",
1860-
shape=(720, 1440),
1861-
chunks=(720, 1440),
1862-
dtype="float64",
1863-
compressors=compressors, # type: ignore[arg-type]
1864-
filters=filters, # type: ignore[arg-type]
1865-
fill_value=-9.99,
1866-
dimension_names=["lat", "lon"],
1867-
)
1856+
root.create_array(
1857+
"test",
1858+
shape=(720, 1440),
1859+
chunks=(720, 1440),
1860+
dtype="float64",
1861+
compressors=compressors, # type: ignore[arg-type]
1862+
filters=filters, # type: ignore[arg-type]
1863+
fill_value=-9.99,
1864+
dimension_names=["lat", "lon"],
1865+
)
18681866

18691867
BYTES_CODEC = {"name": "bytes", "configuration": {"endian": "little"}}
18701868
# Read in the array again and check compressor config
18711869
root = zarr.open_group(store)
1872-
with pytest.warns(ZarrUserWarning, match=warn_msg):
1873-
metadata = root["test"].metadata.to_dict()
1870+
metadata = root["test"].metadata.to_dict()
18741871
expected = (*filters, BYTES_CODEC, *compressors)
18751872
assert metadata["codecs"] == expected
18761873

tests/test_cli/test_migrate_v3.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
runner = typer_testing.CliRunner()
3434

35-
NUMCODECS_USER_WARNING = "Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations."
36-
3735

3836
def test_migrate_array(local_store: LocalStore) -> None:
3937
shape = (10, 10)
@@ -316,7 +314,6 @@ def test_migrate_compressor(
316314
assert np.all(zarr_array[:] == 1)
317315

318316

319-
@pytest.mark.filterwarnings(f"ignore:{NUMCODECS_USER_WARNING}:UserWarning")
320317
def test_migrate_numcodecs_compressor(local_store: LocalStore) -> None:
321318
"""Test migration of a numcodecs compressor without a zarr.codecs equivalent."""
322319

@@ -360,7 +357,6 @@ def test_migrate_numcodecs_compressor(local_store: LocalStore) -> None:
360357
assert np.all(zarr_array[:] == 1)
361358

362359

363-
@pytest.mark.filterwarnings(f"ignore:{NUMCODECS_USER_WARNING}:UserWarning")
364360
def test_migrate_filter(local_store: LocalStore) -> None:
365361
filter_v2 = numcodecs.Delta(dtype="<u2", astype="<u2")
366362
filter_v3 = Delta(dtype="<u2", astype="<u2")
@@ -524,8 +520,7 @@ def test_migrate_incorrect_filter(local_store: LocalStore) -> None:
524520
fill_value=0,
525521
)
526522

527-
with pytest.warns(UserWarning, match=NUMCODECS_USER_WARNING):
528-
result = runner.invoke(cli.app, ["migrate", "v3", str(local_store.root)])
523+
result = runner.invoke(cli.app, ["migrate", "v3", str(local_store.root)])
529524

530525
assert result.exit_code == 1
531526
assert isinstance(result.exception, TypeError)
@@ -548,8 +543,7 @@ def test_migrate_incorrect_compressor(local_store: LocalStore) -> None:
548543
fill_value=0,
549544
)
550545

551-
with pytest.warns(UserWarning, match=NUMCODECS_USER_WARNING):
552-
result = runner.invoke(cli.app, ["migrate", "v3", str(local_store.root)])
546+
result = runner.invoke(cli.app, ["migrate", "v3", str(local_store.root)])
553547

554548
assert result.exit_code == 1
555549
assert isinstance(result.exception, TypeError)

0 commit comments

Comments
 (0)