Skip to content
Closed
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
3 changes: 2 additions & 1 deletion src/zarr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from zarr._config import BadConfigError, config
from zarr._version import version as __version__
from zarr.api.synchronous import (
array,
Expand Down Expand Up @@ -27,7 +28,6 @@
zeros_like,
)
from zarr.array import Array, AsyncArray
from zarr.config import config
from zarr.group import AsyncGroup, Group

# in case setuptools scm screw up and find version to be 0.0.0
Expand All @@ -36,6 +36,7 @@
__all__ = [
"__version__",
"config",
"BadConfigError",
"Array",
"AsyncArray",
"Group",
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/config.py → src/zarr/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def reset(self) -> None:

"""
The config module is responsible for managing the configuration of zarr and is based on the Donfig python library.
For selecting custom implementations of codecs, pipelines, buffers and ndbuffers, first register the implementations
For selecting custom implementations of codecs, pipelines, buffers and ndbuffers, first register the implementations
in the registry and then select them in the config.
e.g. an implementation of the bytes codec in a class "NewBytesCodec", requires the value of codecs.bytes.name to be
e.g. an implementation of the bytes codec in a class "NewBytesCodec", requires the value of codecs.bytes.name to be
"NewBytesCodec".
Donfig can be configured programmatically, by environment variables, or from YAML files in standard locations
e.g. export ZARR_CODECS__BYTES__NAME="NewBytesCodec"
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/abc/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import numpy as np

from zarr._config import config
from zarr.abc.metadata import Metadata
from zarr.abc.store import ByteGetter, ByteSetter
from zarr.buffer import Buffer, NDBuffer
from zarr.chunk_grids import ChunkGrid
from zarr.common import ChunkCoords, concurrent_map
from zarr.config import config

if TYPE_CHECKING:
from typing_extensions import Self
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np
import numpy.typing as npt

from zarr._config import config, parse_indexing_order
from zarr.abc.codec import Codec, CodecPipeline
from zarr.abc.store import set_or_delete
from zarr.attributes import Attributes
Expand All @@ -35,7 +36,6 @@
concurrent_map,
product,
)
from zarr.config import config, parse_indexing_order
from zarr.indexing import (
BasicIndexer,
BasicSelection,
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import numpy as np

from zarr._config import config
from zarr.abc.codec import (
ArrayArrayCodec,
ArrayBytesCodec,
Expand All @@ -21,7 +22,6 @@
from zarr.buffer import Buffer, BufferPrototype, NDBuffer
from zarr.chunk_grids import ChunkGrid
from zarr.common import JSON, ChunkCoords, concurrent_map, parse_named_configuration
from zarr.config import config
from zarr.indexing import SelectorTuple, is_scalar, is_total_slice
from zarr.registry import get_codec_class, register_pipeline

Expand Down
2 changes: 1 addition & 1 deletion src/zarr/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import numpy.typing as npt
from typing_extensions import deprecated

from zarr._config import config
from zarr.abc.codec import Codec
from zarr.abc.metadata import Metadata
from zarr.abc.store import set_or_delete
Expand All @@ -26,7 +27,6 @@
ChunkCoords,
ZarrFormat,
)
from zarr.config import config
from zarr.store import StoreLike, StorePath, make_store_path
from zarr.store.core import ensure_no_existing_node
from zarr.sync import SyncMixin, sync
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
import numpy as np
import numpy.typing as npt

from zarr._config import config
from zarr.abc.codec import ArrayArrayCodec, ArrayBytesCodec, BytesBytesCodec, Codec, CodecPipeline
from zarr.abc.metadata import Metadata
from zarr.buffer import Buffer, BufferPrototype, default_buffer_prototype
from zarr.chunk_grids import ChunkGrid, RegularChunkGrid
from zarr.chunk_key_encodings import ChunkKeyEncoding, parse_separator
from zarr.config import config
from zarr.registry import get_codec_class, get_pipeline_class

if TYPE_CHECKING:
from typing_extensions import Self

import numcodecs.abc

from zarr._config import parse_indexing_order
from zarr.array_spec import ArraySpec
from zarr.common import (
JSON,
Expand All @@ -35,7 +36,6 @@
parse_named_configuration,
parse_shapelike,
)
from zarr.config import parse_indexing_order

# For type checking
_bool = bool
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from importlib.metadata import EntryPoint
from importlib.metadata import entry_points as get_entry_points

from zarr.config import BadConfigError, config
from zarr._config import BadConfigError, config

T = TypeVar("T")

Expand All @@ -36,7 +36,7 @@ def register(self, cls: type[T]) -> None:
__ndbuffer_registry: Registry[NDBuffer] = Registry()

"""
The registry module is responsible for managing implementations of codecs, pipelines, buffers and ndbuffers and
The registry module is responsible for managing implementations of codecs, pipelines, buffers and ndbuffers and
collecting them from entrypoints.
The implementation used is determined by the config
"""
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from typing_extensions import ParamSpec

from zarr.config import config
from zarr._config import config

P = ParamSpec("P")
T = TypeVar("T")
Expand Down
2 changes: 1 addition & 1 deletion tests/v3/test_codecs/test_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest

import zarr.v2
from zarr import config
from zarr.abc.codec import Codec
from zarr.abc.store import Store
from zarr.array import Array, AsyncArray
Expand All @@ -18,7 +19,6 @@
TransposeCodec,
)
from zarr.common import MemoryOrder
from zarr.config import config
from zarr.indexing import Selection, morton_order_iter
from zarr.store import StorePath
from zarr.testing.utils import assert_bytes_equal
Expand Down
2 changes: 1 addition & 1 deletion tests/v3/test_codecs/test_transpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import pytest

import zarr.v2
from zarr import config
from zarr.abc.codec import Codec
from zarr.abc.store import Store
from zarr.array import Array, AsyncArray
from zarr.buffer import default_buffer_prototype
from zarr.codecs import BytesCodec, ShardingCodec, TransposeCodec
from zarr.common import MemoryOrder
from zarr.config import config
from zarr.store.core import StorePath

from .test_codecs import _AsyncArrayProxy
Expand Down
2 changes: 1 addition & 1 deletion tests/v3/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import numpy as np
import pytest

from zarr._config import parse_indexing_order
from zarr.common import parse_name, parse_shapelike, product
from zarr.config import parse_indexing_order


@pytest.mark.parametrize("data", [(0, 0, 0, 0), (1, 3, 4, 5, 6), (2, 4)])
Expand Down
3 changes: 1 addition & 2 deletions tests/v3/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
import pytest

import zarr
from zarr import Array, zeros
from zarr import Array, BadConfigError, config, zeros
from zarr.abc.codec import CodecInput, CodecOutput, CodecPipeline
from zarr.abc.store import ByteSetter
from zarr.array_spec import ArraySpec
from zarr.buffer import NDBuffer
from zarr.codecs import BatchedCodecPipeline, BloscCodec, BytesCodec, Crc32cCodec, ShardingCodec
from zarr.config import BadConfigError, config
from zarr.indexing import SelectorTuple
from zarr.registry import (
fully_qualified_name,
Expand Down