Skip to content

zarr-storage subpackage #4682

Backlog
Backlog

Description

@d-v-b

there are quite a few changes I'd like make to the Store API, based on experience with our existing API and also lessons from libraries like tensorstore, zarrs, and zarrista

  • formally separate sync stores from async stores. stores that benefit from asyncio (e.g., http) would use async. stores that don't benefit from it (memory) would not. this change would remove tech debt accrued as part of the FusedCodecPipeline development process, where we added synchronous store methods after the fact to some stores. see fully separate sync and async internal APIs #4217
  • associate IO operations with return values that include information about the IO operation itself. e.g., instead of store.get returning raw bytes or None, it returns some IOResult type that contains the raw bytes (or absence) as well as information like etag, timestamp, etc. this will make caching much easier.
  • caching in all stores by default (e.g., folding CacheStore into the base store class)
  • first-class support for conditional IO operations, gated by platform support
  • type-level distinction between read-only stores and stores that support mutation
  • debugging / consistency / deduplication. there are many inconsistencies between our store classes today that are a constant source of bugs, mostly in path handling. we have also mirrored our store API in two classes: Store and StorePath. a rationalization effort will get us a much lower rate of bug reports.
    etc, there are probably many more fixes / improvements I'm not listing here.

I don't think it's practical to make these changes as a sequence of gradual alterations to our existing Store API. It would take forever, and friction would jump to infinity with the first breaking change. So I have a different idea:

  1. define a zarr_storage subpackage at packages/zarr-storage
  2. copy + paste our existing Store api in zarr_storage.legacy
  3. zarr depends on zarr_storage for the legacy store API (i.e., no behavioral changes)
  4. develop a new store API in zarr_storage. when that new API is stable, we allow zarr to consume it. crucially, we can add new features to zarr_storage without affecting zarr.
  5. when the new store API is established, we deprecate zarr_storage.legacy
  6. finally, zarr depends exclusively on the new API. This could be a major version increment of zarr or not, depending on how smooth we make the deprecation.

This will also be slow, but I think it will be gradual, i.e. we can make progress using this strategy. Third-party store implementations like Icechunk will have plenty of time to adapt. And we can keep support for the old Store API around as long as we need.

So, the main discussion point is whether a subpackage is a good way to evolve our storage API. Personally I don't see an alternative way to ship fundamental changes like the return type of get without a ton of immediate breakage, but maybe folks have better ideas.

If we are aligned in this path, I'd start pushing the requisite changes.

Activity

  1. d-v-b commented on Dec 1, 2026

    @d-v-b
    ContributorAuthor

    cc @zarr-developers/python-core-devs

  2. normanrz commented on Dec 1, 2026

    @normanrz
    Member

    Sounds good!

  3. maxrjones commented on Dec 1, 2026

    @maxrjones
    Member

    Thanks for the proposal, Davis. I agree with all your motivations and the vision.

    Procedurally, I don't understand the benefits of doing 2-3 before 4. It seems like defining zarr-storage's interfact is the hard part. I think there's value in doing the hard part first, since 2-3 offers is only worthwhile if 4 succeeds. So, let's built zarr-storage first and make sure it can be designed in a way that makes the creation of a legacy module worthwhile.

  4. d-v-b commented on Dec 1, 2026

    @d-v-b
    ContributorAuthor

    hi max, I'm totally up for developing the future API concurrently with other steps. I've already started this work on my fork (see d-v-b#460, d-v-b#464). For me the big change in 4. is making zarr depend on the new API. I think we only want to do that after zarr depends on zarr-storage (e.g., for the legacy API). What I want to avoid is a holding pattern situation where we have the legacy API defined in two places (e.g., zarr and zarr-storage), and we have to apply patches / bugfixes to two libraries until zarr depends on zarr-storage. That's why I proposed making zarr depend on zarr-storage before making zarr use the new API. But we can definitely develop the new API continuously!

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