diff --git a/pyproject.toml b/pyproject.toml index 911f184..0d9721a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ dynamic = ["version"] dependencies = [ # Type-only package providing Zarr v3 metadata TypedDicts/Literals used in # the `.pyi` stubs (data-type names, codec configs, array metadata). - "zarr-metadata>=0.3", + "zarr-metadata>=0.4", ] [tool.maturin] diff --git a/python/zarrista/_array.pyi b/python/zarrista/_array.pyi index 8095692..a99ae85 100644 --- a/python/zarrista/_array.pyi +++ b/python/zarrista/_array.pyi @@ -2,7 +2,7 @@ from collections.abc import Buffer from types import EllipsisType from typing import TypeAlias, Unpack -from zarr_metadata import ArrayMetadataV3, JSONValue +from zarr_metadata import JSONValue, ZarrV3ArrayMetadataJSON from zarrista.codec import ( ArrayToArrayCodec, @@ -37,7 +37,7 @@ class Array: """Open the array stored at `path` in `store`.""" @staticmethod def from_metadata( - metadata: ArrayMetadataV3, + metadata: ZarrV3ArrayMetadataJSON, store: FilesystemStore | MemoryStore, path: str = "/", ) -> Array: @@ -96,7 +96,7 @@ class Array: def fill_value(self) -> FillValue: """The array's fill value.""" @property - def metadata(self) -> ArrayMetadataV3: + def metadata(self) -> ZarrV3ArrayMetadataJSON: """The array's full Zarr v3 metadata.""" @property def ndim(self) -> int: @@ -267,7 +267,7 @@ class AsyncArray: """ @staticmethod def from_metadata( - metadata: ArrayMetadataV3, + metadata: ZarrV3ArrayMetadataJSON, store: AsyncStore, path: str = "/", ) -> AsyncArray: @@ -327,7 +327,7 @@ class AsyncArray: def fill_value(self) -> FillValue: """The array's fill value.""" @property - def metadata(self) -> ArrayMetadataV3: + def metadata(self) -> ZarrV3ArrayMetadataJSON: """The array's full Zarr v3 metadata.""" @property def ndim(self) -> int: diff --git a/python/zarrista/_builder.pyi b/python/zarrista/_builder.pyi index e23f181..6c05342 100644 --- a/python/zarrista/_builder.pyi +++ b/python/zarrista/_builder.pyi @@ -1,6 +1,6 @@ from collections.abc import Mapping, Sequence -from zarr_metadata import ArrayMetadataV3, JSONValue +from zarr_metadata import JSONValue, ZarrV3ArrayMetadataJSON from zarrista.codec import ( ArrayToArrayCodec, @@ -93,7 +93,7 @@ class ArrayBuilder: [`ArrayBuilder.create_metadata`][zarrista.ArrayBuilder.create_metadata] to build metadata without touching a store. """ - def create_metadata(self) -> ArrayMetadataV3: + def create_metadata(self) -> ZarrV3ArrayMetadataJSON: """Build the array's Zarr v3 metadata without touching a store. Nothing is written. Pass the result to diff --git a/python/zarrista/_chunk_key_encoding.pyi b/python/zarrista/_chunk_key_encoding.pyi index 837f41d..03efbc1 100644 --- a/python/zarrista/_chunk_key_encoding.pyi +++ b/python/zarrista/_chunk_key_encoding.pyi @@ -1,6 +1,6 @@ from typing import Literal -from zarr_metadata import NamedConfigV3 +from zarr_metadata import ZarrV3NamedConfigJSON class ChunkKeyEncoding: """How an array maps chunk grid indices to store keys.""" @@ -9,10 +9,10 @@ class ChunkKeyEncoding: def default(sep: Literal[".", "/"]) -> ChunkKeyEncoding: """Construct the `default` chunk key encoding with the given separator.""" @staticmethod - def from_metadata(metadata: NamedConfigV3) -> ChunkKeyEncoding: + def from_metadata(metadata: ZarrV3NamedConfigJSON) -> ChunkKeyEncoding: """Build a chunk key encoding from its Zarr v3 metadata.""" @property - def metadata(self) -> NamedConfigV3: + def metadata(self) -> ZarrV3NamedConfigJSON: """The chunk key encoding's Zarr v3 metadata.""" @property def name(self) -> str | None: diff --git a/python/zarrista/_chunks.pyi b/python/zarrista/_chunks.pyi index 022be56..aa188d8 100644 --- a/python/zarrista/_chunks.pyi +++ b/python/zarrista/_chunks.pyi @@ -1,7 +1,7 @@ from collections.abc import Sequence from typing import TypeAlias -from zarr_metadata import NamedConfigV3 +from zarr_metadata import ZarrV3NamedConfigJSON _RunLength: TypeAlias = int | tuple[int, int] """One run of a rectilinear chunk edge: a single chunk size, or a @@ -33,10 +33,13 @@ class ChunkGrid: Experimental and may be incompatible with other Zarr V3 implementations. """ @staticmethod - def from_metadata(metadata: NamedConfigV3, shape: Sequence[int]) -> ChunkGrid: + def from_metadata( + metadata: ZarrV3NamedConfigJSON, + shape: Sequence[int], + ) -> ChunkGrid: """Build a chunk grid from its Zarr v3 metadata and the array shape.""" @property - def metadata(self) -> NamedConfigV3: + def metadata(self) -> ZarrV3NamedConfigJSON: """The chunk grid's Zarr v3 metadata.""" @property def ndim(self) -> int: diff --git a/python/zarrista/_dtype.pyi b/python/zarrista/_dtype.pyi index dabe20e..b4d7cc8 100644 --- a/python/zarrista/_dtype.pyi +++ b/python/zarrista/_dtype.pyi @@ -1,6 +1,6 @@ from typing import TypeAlias -from zarr_metadata import NamedConfigV3 +from zarr_metadata import ZarrV3NamedConfigJSON from zarr_metadata.v3.data_type import ( BoolDataTypeName, BytesDataTypeName, @@ -50,7 +50,7 @@ class DataType: """A Zarr v3 data type.""" @staticmethod - def from_metadata(metadata: NamedConfigV3) -> DataType: + def from_metadata(metadata: ZarrV3NamedConfigJSON) -> DataType: """Construct a data type from its Zarr v3 metadata.""" @staticmethod def from_string(name: DataTypeName | str) -> DataType: diff --git a/python/zarrista/_group.pyi b/python/zarrista/_group.pyi index b6b7a4f..decbe16 100644 --- a/python/zarrista/_group.pyi +++ b/python/zarrista/_group.pyi @@ -1,4 +1,8 @@ -from zarr_metadata import ConsolidatedMetadataV3, GroupMetadataV3, JSONValue +from zarr_metadata import ( + JSONValue, + ZarrV3ConsolidatedMetadataJSON, + ZarrV3GroupMetadataJSON, +) from ._array import Array, AsyncArray from ._store import AsyncStore, FilesystemStore, MemoryStore @@ -13,10 +17,10 @@ class Group: def attrs(self) -> dict[str, JSONValue]: """The group's user attributes as a dict.""" @property - def metadata(self) -> GroupMetadataV3: + def metadata(self) -> ZarrV3GroupMetadataJSON: """The group's full Zarr v3 metadata.""" @property - def consolidated_metadata(self) -> ConsolidatedMetadataV3 | None: + def consolidated_metadata(self) -> ZarrV3ConsolidatedMetadataJSON | None: """The consolidated metadata, if present in the group metadata.""" @property def path(self) -> str: @@ -62,10 +66,10 @@ class AsyncGroup: def attrs(self) -> dict[str, JSONValue]: """The group's user attributes as a dict.""" @property - def metadata(self) -> GroupMetadataV3: + def metadata(self) -> ZarrV3GroupMetadataJSON: """The group's full Zarr v3 metadata.""" @property - def consolidated_metadata(self) -> ConsolidatedMetadataV3 | None: + def consolidated_metadata(self) -> ZarrV3ConsolidatedMetadataJSON | None: """The consolidated metadata, if present in the group metadata.""" @property def path(self) -> str: diff --git a/tests/array/test_array.py b/tests/array/test_array.py index 5ff0066..7263096 100644 --- a/tests/array/test_array.py +++ b/tests/array/test_array.py @@ -4,7 +4,7 @@ from zarrista.store import MemoryStore if TYPE_CHECKING: - from zarr_metadata import ArrayMetadataV3 + from zarr_metadata import ZarrV3ArrayMetadataJSON def test_array_from_metadata() -> None: @@ -13,7 +13,7 @@ def test_array_from_metadata() -> None: """ store = MemoryStore() - meta: ArrayMetadataV3 = { + meta: ZarrV3ArrayMetadataJSON = { "zarr_format": 3, "attributes": {}, "chunk_grid": {"name": "regular", "configuration": {"chunk_shape": (2, 2)}}, diff --git a/tests/array/test_store_metadata.py b/tests/array/test_store_metadata.py index e45aa49..93a6de5 100644 --- a/tests/array/test_store_metadata.py +++ b/tests/array/test_store_metadata.py @@ -11,10 +11,10 @@ from zarrista.store import FilesystemStore, MemoryStore if TYPE_CHECKING: - from zarr_metadata import ArrayMetadataV3 + from zarr_metadata import ZarrV3ArrayMetadataJSON -def _metadata(data_type: str = "int16") -> "ArrayMetadataV3": +def _metadata(data_type: str = "int16") -> "ZarrV3ArrayMetadataJSON": return { "zarr_format": 3, "attributes": {}, diff --git a/uv.lock b/uv.lock index 637ca00..e659ac3 100644 --- a/uv.lock +++ b/uv.lock @@ -2069,11 +2069,11 @@ wheels = [ [[package]] name = "typing-extensions" -version = "4.15.0" +version = "4.16.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" }, + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, ] [[package]] @@ -2220,14 +2220,14 @@ wheels = [ [[package]] name = "zarr-metadata" -version = "0.3.0" +version = "0.4.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f2/9c/cfd5aa02a27c63ecec702a77834b395411518da5c748414d7e6a323638ed/zarr_metadata-0.3.0.tar.gz", hash = "sha256:d8fe02feef43380056ea0429ceb50974b7b5afe6f0386853977506b034e89d53", size = 36398, upload-time = "2026-06-19T13:17:38.276Z" } +sdist = { url = "https://files.pythonhosted.org/packages/04/76/ca9334554b9a875c2c68203e2ce8b0a3febe1c3e9efba00a57e9a12c4e40/zarr_metadata-0.4.0.tar.gz", hash = "sha256:56788af0b86ec653176410fd57e0f4815331ac61d61e562dfd020198e98ce3eb", size = 149567, upload-time = "2026-07-29T20:20:38.513Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/91/96/64137930fb40b96b4d207eb1f1e4e42c5d6c9e682a5a7c3e6feff6eb0e29/zarr_metadata-0.3.0-py3-none-any.whl", hash = "sha256:e6651f418fcc89cc3c6fc11aa852fb6f8dd6f31d62913abc0d4d37ce7302d671", size = 45636, upload-time = "2026-06-19T13:17:37.097Z" }, + { url = "https://files.pythonhosted.org/packages/cb/8b/f8594d9160f0eaae3f988eb2969bafc9db96bf3e224b8199b1bb80fa1f7a/zarr_metadata-0.4.0-py3-none-any.whl", hash = "sha256:642106291b881284d08222973d0970dd950d254b2286f36fcc269b0b1a1f4be2", size = 69750, upload-time = "2026-07-29T20:20:37.059Z" }, ] [[package]] @@ -2267,7 +2267,7 @@ pyodide = [ ] [package.metadata] -requires-dist = [{ name = "zarr-metadata", specifier = ">=0.3" }] +requires-dist = [{ name = "zarr-metadata", specifier = ">=0.4" }] [package.metadata.requires-dev] dev = [