1- """
2- The config module is responsible for managing the configuration of zarr and is based on the Donfig python library.
3- For selecting custom implementations of codecs, pipelines, buffers and ndbuffers, first register the implementations
4- in the registry and then select them in the config.
5-
6- Example:
7- An implementation of the bytes codec in a class ``your.module.NewBytesCodec`` requires the value of ``codecs.bytes``
8- to be ``your.module.NewBytesCodec``. Donfig can be configured programmatically, by environment variables, or from
9- YAML files in standard locations.
10-
11- .. code-block:: python
12-
13- from your.module import NewBytesCodec
14- from zarr.core.config import register_codec, config
15-
16- register_codec("bytes", NewBytesCodec)
17- config.set({"codecs.bytes": "your.module.NewBytesCodec"})
18-
19- Instead of setting the value programmatically with ``config.set``, you can also set the value with an environment
20- variable. The environment variable ``ZARR_CODECS__BYTES`` can be set to ``your.module.NewBytesCodec``. The double
21- underscore ``__`` is used to indicate nested access.
22-
23- .. code-block:: bash
24-
25- export ZARR_CODECS__BYTES="your.module.NewBytesCodec"
26-
27- For more information, see the Donfig documentation at https://github.com/pytroll/donfig.
28- """
29-
301from __future__ import annotations
312
323from typing import Any , Literal , cast
@@ -39,7 +10,7 @@ class BadConfigError(ValueError):
3910
4011
4112class Config (DConfig ): # type: ignore[misc]
42- """The Config will collect configuration from config files and environment variables
13+ """Will collect configuration from config files and environment variables
4314
4415 Example environment variables:
4516 Grabs environment variables of the form "ZARR_FOO__BAR_BAZ=123" and
@@ -57,26 +28,21 @@ def reset(self) -> None:
5728 self .refresh ()
5829
5930
60- # The default configuration for zarr
31+ # The config module is responsible for managing the configuration of zarr and is based on the Donfig python library.
32+ # For selecting custom implementations of codecs, pipelines, buffers and ndbuffers, first register the implementations
33+ # in the registry and then select them in the config.
34+ # e.g. an implementation of the bytes codec in a class "NewBytesCodec", requires the value of codecs.bytes.name to be
35+ # "NewBytesCodec".
36+ # Donfig can be configured programmatically, by environment variables, or from YAML files in standard locations
37+ # e.g. export ZARR_CODECS__BYTES__NAME="NewBytesCodec"
38+ # (for more information see github.com/pytroll/donfig)
39+ # Default values below point to the standard implementations of zarr-python
6140config = Config (
6241 "zarr" ,
6342 defaults = [
6443 {
6544 "default_zarr_version" : 3 ,
66- "array" : {
67- "order" : "C" ,
68- "write_empty_chunks" : False ,
69- "v2_default_compressor" : {
70- "numeric" : "zstd" ,
71- "string" : "vlen-utf8" ,
72- "bytes" : "vlen-bytes" ,
73- },
74- "v3_default_codecs" : {
75- "numeric" : ["bytes" , "zstd" ],
76- "string" : ["vlen-utf8" ],
77- "bytes" : ["vlen-bytes" ],
78- },
79- },
45+ "array" : {"order" : "C" },
8046 "async" : {"concurrency" : 10 , "timeout" : None },
8147 "threading" : {"max_workers" : None },
8248 "json_indent" : 2 ,
0 commit comments