Skip to content

filename handling of zarr stores #2141

@ilan-gold

Description

@ilan-gold

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of anndata.
  • (optional) I have confirmed this bug exists on the main branch of anndata.

Report

Zarr stores have no consistent place for a root file handle and there are errors for in-memory stores when trying to access the "root path" (whatever that means)

Code:

import zarr
from anndata._core.file_backing import filename

filename(zarr.group("foo.zarr"))

Traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 4
      1 import zarr
      2 from anndata._core.file_backing import filename
----> 4 filename(zarr.group("foo.zarr"))

File ~/miniconda3/lib/python3.12/functools.py:909, in singledispatch.<locals>.wrapper(*args, **kw)
    905 if not args:
    906     raise TypeError(f'{funcname} requires at least '
    907                     '1 positional argument')
--> 909 return dispatch(args[0].__class__)(*args, **kw)

File ~/Projects/Theis/anndata/src/anndata/_core/file_backing.py:186, in _(x)
    183 @filename.register(ZarrArray)
    184 @filename.register(ZarrGroup)
    185 def _(x):
--> 186     return x.store.path

AttributeError: 'LocalStore' object has no attribute 'path'

xref: zarr-developers/zarr-python#2266

Versions

zarr    3.1.3
anndata 0.13.0.dev41+g7883222dc
----    ----
PyYAML  6.0.3
parso   0.8.4
MarkupSafe      3.0.3
zstandard       0.25.0
asttokens       3.0.0
typing_extensions       4.15.0
Jinja2  3.1.6
xarray  2025.9.1
sphinxcontrib-htmlhelp  2.1.0
decorator       5.2.1
ipython 9.1.0
six     1.17.0
cloudpickle     3.1.1
tblib   3.1.0
wcwidth 0.2.13
psutil  7.1.0
setuptools      80.9.0
jedi    0.19.2
fast-array-utils        1.2.3
stack-data      0.6.3
sphinxcontrib-serializinghtml   2.0.0
pytz    2025.2
fsspec  2025.9.0
traitlets       5.14.3
packaging       25.0
scanpy  1.11.4
dask    2025.9.1
charset-normalizer      3.4.3
sphinxcontrib-devhelp   2.0.0
numcodecs       0.16.3
sphinxcontrib-qthelp    2.0.0
donfig  0.8.1.post1
python-dateutil 2.9.0.post0
pyarrow 20.0.0
toolz   1.0.0
threadpoolctl   3.6.0
numpy   2.3.3
scipy   1.16.2
pure_eval       0.2.3
legacy-api-wrap 1.4.1
Pygments        2.19.2
awkward 2.8.9
pandas  2.3.3
crc32c  2.7.1
Cython  3.1.3
h5py    3.14.0
natsort 8.4.0
msgpack 1.1.1
executing       2.2.0
prompt_toolkit  3.0.51
session-info2   0.2.2
sphinxcontrib-jsmath    1.0.1
sphinx-jinja2-compat    0.3.0
awkward_cpp     50
sphinxcontrib-applehelp 2.0.0
----    ----
Python  3.12.3 | packaged by Anaconda, Inc. | (main, May  6 2024, 14:46:42) [Clang 14.0.6 ]
OS      macOS-15.1-arm64-arm-64bit
Updated 2025-10-01 15:48

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions