Skip to content

Commit 6fd3f25

Browse files
committed
improve config docstring
1 parent 92de85c commit 6fd3f25

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/zarr/core/config.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
66
Example:
77
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.
910
10-
.. code-block:: python
11+
.. code-block:: python
1112
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
1415
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"})
1718
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.
2022
21-
.. code-block:: bash
23+
.. code-block:: bash
2224
23-
export ZARR_CODECS__BYTES="your.module.NewBytesCodec"
25+
export ZARR_CODECS__BYTES="your.module.NewBytesCodec"
2426
2527
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.
2828
"""
2929

3030
from __future__ import annotations
@@ -57,6 +57,7 @@ def reset(self) -> None:
5757
self.refresh()
5858

5959

60+
# The default configuration for zarr
6061
config = Config(
6162
"zarr",
6263
defaults=[

0 commit comments

Comments
 (0)