Skip to content

Epic: Refactoring read_zarr #1345

Backlog
Backlog

Description

@ajkswamy
AI use transparency
  • The analysis and plan were drafted with Claude (Anthropic's Claude Opus 5.5): reading the current
    code, the specification, earlier pull requests on remote and zip support, and how anndata
    structures its reading code. This description was drafted with Claude as well.
  • I reviewed the plan and decided the scope and order.

Goal

Restructure the code that reads a SpatialData store from disk (read_zarr) so that it is easier to
read, maintain and extend, without changing what it does. This issue tracks the series; the work
happens in the smaller PRs listed below.

Why

Reading a store is currently one large function. Several features that people want (reading from
the cloud, reading zipped stores, loading tables lazily) and possible future changes to the store
layout all have to change that same function. Earlier attempts at remote and zip support (for
example #1087, #1107, #1141) each had to touch every reader, and several got stuck partly because of
that.

Approach

  • No behaviour change. Every PR keeps all existing tests passing. Anything that would change
    behaviour gets its own PR and gets presented to maintainers
  • Small steps, each reviewable on its own.
  • Safety net first: PR 1 in the plan below adds datasets written by older releases, so we notice if a step breaks
    reading old files.
  • Separate concerns, so each future feature touches one well-defined place:
    • opening the store (local, remote, zipped)
    • knowing where elements are in the store
    • deciding what kind of element something is
    • reading one element

Plan

  • 1. Safety net: reference stores written by older releases, and tests (#<PR 1>)
  • 2. Readers take an opened group instead of a file path
  • 3. Open the store in one place
  • 4. A table of readers by element type and version
  • 5. Describe the store layout in one place, per format version
  • 6. Make read_zarr itself short: it only connects the steps above
  • 7. Use the same layout description when writing and listing elements

Outlook

The series doesn't add these features, but it makes them easier to add later:

Activity

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