Skip to content

BloscCodec is broken #3427

Closed
Closed

Description

@d-v-b

We need to fix the following behavior of the BloscCodec:

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
#
# This script automatically imports the development branch of zarr to check for issues

from zarr.codecs import BloscCodec
b = BloscCodec()
b.to_dict()
# ValueError: `typesize` needs to be set for serialization.

This means picking usable defaults instead of creating a completely broken object.

Unfortunately I am not sure how to gracefully fix this, since we have load-bearing internal code that relies on certain BloscCodec fields being set to None.

Activity

  1. d-v-b commented on Sep 25, 2025

    @d-v-b
    ContributorAuthor

    here is a concrete solution that would be backwards-compatible:

    We add a new attribute to the Codec API that defines which of the other codec attributes can be re-set in the context of a codec pipeline. Codec creation would look like this:

    # The itemsize can be tuned in the codec pipeline
    compressor=BloscCodec(typesize=2, tunable={"itemsize"})
    
    # The itemsize _cannot_ be tuned in the codec pipeline
    compressor=BloscCodec(typesize=2, tunable={})

    obviously evolve_from_array_spec would have to respect the contents of the tunable attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions