Skip to content

Commit cdf5542

Browse files
committed
link zarr.core.config in docstrings
1 parent 500bc7b commit cdf5542

File tree

4 files changed

+36
-33
lines changed

4 files changed

+36
-33
lines changed

src/zarr/api/asynchronous.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,20 +839,20 @@ async def create(
839839
- For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
840840
- For Unicode strings, the default is ``VLenUTF8Codec``.
841841
- For bytes or objects, the default is ``VLenBytesCodec``.
842-
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
842+
These defaults can be changed using the ``array.v3_default_codecs`` variable in :mod:`zarr.core.config`.
843843
compressor : Codec, optional
844844
Primary compressor to compress chunk data.
845845
V2 only. V3 arrays should use ``codecs`` instead.
846846
If neither ``compressor`` nor ``filters`` are provided, a default compressor will be used:
847847
- For numeric arrays, the default is ``ZstdCodec``.
848848
- For Unicode strings, the default is ``VLenUTF8Codec``.
849849
- For bytes or objects, the default is ``VLenBytesCodec``.
850-
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
850+
These defaults can be changed using the ``array.v2_default_compressor`` variable in :mod:`zarr.core.config`.
851851
fill_value : object
852852
Default value to use for uninitialized portions of the array.
853853
order : {'C', 'F'}, optional
854854
Memory layout to be used within each chunk.
855-
If not specified, default is taken from the Zarr config ``array.order``.
855+
If not specified, default is taken from the Zarr config ```array.order```.
856856
store : Store or str
857857
Store or path to directory in file system or name of zip file.
858858
synchronizer : object, optional

src/zarr/core/array.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -424,19 +424,19 @@ async def create(
424424
- For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
425425
- For Unicode strings, the default is ``VLenUTF8Codec``.
426426
- For bytes or objects, the default is ``VLenBytesCodec``.
427-
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
427+
These defaults can be changed using the ``array.v3_default_codecs`` variable in :mod:`zarr.core.config`.
428428
dimension_names : Iterable[str], optional
429429
The names of the dimensions (default is None).
430430
V3 only. V2 arrays should not use this parameter.
431431
chunks : ShapeLike, optional
432432
The shape of the array's chunks.
433-
V2 only. V3 arrays should use :attr:`chunk_shape` instead.
433+
V2 only. V3 arrays should use ``chunk_shape`` instead.
434434
If not specified, default are guessed based on the shape and dtype.
435435
dimension_separator : Literal[".", "/"], optional
436436
The dimension separator (default is ".").
437437
V2 only. V3 arrays should use ``chunk_key_encoding`` instead.
438438
order : Literal["C", "F"], optional
439-
The order of the array (default is specified in the Zarr config `array.order`).
439+
The order of the array (default is specified by ``array.order`` in :mod:`zarr.core.config`).
440440
filters : list[dict[str, JSON]], optional
441441
Sequence of filters to use to encode chunk data prior to compression.
442442
V2 only. V3 arrays should use ``codecs`` instead. If neither ``compressor``
@@ -449,7 +449,7 @@ async def create(
449449
- For numeric arrays, the default is ``ZstdCodec``.
450450
- For Unicode strings, the default is ``VLenUTF8Codec``.
451451
- For bytes or objects, the default is ``VLenBytesCodec``.
452-
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
452+
These defaults can be changed using the ``array.v2_default_compressor`` variable in :mod:`zarr.core.config`.
453453
overwrite : bool, optional
454454
Whether to raise an error if the store already exists (default is False).
455455
data : npt.ArrayLike, optional
@@ -1516,19 +1516,19 @@ def create(
15161516
- For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
15171517
- For Unicode strings, the default is ``VLenUTF8Codec``.
15181518
- For bytes or objects, the default is ``VLenBytesCodec``.
1519-
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
1519+
These defaults can be changed using the ``array.v3_default_codecs`` variable in :mod:`zarr.core.config`.
15201520
dimension_names : Iterable[str], optional
15211521
The names of the dimensions (default is None).
15221522
V3 only. V2 arrays should not use this parameter.
15231523
chunks : ChunkCoords, optional
15241524
The shape of the array's chunks.
1525-
V2 only. V3 arrays should use :attr:`chunk_shape` instead.
1525+
V2 only. V3 arrays should use ``chunk_shape`` instead.
15261526
If not specified, default are guessed based on the shape and dtype.
15271527
dimension_separator : Literal[".", "/"], optional
15281528
The dimension separator (default is ".").
15291529
V2 only. V3 arrays should use ``chunk_key_encoding`` instead.
15301530
order : Literal["C", "F"], optional
1531-
The order of the array (default is specified in the Zarr config `array.order`).
1531+
The order of the array (default is specified by ``array.order`` in :mod:`zarr.core.config`).
15321532
filters : list[dict[str, JSON]], optional
15331533
Sequence of filters to use to encode chunk data prior to compression.
15341534
V2 only. V3 arrays should use ``codecs`` instead. If neither ``compressor``
@@ -1541,7 +1541,7 @@ def create(
15411541
- For numeric arrays, the default is ``ZstdCodec``.
15421542
- For Unicode strings, the default is ``VLenUTF8Codec``.
15431543
- For bytes or objects, the default is ``VLenBytesCodec``.
1544-
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
1544+
These defaults can be changed using the ``array.v2_default_compressor`` variable in :mod:`zarr.core.config`.
15451545
overwrite : bool, optional
15461546
Whether to raise an error if the store already exists (default is False).
15471547

src/zarr/core/config.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
e.g. an implementation of the bytes codec in a class "your.module.NewBytesCodec", requires the value of codecs.bytes
6+
to be "your.module.NewBytesCodec".
7+
Donfig can be configured programmatically, by environment variables, or from YAML files in standard locations
8+
e.g. export ZARR_CODECS__BYTES="your.module.NewBytesCodec"
9+
(for more information see github.com/pytroll/donfig)
10+
Default values below point to the standard implementations of zarr-python
11+
"""
12+
113
from __future__ import annotations
214

315
from typing import Any, Literal, cast
@@ -10,7 +22,7 @@ class BadConfigError(ValueError):
1022

1123

1224
class Config(DConfig): # type: ignore[misc]
13-
"""Will collect configuration from config files and environment variables
25+
"""The Config will collect configuration from config files and environment variables
1426
1527
Example environment variables:
1628
Grabs environment variables of the form "ZARR_FOO__BAR_BAZ=123" and
@@ -28,15 +40,6 @@ def reset(self) -> None:
2840
self.refresh()
2941

3042

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 "your.module.NewBytesCodec", requires the value of codecs.bytes
35-
# to be "your.module.NewBytesCodec".
36-
# Donfig can be configured programmatically, by environment variables, or from YAML files in standard locations
37-
# e.g. export ZARR_CODECS__BYTES="your.module.NewBytesCodec"
38-
# (for more information see github.com/pytroll/donfig)
39-
# Default values below point to the standard implementations of zarr-python
4043
config = Config(
4144
"zarr",
4245
defaults=[

src/zarr/core/group.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,18 +1049,18 @@ async def create_array(
10491049
- For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
10501050
- For Unicode strings, the default is ``VLenUTF8Codec``.
10511051
- For bytes or objects, the default is ``VLenBytesCodec``.
1052-
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
1052+
These defaults can be changed using the ``array.v3_default_codecs`` variable in :mod:`zarr.core.config`.
10531053
dimension_names : Iterable[str] | None = None
10541054
The names of the dimensions of the array. V3 only.
10551055
chunks : ChunkCoords | None = None
10561056
The shape of the chunks of the array.
1057-
V2 only. V3 arrays should use :attr:`chunk_shape` instead.
1057+
V2 only. V3 arrays should use ``chunk_shape`` instead.
10581058
If not specified, default are guessed based on the shape and dtype.
10591059
dimension_separator : Literal[".", "/"] | None = None
10601060
The delimiter used for the chunk keys. (default: ".")
10611061
V2 only. V3 arrays should use ``chunk_key_encoding`` instead.
10621062
order : Literal["C", "F"] | None = None
1063-
The memory order of the array (default is specified in the Zarr config `array.order`).
1063+
The memory order of the array (default is specified by ``array.order`` in :mod:`zarr.core.config`).
10641064
filters : list[dict[str, JSON]] | None = None
10651065
Sequence of filters to use to encode chunk data prior to compression.
10661066
V2 only. V3 arrays should use ``codecs`` instead. If neither ``compressor``
@@ -1073,7 +1073,7 @@ async def create_array(
10731073
- For numeric arrays, the default is ``ZstdCodec``.
10741074
- For Unicode strings, the default is ``VLenUTF8Codec``.
10751075
- For bytes or objects, the default is ``VLenBytesCodec``.
1076-
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
1076+
These defaults can be changed using the ``array.v2_default_compressor`` variable in :mod:`zarr.core.config`.
10771077
overwrite : bool = False
10781078
If True, a pre-existing array or group at the path of this array will
10791079
be overwritten. If False, the presence of a pre-existing array or group is
@@ -2270,18 +2270,18 @@ def create_array(
22702270
- For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
22712271
- For Unicode strings, the default is ``VLenUTF8Codec``.
22722272
- For bytes or objects, the default is ``VLenBytesCodec``.
2273-
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
2273+
These defaults can be changed using the ``array.v3_default_codecs`` variable in :mod:`zarr.core.config`.
22742274
dimension_names : Iterable[str] | None = None
22752275
The names of the dimensions of the array. V3 only.
22762276
chunks : ChunkCoords | None = None
22772277
The shape of the chunks of the array.
2278-
V2 only. V3 arrays should use :attr:`chunk_shape` instead.
2278+
V2 only. V3 arrays should use ``chunk_shape`` instead.
22792279
If not specified, default are guessed based on the shape and dtype.
22802280
dimension_separator : Literal[".", "/"] | None = None
22812281
The delimiter used for the chunk keys. (default: ".")
22822282
V2 only. V3 arrays should use ``chunk_key_encoding`` instead.
22832283
order : Literal["C", "F"] | None = None
2284-
The memory order of the array (default is specified in the Zarr config `array.order`).
2284+
The memory order of the array (default is specified by ``array.order`` in :mod:`zarr.core.config`).
22852285
filters : list[dict[str, JSON]] | None = None
22862286
Sequence of filters to use to encode chunk data prior to compression.
22872287
V2 only. V3 arrays should use ``codecs`` instead. If neither ``compressor``
@@ -2294,7 +2294,7 @@ def create_array(
22942294
- For numeric arrays, the default is ``ZstdCodec``.
22952295
- For Unicode strings, the default is ``VLenUTF8Codec``.
22962296
- For bytes or objects, the default is ``VLenBytesCodec``.
2297-
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
2297+
These defaults can be changed using the ``array.v2_default_compressor`` variable in :mod:`zarr.core.config`.
22982298
overwrite : bool = False
22992299
If True, a pre-existing array or group at the path of this array will
23002300
be overwritten. If False, the presence of a pre-existing array or group is
@@ -2634,18 +2634,18 @@ def array(
26342634
- For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
26352635
- For Unicode strings, the default is ``VLenUTF8Codec``.
26362636
- For bytes or objects, the default is ``VLenBytesCodec``.
2637-
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
2637+
These defaults can be changed using the ``array.v3_default_codecs`` variable in :mod:`zarr.core.config`.
26382638
dimension_names : Iterable[str] | None = None
26392639
The names of the dimensions of the array. V3 only.
26402640
chunks : ChunkCoords | None = None
26412641
The shape of the chunks of the array.
2642-
V2 only. V3 arrays should use :attr:`chunk_shape` instead.
2642+
V2 only. V3 arrays should use ``chunk_shape`` instead.
26432643
If not specified, default are guessed based on the shape and dtype.
26442644
dimension_separator : Literal[".", "/"] | None = None
26452645
The delimiter used for the chunk keys. (default: ".")
26462646
V2 only. V3 arrays should use ``chunk_key_encoding`` instead.
26472647
order : Literal["C", "F"] | None = None
2648-
The memory order of the array (default is specified in the Zarr config `array.order`).
2648+
The memory order of the array (default is specified by ``array.order`` in :mod:`zarr.core.config`).
26492649
filters : list[dict[str, JSON]] | None = None
26502650
Sequence of filters to use to encode chunk data prior to compression.
26512651
V2 only. V3 arrays should use ``codecs`` instead. If neither ``compressor``
@@ -2658,7 +2658,7 @@ def array(
26582658
- For numeric arrays, the default is ``ZstdCodec``.
26592659
- For Unicode strings, the default is ``VLenUTF8Codec``.
26602660
- For bytes or objects, the default is ``VLenBytesCodec``.
2661-
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
2661+
These defaults can be changed using the ``array.v2_default_compressor`` variable in :mod:`zarr.core.config`.
26622662
overwrite : bool = False
26632663
If True, a pre-existing array or group at the path of this array will
26642664
be overwritten. If False, the presence of a pre-existing array or group is

0 commit comments

Comments
 (0)