From f71d6fb65ae5250aba7a10059cc76f1b2aca5d17 Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 14 Aug 2024 17:50:50 +0200 Subject: [PATCH 1/3] mv BatchedCodecPipeline to zarr.core --- src/zarr/codecs/__init__.py | 2 -- src/zarr/codecs/registry.py | 0 src/zarr/{codecs/pipeline.py => core/codec_pipeline.py} | 0 src/zarr/core/config.py | 2 +- tests/v3/test_config.py | 3 ++- 5 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 src/zarr/codecs/registry.py rename src/zarr/{codecs/pipeline.py => core/codec_pipeline.py} (100%) diff --git a/src/zarr/codecs/__init__.py b/src/zarr/codecs/__init__.py index 9394284319..5197bfc004 100644 --- a/src/zarr/codecs/__init__.py +++ b/src/zarr/codecs/__init__.py @@ -4,13 +4,11 @@ from zarr.codecs.bytes import BytesCodec, Endian from zarr.codecs.crc32c_ import Crc32cCodec from zarr.codecs.gzip import GzipCodec -from zarr.codecs.pipeline import BatchedCodecPipeline from zarr.codecs.sharding import ShardingCodec, ShardingCodecIndexLocation from zarr.codecs.transpose import TransposeCodec from zarr.codecs.zstd import ZstdCodec __all__ = [ - "BatchedCodecPipeline", "BloscCname", "BloscCodec", "BloscShuffle", diff --git a/src/zarr/codecs/registry.py b/src/zarr/codecs/registry.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/zarr/codecs/pipeline.py b/src/zarr/core/codec_pipeline.py similarity index 100% rename from src/zarr/codecs/pipeline.py rename to src/zarr/core/codec_pipeline.py diff --git a/src/zarr/core/config.py b/src/zarr/core/config.py index 67f5c74347..8e89ecf6d3 100644 --- a/src/zarr/core/config.py +++ b/src/zarr/core/config.py @@ -47,7 +47,7 @@ def reset(self) -> None: "async": {"concurrency": None, "timeout": None}, "json_indent": 2, "codec_pipeline": { - "path": "zarr.codecs.pipeline.BatchedCodecPipeline", + "path": "zarr.core.codec_pipeline.BatchedCodecPipeline", "batch_size": 1, }, "codecs": { diff --git a/tests/v3/test_config.py b/tests/v3/test_config.py index 881833797c..570b930058 100644 --- a/tests/v3/test_config.py +++ b/tests/v3/test_config.py @@ -11,9 +11,10 @@ from zarr import Array, zeros from zarr.abc.codec import CodecInput, CodecOutput, CodecPipeline from zarr.abc.store import ByteSetter -from zarr.codecs import BatchedCodecPipeline, BloscCodec, BytesCodec, Crc32cCodec, ShardingCodec +from zarr.codecs import BloscCodec, BytesCodec, Crc32cCodec, ShardingCodec from zarr.core.array_spec import ArraySpec from zarr.core.buffer import NDBuffer +from zarr.core.codec_pipeline import BatchedCodecPipeline from zarr.core.config import BadConfigError, config from zarr.core.indexing import SelectorTuple from zarr.registry import ( From 0087795948a6039c9accaaf92f23f695db3b29ce Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 14 Aug 2024 17:59:17 +0200 Subject: [PATCH 2/3] fix for tests --- tests/v3/test_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/v3/test_config.py b/tests/v3/test_config.py index 570b930058..76823cf311 100644 --- a/tests/v3/test_config.py +++ b/tests/v3/test_config.py @@ -44,7 +44,7 @@ def test_config_defaults_set() -> None: "async": {"concurrency": None, "timeout": None}, "json_indent": 2, "codec_pipeline": { - "path": "zarr.codecs.pipeline.BatchedCodecPipeline", + "path": "zarr.core.codec_pipeline.BatchedCodecPipeline", "batch_size": 1, }, "buffer": "zarr.core.buffer.Buffer", @@ -92,8 +92,8 @@ def test_config_codec_pipeline_class(store): # has default value assert get_pipeline_class().__name__ != "" - config.set({"codec_pipeline.name": "zarr.codecs.pipeline.BatchedCodecPipeline"}) - assert get_pipeline_class() == zarr.codecs.pipeline.BatchedCodecPipeline + config.set({"codec_pipeline.name": "zarr.core.codec_pipeline.BatchedCodecPipeline"}) + assert get_pipeline_class() == zarr.core.codec_pipeline.BatchedCodecPipeline _mock = Mock() From bce876762816ec1cf70152398b6edc9ed6765069 Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 14 Aug 2024 19:41:48 +0200 Subject: [PATCH 3/3] import codec_pipeline and buffer in zarr.core.__init__ --- src/zarr/core/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zarr/core/__init__.py b/src/zarr/core/__init__.py index e69de29bb2..cbacfe3422 100644 --- a/src/zarr/core/__init__.py +++ b/src/zarr/core/__init__.py @@ -0,0 +1,4 @@ +from __future__ import annotations + +from zarr.core.buffer import Buffer, NDBuffer # noqa: F401 +from zarr.core.codec_pipeline import BatchedCodecPipeline # noqa: F401