Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jhamman opened this issue Oct 10, 2024 · 0 comments · Fixed by #2329
Closed

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

jhamman opened this issue Oct 10, 2024 · 0 comments · Fixed by #2329
Assignees
Labels
bug Potential issues with the zarr-python library V3 Affects the v3 branch

Comments

@jhamman
Copy link
Member

jhamman commented Oct 10, 2024

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

@jhamman jhamman added the bug Potential issues with the zarr-python library label Oct 10, 2024
@jhamman jhamman self-assigned this Oct 10, 2024
@dstansby dstansby added the V3 Affects the v3 branch label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library V3 Affects the v3 branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants