Skip to content

[v3] failure to roundtrip attrs when set via dict interface #2328

@jhamman

Description

@jhamman

Zarr version

zarr-3.0.0a8.dev17+g6b11bb8b

Numcodecs version

v0.13

Python Version

3.11

Operating System

Mac

Installation

pip

Description

Setting an attribute via the Array.attrs.__setitem__ interface succeeds at updating the Array metadata in the store but subsequently accessing the attribute fails.

Steps to reproduce

In [1]: import zarr

In [2]: store = zarr.storage.MemoryStore({}, mode="w")
   ...: array = zarr.create(shape=1, store=store)
   ...: array.attrs['foo'] = 'bar'
   ...: dict(array.attrs) # -> empty!
Out[2]: {}

In [3]: store._store_dict['zarr.json'].to_bytes()
Out[3]: b'{"shape": [1], "data_type": "float64", "chunk_grid": {"name": "regular", "configuration": {"chunk_shape": [1]}}, "chunk_key_encoding": {"name": "default", "configuration": {"separator": "/"}}, "fill_value": 0.0, "codecs": [{"name": "bytes", "configuration": {"endian": "little"}}], "attributes": {"foo": "bar"}, "zarr_format": 3, "node_type": "array", "storage_transformers": []}'

Additional output

No response

Metadata

Metadata

Assignees

Labels

bugPotential issues with the zarr-python library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions