Skip to content

Commit f029bc2

Browse files
authored
Merge branch 'main' into keyword-only
2 parents 91fc0d3 + 26811eb commit f029bc2

File tree

9 files changed

+40
-2
lines changed

9 files changed

+40
-2
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,22 @@ body:
5757
id: reproduce
5858
attributes:
5959
label: Steps to reproduce
60-
description: Minimal, reproducible code sample, a copy-pastable example if possible.
60+
description: Minimal, reproducible code sample. Must list dependencies in [inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/#example). When put in a file named `issue.py` calling `uv run issue.py` should show the issue.
61+
value: |
62+
```python
63+
# /// script
64+
# requires-python = ">=3.11"
65+
# dependencies = [
66+
# "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
67+
# ]
68+
# ///
69+
#
70+
# This script automatically imports the development branch of zarr to check for issues
71+
72+
import zarr
73+
# your reproducer code
74+
# zarr.print_debug_info()
75+
```
6176
validations:
6277
required: true
6378
- type: textarea

changes/3081.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds ``fill_value`` to the list of attributes displayed in the output of the ``AsyncArray.info()`` method.

docs/user-guide/arrays.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ which can be used to print useful diagnostics, e.g.::
183183
Type : Array
184184
Zarr format : 3
185185
Data type : DataType.int32
186+
Fill value : 0
186187
Shape : (10000, 10000)
187188
Chunk shape : (1000, 1000)
188189
Order : C
@@ -200,6 +201,7 @@ prints additional diagnostics, e.g.::
200201
Type : Array
201202
Zarr format : 3
202203
Data type : DataType.int32
204+
Fill value : 0
203205
Shape : (10000, 10000)
204206
Chunk shape : (1000, 1000)
205207
Order : C
@@ -287,6 +289,7 @@ Here is an example using a delta filter with the Blosc compressor::
287289
Type : Array
288290
Zarr format : 3
289291
Data type : DataType.int32
292+
Fill value : 0
290293
Shape : (10000, 10000)
291294
Chunk shape : (1000, 1000)
292295
Order : C
@@ -601,6 +604,7 @@ Sharded arrays can be created by providing the ``shards`` parameter to :func:`za
601604
Type : Array
602605
Zarr format : 3
603606
Data type : DataType.uint8
607+
Fill value : 0
604608
Shape : (10000, 10000)
605609
Shard shape : (1000, 1000)
606610
Chunk shape : (100, 100)

docs/user-guide/groups.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ property. E.g.::
129129
Type : Array
130130
Zarr format : 3
131131
Data type : DataType.int64
132+
Fill value : 0
132133
Shape : (1000000,)
133134
Chunk shape : (100000,)
134135
Order : C
@@ -145,6 +146,7 @@ property. E.g.::
145146
Type : Array
146147
Zarr format : 3
147148
Data type : DataType.float32
149+
Fill value : 0.0
148150
Shape : (1000, 1000)
149151
Chunk shape : (100, 100)
150152
Order : C

docs/user-guide/performance.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ To use sharding, you need to specify the ``shards`` parameter when creating the
9292
Type : Array
9393
Zarr format : 3
9494
Data type : DataType.uint8
95+
Fill value : 0
9596
Shape : (10000, 10000, 1000)
9697
Shard shape : (1000, 1000, 1000)
9798
Chunk shape : (100, 100, 100)
@@ -122,6 +123,7 @@ ratios, depending on the correlation structure within the data. E.g.::
122123
Type : Array
123124
Zarr format : 3
124125
Data type : DataType.int32
126+
Fill value : 0
125127
Shape : (10000, 10000)
126128
Chunk shape : (1000, 1000)
127129
Order : C
@@ -141,6 +143,7 @@ ratios, depending on the correlation structure within the data. E.g.::
141143
Type : Array
142144
Zarr format : 3
143145
Data type : DataType.int32
146+
Fill value : 0
144147
Shape : (10000, 10000)
145148
Chunk shape : (1000, 1000)
146149
Order : F

src/zarr/core/_info.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def byte_info(size: int) -> str:
6767
return f"{size} ({human_readable_size(size)})"
6868

6969

70-
@dataclasses.dataclass(kw_only=True)
70+
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
7171
class ArrayInfo:
7272
"""
7373
Visual summary for an Array.
@@ -79,6 +79,7 @@ class ArrayInfo:
7979
_type: Literal["Array"] = "Array"
8080
_zarr_format: ZarrFormat
8181
_data_type: np.dtype[Any] | DataType
82+
_fill_value: object
8283
_shape: tuple[int, ...]
8384
_shard_shape: tuple[int, ...] | None = None
8485
_chunk_shape: tuple[int, ...] | None = None
@@ -97,6 +98,7 @@ def __repr__(self) -> str:
9798
Type : {_type}
9899
Zarr format : {_zarr_format}
99100
Data type : {_data_type}
101+
Fill value : {_fill_value}
100102
Shape : {_shape}""")
101103

102104
if self._shard_shape is not None:

src/zarr/core/array.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,7 @@ def _info(
17001700
return ArrayInfo(
17011701
_zarr_format=self.metadata.zarr_format,
17021702
_data_type=_data_type,
1703+
_fill_value=self.metadata.fill_value,
17031704
_shape=self.shape,
17041705
_order=self.order,
17051706
_shard_shape=self.shards,

tests/test_array.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ def test_info_v2(self, chunks: tuple[int, int], shards: tuple[int, int] | None)
482482
expected = ArrayInfo(
483483
_zarr_format=2,
484484
_data_type=np.dtype("float64"),
485+
_fill_value=arr.fill_value,
485486
_shape=(8, 8),
486487
_chunk_shape=chunks,
487488
_shard_shape=None,
@@ -499,6 +500,7 @@ def test_info_v3(self, chunks: tuple[int, int], shards: tuple[int, int] | None)
499500
expected = ArrayInfo(
500501
_zarr_format=3,
501502
_data_type=DataType.parse("float64"),
503+
_fill_value=arr.fill_value,
502504
_shape=(8, 8),
503505
_chunk_shape=chunks,
504506
_shard_shape=shards,
@@ -524,6 +526,7 @@ def test_info_complete(self, chunks: tuple[int, int], shards: tuple[int, int] |
524526
expected = ArrayInfo(
525527
_zarr_format=3,
526528
_data_type=DataType.parse("float64"),
529+
_fill_value=arr.fill_value,
527530
_shape=(8, 8),
528531
_chunk_shape=chunks,
529532
_shard_shape=shards,
@@ -559,6 +562,7 @@ async def test_info_v2_async(
559562
expected = ArrayInfo(
560563
_zarr_format=2,
561564
_data_type=np.dtype("float64"),
565+
_fill_value=arr.metadata.fill_value,
562566
_shape=(8, 8),
563567
_chunk_shape=(2, 2),
564568
_shard_shape=None,
@@ -584,6 +588,7 @@ async def test_info_v3_async(
584588
expected = ArrayInfo(
585589
_zarr_format=3,
586590
_data_type=DataType.parse("float64"),
591+
_fill_value=arr.metadata.fill_value,
587592
_shape=(8, 8),
588593
_chunk_shape=chunks,
589594
_shard_shape=shards,
@@ -611,6 +616,7 @@ async def test_info_complete_async(
611616
expected = ArrayInfo(
612617
_zarr_format=3,
613618
_data_type=DataType.parse("float64"),
619+
_fill_value=arr.metadata.fill_value,
614620
_shape=(8, 8),
615621
_chunk_shape=chunks,
616622
_shard_shape=shards,

tests/test_info.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def test_array_info(zarr_format: ZarrFormat) -> None:
5454
info = ArrayInfo(
5555
_zarr_format=zarr_format,
5656
_data_type=np.dtype("int32"),
57+
_fill_value=0,
5758
_shape=(100, 100),
5859
_chunk_shape=(10, 100),
5960
_order="C",
@@ -66,6 +67,7 @@ def test_array_info(zarr_format: ZarrFormat) -> None:
6667
Type : Array
6768
Zarr format : {zarr_format}
6869
Data type : int32
70+
Fill value : 0
6971
Shape : (100, 100)
7072
Chunk shape : (10, 100)
7173
Order : C
@@ -92,6 +94,7 @@ def test_array_info_complete(
9294
info = ArrayInfo(
9395
_zarr_format=zarr_format,
9496
_data_type=np.dtype("int32"),
97+
_fill_value=0,
9598
_shape=(100, 100),
9699
_chunk_shape=(10, 100),
97100
_order="C",
@@ -107,6 +110,7 @@ def test_array_info_complete(
107110
Type : Array
108111
Zarr format : {zarr_format}
109112
Data type : int32
113+
Fill value : 0
110114
Shape : (100, 100)
111115
Chunk shape : (10, 100)
112116
Order : C

0 commit comments

Comments
 (0)