|
5 | 5 |
|
6 | 6 | Example: |
7 | 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``. |
| 8 | + to be ``your.module.NewBytesCodec``. Donfig can be configured programmatically, by environment variables, or from |
| 9 | + YAML files in standard locations. |
9 | 10 |
|
10 | | -.. code-block:: python |
| 11 | + .. code-block:: python |
11 | 12 |
|
12 | | - from your.module import NewBytesCodec |
13 | | - from zarr.core.config import register_codec, config |
| 13 | + from your.module import NewBytesCodec |
| 14 | + from zarr.core.config import register_codec, config |
14 | 15 |
|
15 | | - register_codec("bytes", NewBytesCodec) |
16 | | - config.set({"codecs.bytes": "your.module.NewBytesCodec"}) |
| 16 | + register_codec("bytes", NewBytesCodec) |
| 17 | + config.set({"codecs.bytes": "your.module.NewBytesCodec"}) |
17 | 18 |
|
18 | | -Donfig can be configured programmatically, by environment variables, or from YAML files in standard locations. |
19 | | -For example, to set the bytes codec via an environment variable: |
| 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. |
20 | 22 |
|
21 | | -.. code-block:: bash |
| 23 | + .. code-block:: bash |
22 | 24 |
|
23 | | - export ZARR_CODECS__BYTES="your.module.NewBytesCodec" |
| 25 | + export ZARR_CODECS__BYTES="your.module.NewBytesCodec" |
24 | 26 |
|
25 | 27 | For more information, see the Donfig documentation at https://github.com/pytroll/donfig. |
26 | | -
|
27 | | -Default values below point to the standard implementations of zarr-python. |
28 | 28 | """ |
29 | 29 |
|
30 | 30 | from __future__ import annotations |
@@ -57,6 +57,7 @@ def reset(self) -> None: |
57 | 57 | self.refresh() |
58 | 58 |
|
59 | 59 |
|
| 60 | +# The default configuration for zarr |
60 | 61 | config = Config( |
61 | 62 | "zarr", |
62 | 63 | defaults=[ |
|
0 commit comments