Skip to content

read_lazy kwarg for not using dask #2147

Open

Description

@ilan-gold

Please describe your wishes and possible alternatives to achieve the desired result.

I think that every datastructure that can be opened as dask can also be opened as not-dask like sparse has https://anndata.readthedocs.io/en/stable/generated/anndata.io.sparse_dataset.html and even categoricals within xarray have https://anndata.readthedocs.io/en/stable/generated/anndata.experimental.backed.CategoricalArray.html.

Sometimes, there is a use-case where the lazy-compute feature of dask is not necessary, and thus lazy-loading can be done without the overhead of dask.

I would propose updating read_lazy to have use_dask kwarg that uses dask in all instances where possible. The main change here to default behavior (i.e., True) would be that categoricals and nullables within Dataset2D would be dask arrays by default.

Other than that I would expect no change to defaults since even things like dense arrays are opened with dask instead of the zarr.Array or h5py.Dataset

Activity

  1. changed the title [-]`read_lazy` option for no-dask[/-] [+]`read_lazy` kwarg for not using dask[/+] on Oct 9, 2025
  2. added this to the 0.13.0 milestone on Oct 9, 2025
  3. flying-sheep commented on Oct 13, 2025

    @flying-sheep
    Member

    and arrays would be raw zarr.Arrays/h5py.Datasets?

  4. github-actions commented on Jan 2, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity.
    Please add a comment if you want to keep the issue open. Thank you for your contributions!

  5. hanslovp-gne commented on Feb 9, 2026

    @hanslovp-gne

    I would love to see something along those lines. I would like to avoid going through dask, if possible.

  6. ilan-gold commented on Feb 9, 2026

    @ilan-gold
    ContributorAuthor

    It's very near on my to-do list. I can write something up if you want to take a shot (or PRs without guidance always welcome and encouraged!), but I think it would basically just boil down to having a new IORegistry, writing out the new types, passing through the arg, and handling edge cases.

  7. hanslovp-gne commented on Feb 9, 2026

    @hanslovp-gne

    Cool, thank you! We are looking into replacing our bespoke internal data representation with standardized AnnData. Lazy zarr is a game changer for that purpose. Thank you for the pointer. I will see what I can do (this is my first time looking at the AnnData souce code).

  8. ilan-gold commented on Feb 12, 2026

    @ilan-gold
    ContributorAuthor

    @hanslovp-gne I will be out for a week starting Monday and I won't work on this tomorrow so you're free to go for a week! In this comment in 1707 I noted a pitfall. Setting is CoW which means the whole object is read into memory as soon as you do something like my_backed_object[subset].layer["foo"] = value. I think this behavior is ok actually for a first pass, but it's just something to be aware of. The other open question is whether we'd want to trigger the AnnData.isbacked with this feature. Not sure.

    cc @ivirshup since we just discussed this

  9. modified the milestones: 0.13.0, 0.14.0 on Jul 8, 2026
  10. flying-sheep commented on Oct 13, 2026

    @flying-sheep
    Member
  11. ArneDefauw commented on Oct 14, 2026

    @ArneDefauw

    21. Example: https://harpy.readthedocs.io/en/stable/generated/harpy.io.read_zarr.html
    They have a table_mode="backed" option
    cc @ArneDefauw, wanna do a PR?

    Happy to do a PR! I have a few things to wrap up first, but I should be able to put one together next week.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions