Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BytesCodec'sendian does not roundtrip #3416

Open
Labels
bugPotential issues with the zarr-python library
@keewis

Description

@keewis

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

Metadata

Metadata

Assignees

No one assigned

    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


      [8]ページ先頭

      ©2009-2025 Movatter.jp