Skip to content

abczarr.drivers.zarr_python

The zarr-python backend driver.

This module declares what a given install of zarr-python can read and write, by asking the installed library rather than guessing. The declaration covers both coarse capabilities and the individual codecs, chunk grids, and chunk-key encodings the install actually has, so driver selection reflects the real build. The node adapters wrap a zarr.Array or a zarr.Group as a ZarrArray or a ZarrGroup, so data is read and written through the uniform surface. abczarr.open opens a location through this driver and returns whatever is there.

Classes

ZarrPythonDriver

ZarrPythonDriver()

Bases: Driver

The zarr-python backend, as a driver.

This driver reports what the installed zarr-python can do: its coarse capabilities, and, codec by codec, what its own registry holds. An array is routed to this driver only when it actually provides everything the array needs.

Attributes

name class-attribute instance-attribute
name = 'zarr-python'
available property
available: bool

Methods:

capability
capability(capability: str) -> Support

ZarrPythonNode

ZarrPythonNode(obj: Any)

Bases: ZarrNode

The base class shared by the zarr-python array and group adapters.

Both classes wrap a live zarr-python object, a zarr.Array or a zarr.Group, and share the same metadata, attributes, and version accessors. The only difference between the two is the data surface each one adds on top. The wrapped object is reachable as native.

Attributes

metadata property
metadata: Any
zarr_version property
zarr_version: ZarrVersion

Methods:

capability
capability(name: str) -> Support

ZarrPythonArray

ZarrPythonArray(obj: Any)

Bases: ZarrPythonNode, ZarrArray

A ZarrArray backed by a zarr.Array.

This class wraps an open array so it reads and writes through the uniform surface. The underlying zarr.Array is reachable as native.

Attributes

ndim property
ndim: int
shape property
shape: Shape
dtype property
dtype: DTypeLike
chunks property
chunks: Shape
shards property
shards: Shape | None

Methods:

__getitem__
__getitem__(index: Any) -> ArrayLike
__setitem__
__setitem__(index: Any, value: ArrayLike) -> None
as_async
as_async() -> AsyncZarrArray

The async twin of this array.

A zarr 3 array delegates to zarr-python's own AsyncArray, a native coroutine surface. A zarr 2 array has no such surface, so the synthesized thread-pool twin from the base class is used.

ZarrPythonGroup

ZarrPythonGroup(obj: Any)

Bases: ZarrPythonNode, ZarrGroup

A ZarrGroup backed by a zarr.Group.

Indexing returns a wrapped child array or group. The underlying zarr.Group is reachable as native.

Methods:

keys
keys() -> Iterator[str]
__iter__
__iter__() -> Iterator[str]
__getitem__
__getitem__(key: str) -> ZarrNode
__setitem__
__setitem__(key: str, value: ZarrNode) -> None
__delitem__
__delitem__(key: str) -> None
create_group
create_group(name: str, overwrite: bool = False) -> Self
as_async
as_async() -> AsyncZarrGroup

The async twin of this group.

A zarr 3 group delegates to zarr-python's own AsyncGroup, a native coroutine surface. A zarr 2 group has no such surface, so the synthesized thread-pool twin from the base class is used.

AsyncZarrPythonArray

AsyncZarrPythonArray(sync: ZarrArray)

Bases: AsyncZarrArray

The native async twin of a ZarrPythonArray.

Reads and writes delegate straight to zarr-python's AsyncArray, the real coroutine implementation the synchronous Array itself drives. Its "async" capability reports Support.NATIVE.

Methods:

getitem async
getitem(index: Any) -> ArrayLike
setitem async
setitem(index: Any, value: ArrayLike) -> None

AsyncZarrPythonGroup

AsyncZarrPythonGroup(sync: ZarrGroup)

Bases: AsyncZarrGroup

The native async twin of a ZarrPythonGroup.

Navigation and creation delegate to zarr-python's AsyncGroup. Its "async" capability reports Support.NATIVE. Members it opens come back in the async color.

Methods:

getitem async
getitem(key: str) -> AsyncZarrNode
keys async
keys() -> AsyncIterator[str]
create_group async
create_group(name: str, overwrite: bool = False) -> AsyncZarrPythonGroup