Skip to content

Divergent behavior of memory store and localstore list prefix #3773

@ianhi

Description

@ianhi

Zarr version

main

Numcodecs version

main

Python Version

3.11

Operating System

Mac

Installation

uv

Description

Memory Store and Fsspec file system store return different results for list_prefix I think that the localstore matches what I would expect

Steps to reproduce

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
#

import asyncio

import zarr

zarr.print_debug_info()


async def list_prefix(store, prefix):
    return sorted([k async for k in store.list_prefix(prefix)])


def run(store):
    root = zarr.open_group(store, mode="w")
    root.create_group("0")
    root.create_array("0_c", shape=(1,), dtype="i4")
    print(asyncio.run(list_prefix(store, "0")))


print("LocalStore:")
run(zarr.storage.LocalStore(root="/tmp/zarr_repro"))

print("MemoryStore:")
run(zarr.storage.MemoryStore())

Additional output

LocalStore:
['0/zarr.json']
MemoryStore:
['0/zarr.json', '0_c/zarr.json']
platform: macOS-15.7.4-arm64-arm-64bit-Mach-O
python: 3.13.9
zarr: 3.1.6.dev62+ga02d99616

**Required dependencies:**
packaging: 26.0
numpy: 2.4.3
numcodecs: 0.16.5
typing_extensions: 4.15.0
donfig: 0.8.1.post1

**Optional dependencies:**
numcodecs: 0.16.5

**Not Installed:**
botocore
cupy-cuda12x
fsspec
s3fs
gcsfs
universal-pathlib
rich
obstore

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions