Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up zarr.core.metadata API #2642

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)
from zarr.core.group import AsyncGroup, ConsolidatedMetadata, GroupMetadata
from zarr.core.metadata import ArrayMetadataDict, ArrayV2Metadata, ArrayV3Metadata
from zarr.core.metadata.v2 import _default_compressor, _default_filters
from zarr.core.metadata._v2 import _default_compressor, _default_filters
from zarr.errors import NodeTypeValidationError
from zarr.storage import (
StoreLike,
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
get_indexer,
morton_order_iter,
)
from zarr.core.metadata.v3 import parse_codecs
from zarr.core.metadata._v3 import parse_codecs
from zarr.registry import get_ndbuffer_class, get_pipeline_class, register_codec

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/core/_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from zarr.abc.codec import Codec
from zarr.core.common import ZarrFormat
from zarr.core.metadata.v3 import DataType
from zarr.core.metadata import DataType


@dataclasses.dataclass(kw_only=True)
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@
ArrayV3MetadataDict,
T_ArrayMetadata,
)
from zarr.core.metadata.v2 import (
from zarr.core.metadata._v2 import (
_default_compressor,
_default_filters,
parse_compressor,
parse_filters,
)
from zarr.core.metadata.v3 import DataType, parse_node_type_array
from zarr.core.metadata._v3 import DataType, parse_node_type_array
from zarr.core.sync import sync
from zarr.errors import MetadataValidationError
from zarr.registry import (
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/core/codec_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from zarr.core.common import ChunkCoords, concurrent_map
from zarr.core.config import config
from zarr.core.indexing import SelectorTuple, is_scalar, is_total_slice
from zarr.core.metadata.v2 import _default_fill_value
from zarr.core.metadata._v2 import _default_fill_value
from zarr.registry import register_pipeline

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/core/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
)
from zarr.core.config import config
from zarr.core.metadata import ArrayV2Metadata, ArrayV3Metadata
from zarr.core.metadata.v3 import V3JsonEncoder
from zarr.core.metadata._v3 import V3JsonEncoder
from zarr.core.sync import SyncMixin, sync
from zarr.errors import MetadataValidationError
from zarr.storage import StoreLike, StorePath, make_store_path
Expand Down
5 changes: 3 additions & 2 deletions src/zarr/core/metadata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import TypeAlias, TypeVar

from .v2 import ArrayV2Metadata, ArrayV2MetadataDict
from .v3 import ArrayV3Metadata, ArrayV3MetadataDict
from ._v2 import ArrayV2Metadata, ArrayV2MetadataDict
from ._v3 import ArrayV3Metadata, ArrayV3MetadataDict, DataType

ArrayMetadata: TypeAlias = ArrayV2Metadata | ArrayV3Metadata
ArrayMetadataDict: TypeAlias = ArrayV2MetadataDict | ArrayV3MetadataDict
Expand All @@ -14,4 +14,5 @@
"ArrayV2MetadataDict",
"ArrayV3Metadata",
"ArrayV3MetadataDict",
"DataType",
]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from zarr.core.chunk_key_encodings import parse_separator
from zarr.core.common import JSON, ZARRAY_JSON, ZATTRS_JSON, MemoryOrder, parse_shapelike
from zarr.core.config import config, parse_indexing_order
from zarr.core.metadata.common import parse_attributes
from zarr.core.metadata._common import parse_attributes


class ArrayV2MetadataDict(TypedDict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
parse_shapelike,
)
from zarr.core.config import config
from zarr.core.metadata.common import parse_attributes
from zarr.core.metadata._common import parse_attributes
from zarr.core.strings import _NUMPY_SUPPORTS_VLEN_STRING
from zarr.core.strings import _STRING_DTYPE as STRING_NP_DTYPE
from zarr.errors import MetadataValidationError, NodeTypeValidationError
Expand Down
2 changes: 1 addition & 1 deletion tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from zarr.core.common import JSON, MemoryOrder, ZarrFormat
from zarr.core.group import AsyncGroup
from zarr.core.indexing import ceildiv
from zarr.core.metadata.v3 import DataType
from zarr.core.metadata import DataType
from zarr.core.sync import sync
from zarr.errors import ContainsArrayError, ContainsGroupError
from zarr.storage import LocalStore, MemoryStore, StorePath
Expand Down
2 changes: 1 addition & 1 deletion tests/test_codecs/test_vlen.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from zarr.abc.codec import Codec
from zarr.abc.store import Store
from zarr.codecs import ZstdCodec
from zarr.core.metadata.v3 import ArrayV3Metadata, DataType
from zarr.core.metadata import ArrayV3Metadata, DataType
from zarr.core.strings import _NUMPY_SUPPORTS_VLEN_STRING
from zarr.storage import StorePath

Expand Down
3 changes: 1 addition & 2 deletions tests/test_metadata/test_consolidated.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
)
from zarr.core.buffer import default_buffer_prototype
from zarr.core.group import ConsolidatedMetadata, GroupMetadata
from zarr.core.metadata import ArrayV3Metadata
from zarr.core.metadata.v2 import ArrayV2Metadata
from zarr.core.metadata import ArrayV2Metadata, ArrayV3Metadata
from zarr.storage import StorePath

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metadata/test_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from zarr.core.buffer import cpu
from zarr.core.group import ConsolidatedMetadata, GroupMetadata
from zarr.core.metadata import ArrayV2Metadata
from zarr.core.metadata.v2 import parse_zarr_format
from zarr.core.metadata._v2 import parse_zarr_format

if TYPE_CHECKING:
from typing import Any
Expand Down
6 changes: 4 additions & 2 deletions tests/test_metadata/test_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
from zarr.core.buffer import default_buffer_prototype
from zarr.core.chunk_key_encodings import DefaultChunkKeyEncoding, V2ChunkKeyEncoding
from zarr.core.group import parse_node_type
from zarr.core.metadata.v3 import (
from zarr.core.metadata import (
ArrayV3Metadata,
DataType,
)
from zarr.core.metadata._v3 import (
default_fill_value,
parse_dimension_names,
parse_fill_value,
Expand All @@ -29,7 +31,7 @@
from zarr.core.common import JSON


from zarr.core.metadata.v3 import (
from zarr.core.metadata._v3 import (
parse_node_type_array,
)

Expand Down
Loading