zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

V3 array creation dtype parameter

Open rabernat opened this issue 1 year ago • 1 comments

In V2, an array can be created with no dtype. The default dtype is f8: https://zarr.readthedocs.io/en/stable/api/creation.html#zarr.creation.create

In V3, dtype is mandatory.

import zarr
arr = zarr.Array.create(store=zarr.store.MemoryStore(), shape=(10,), chunks=(5,))
# -> TypeError: Array.create() missing 1 required keyword-only argument: 'dtype'

I think we should consider bringing back the default for backwards compatibility.

rabernat avatar May 29 '24 01:05 rabernat

I can handle this in #1884 where we will be handling most of the API compatibility for creation.

jhamman avatar May 29 '24 02:05 jhamman

This is working now:

In [1]: import zarr

In [2]: zarr.__version__
Out[2]: '3.0.0a4'

In [3]: a = zarr.create(shape=(10, ))

In [4]: a.dtype
Out[4]: dtype('float64')

jhamman avatar Sep 13 '24 23:09 jhamman