From 0a01a52ce4699cc059875e86c0989ab6470cd59a Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Fri, 20 Dec 2024 19:48:07 +0100 Subject: [PATCH] revert changes to config.py --- src/zarr/core/config.py | 56 ++++++++--------------------------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/src/zarr/core/config.py b/src/zarr/core/config.py index a14305aef8..29f5e139fe 100644 --- a/src/zarr/core/config.py +++ b/src/zarr/core/config.py @@ -1,32 +1,3 @@ -""" -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 -in the registry and then select them in the config. - -Example: - An implementation of the bytes codec in a class ``your.module.NewBytesCodec`` requires the value of ``codecs.bytes`` - to be ``your.module.NewBytesCodec``. Donfig can be configured programmatically, by environment variables, or from - YAML files in standard locations. - - .. code-block:: python - - from your.module import NewBytesCodec - from zarr.core.config import register_codec, config - - register_codec("bytes", NewBytesCodec) - config.set({"codecs.bytes": "your.module.NewBytesCodec"}) - - Instead of setting the value programmatically with ``config.set``, you can also set the value with an environment - variable. The environment variable ``ZARR_CODECS__BYTES`` can be set to ``your.module.NewBytesCodec``. The double - underscore ``__`` is used to indicate nested access. - - .. code-block:: bash - - export ZARR_CODECS__BYTES="your.module.NewBytesCodec" - -For more information, see the Donfig documentation at https://github.com/pytroll/donfig. -""" - from __future__ import annotations from typing import Any, Literal, cast @@ -39,7 +10,7 @@ class BadConfigError(ValueError): class Config(DConfig): # type: ignore[misc] - """The Config will collect configuration from config files and environment variables + """Will collect configuration from config files and environment variables Example environment variables: Grabs environment variables of the form "ZARR_FOO__BAR_BAZ=123" and @@ -57,26 +28,21 @@ def reset(self) -> None: self.refresh() -# The default configuration for zarr +# 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 +# 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 +# "NewBytesCodec". +# Donfig can be configured programmatically, by environment variables, or from YAML files in standard locations +# e.g. export ZARR_CODECS__BYTES__NAME="NewBytesCodec" +# (for more information see github.com/pytroll/donfig) +# Default values below point to the standard implementations of zarr-python config = Config( "zarr", defaults=[ { "default_zarr_version": 3, - "array": { - "order": "C", - "write_empty_chunks": False, - "v2_default_compressor": { - "numeric": "zstd", - "string": "vlen-utf8", - "bytes": "vlen-bytes", - }, - "v3_default_codecs": { - "numeric": ["bytes", "zstd"], - "string": ["vlen-utf8"], - "bytes": ["vlen-bytes"], - }, - }, + "array": {"order": "C"}, "async": {"concurrency": 10, "timeout": None}, "threading": {"max_workers": None}, "json_indent": 2,