Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork366
Description
Zarr version
3.1.1.dev52+gc019a5f26.d20250830 (current main,b8dbf56)
Numcodecs version
0.16.1
Python Version
3.12.3
Operating System
ubuntu 24.04
Installation
git
Description
Ifendian=None (and thus it is omitted from the json),BytesCodec.from_dict replaces it withendian=<system default> (by unpacking a empty dict into the kwargs ofBytesCodec.__init__ we get the default forendian).
This means that roundtrippingBytesCodec withto_dict andfrom_dict will change theendian. This has pretty limited impact, as for all dtypes where omitting the endianness is allowed changing that setting does not affect anything (or maybe somewhere else in the stack there's code that corrects this?). It did pop up when trying to write tests forzarr-developers/VirtualiZarr#787, though.
(I hope I'm not confusingto_dict andfrom_dict with "to / from JSON")
Fixing this could be as simple as callingparsed_configuration.setdefault("endian", None) inBytesCodec.from_dict.
Steps to reproduce
# /// script# requires-python = ">=3.11"# dependencies = [# "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",# ]# ///importzarrfromzarr.codecsimportBytesCodeccodec=BytesCodec(endian=None)roundtripped=BytesCodec.from_dict(codec.to_dict())assertcodec.endian==roundtripped.endian,"did not roundtrip the endianness correctly"
Additional output
No response