Skip to content

Commit 44e768a

Browse files
committed
formatting
1 parent 875e8ea commit 44e768a

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

docs/user-guide/extending.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,66 +13,66 @@ Custom stores
1313
Custom codecs
1414
-------------
1515

16-
There are three types of codecs in Zarr: array-to-array, array-to-bytes, and bytes-to-bytes.
17-
Array-to-array codecs are used to transform the n-dimensional array data before serializing
16+
There are three types of codecs in Zarr: array-to-array, array-to-bytes, and bytes-to-bytes.
17+
Array-to-array codecs are used to transform the n-dimensional array data before serializing
1818
to bytes. Examples include delta encoding or scaling codecs. Array-to-bytes codecs are used
19-
for serializing the array data to bytes. In Zarr, the main codec to use for numeric arrays
20-
is the :class:`zarr.codecs.BytesCodec`. Bytes-to-bytes transform the serialized bytestreams
21-
of the array data. Examples include compression codecs, such as
22-
:class:`zarr.codecs.GzipCodec`, :class:`zarr.codecs.BloscCodec` or
23-
:class:`zarr.codecs.ZstdCodec`, and codecs that add a checksum to the bytestream, such as
19+
for serializing the array data to bytes. In Zarr, the main codec to use for numeric arrays
20+
is the :class:`zarr.codecs.BytesCodec`. Bytes-to-bytes transform the serialized bytestreams
21+
of the array data. Examples include compression codecs, such as
22+
:class:`zarr.codecs.GzipCodec`, :class:`zarr.codecs.BloscCodec` or
23+
:class:`zarr.codecs.ZstdCodec`, and codecs that add a checksum to the bytestream, such as
2424
:class:`zarr.codecs.Crc32cCodec`.
2525

26-
Custom codecs for Zarr are implemented by subclassing the relevant base class, see
27-
:class:`zarr.abc.codec.ArrayArrayCodec`, :class:`zarr.abc.codec.ArrayBytesCodec` and
28-
:class:`zarr.abc.codec.BytesBytesCodec`. Most custom codecs should implemented the
29-
``_encode_single`` and ``_decode_single`` methods. These methods operate on single chunks
26+
Custom codecs for Zarr are implemented by subclassing the relevant base class, see
27+
:class:`zarr.abc.codec.ArrayArrayCodec`, :class:`zarr.abc.codec.ArrayBytesCodec` and
28+
:class:`zarr.abc.codec.BytesBytesCodec`. Most custom codecs should implemented the
29+
``_encode_single`` and ``_decode_single`` methods. These methods operate on single chunks
3030
of the array data. Alternatively, custom codecs can implement the ``encode`` and ``decode``
31-
methods, which operate on batches of chunks, in case the codec is intended to implement
31+
methods, which operate on batches of chunks, in case the codec is intended to implement
3232
its own batch processing.
3333

3434
Custom codecs should also implement the following methods:
3535

36-
- ``compute_encoded_size``, which returns the byte size of the encoded data given the byte
37-
size of the original data. It should raise ``NotImplementedError`` for codecs with
36+
- ``compute_encoded_size``, which returns the byte size of the encoded data given the byte
37+
size of the original data. It should raise ``NotImplementedError`` for codecs with
3838
variable-sized outputs, such as compression codecs.
39-
- ``validate``, which can be used to check that the codec metadata is compatible with the
39+
- ``validate``, which can be used to check that the codec metadata is compatible with the
4040
array metadata. It should raise errors if not.
41-
- ``resolve_metadata`` (optional), which is important for codecs that change the shape,
41+
- ``resolve_metadata`` (optional), which is important for codecs that change the shape,
4242
dtype or fill value of a chunk.
43-
- ``evolve_from_array_spec`` (optional), which can be useful for automatically filling in
43+
- ``evolve_from_array_spec`` (optional), which can be useful for automatically filling in
4444
codec configuration metadata from the array metadata.
4545

46-
To use custom codecs in Zarr, they need to be registered using the
46+
To use custom codecs in Zarr, they need to be registered using the
4747
`entrypoint mechanism <https://packaging.python.org/en/latest/specifications/entry-points/>`_.
48-
Commonly, entrypoints are declared in the ``pyproject.toml`` of your package under the
49-
``[project.entry-points."zarr.codecs"]`` section. Zarr will automatically discover and
48+
Commonly, entrypoints are declared in the ``pyproject.toml`` of your package under the
49+
``[project.entry-points."zarr.codecs"]`` section. Zarr will automatically discover and
5050
load all codecs registered with the entrypoint mechanism from imported modules.
5151

5252
.. code-block:: toml
5353
5454
[project.entry-points."zarr.codecs"]
5555
"custompackage.fancy_codec" = "custompackage:FancyCodec"
5656
57-
New codecs need to have their own unique identifier. To avoid naming collisions, it is
58-
strongly recommended to prefix the codec identifier with a unique name. For example,
57+
New codecs need to have their own unique identifier. To avoid naming collisions, it is
58+
strongly recommended to prefix the codec identifier with a unique name. For example,
5959
the codecs from ``numcodecs`` are prefixed with ``numcodecs.``, e.g. ``numcodecs.delta``.
6060

6161
.. note::
62-
Note that the extension mechanism for the Zarr version 3 is still under development.
63-
Requirements for custom codecs including the choice of codec identifiers might
62+
Note that the extension mechanism for the Zarr version 3 is still under development.
63+
Requirements for custom codecs including the choice of codec identifiers might
6464
change in the future.
6565

66-
It is also possible to register codecs as replacements for existing codecs. This might be
67-
useful for providing specialized implementations, such as GPU-based codecs. In case of
66+
It is also possible to register codecs as replacements for existing codecs. This might be
67+
useful for providing specialized implementations, such as GPU-based codecs. In case of
6868
multiple codecs, the :mod:`zarr.core.config` mechanism can be used to select the preferred
69-
implementation.
69+
implementation.
7070

7171
.. note::
7272
This sections explains how custom codecs can be created for Zarr version 3. For Zarr
73-
version 2, codecs should subclass the
74-
`numcodecs.abc.Codec <https://numcodecs.readthedocs.io/en/stable/abc.html#numcodecs.abc.Codec>`_
75-
base class and register through
73+
version 2, codecs should subclass the
74+
`numcodecs.abc.Codec <https://numcodecs.readthedocs.io/en/stable/abc.html#numcodecs.abc.Codec>`_
75+
base class and register through
7676
`numcodecs.registry.register_codec <https://numcodecs.readthedocs.io/en/stable/registry.html#numcodecs.registry.register_codec>`_.
7777

7878

docs/user-guide/v3_migration.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The Array class
9393
1. Disallow direct construction - use :func:`zarr.open_array` or :func:`zarr.create_array`
9494
instead of directly constructing the :class:`zarr.Array` class.
9595

96-
2. Defaulting to ``zarr_format=3`` - newly created arrays will use the version 3 of the
96+
2. Defaulting to ``zarr_format=3`` - newly created arrays will use the version 3 of the
9797
Zarr specification. To continue using version 2, set ``zarr_format=2`` when creating arrays.
9898

9999
The Group class
@@ -137,16 +137,16 @@ Dependencies Changes
137137
Configuration
138138
~~~~~~~~~~~~~
139139

140-
There is a new configuration system based on `donfig <https://github.com/pytroll/donfig>`_,
141-
which can be accessed via :mod:`zarr.core.config`.
140+
There is a new configuration system based on `donfig <https://github.com/pytroll/donfig>`_,
141+
which can be accessed via :mod:`zarr.core.config`.
142142
Configuration values can be set using code like the following:
143143

144144
.. code-block:: python
145145
146146
import zarr
147147
zarr.config.set({"array.order": "F"})
148148
149-
Alternatively, configuration values can be set using environment variables,
149+
Alternatively, configuration values can be set using environment variables,
150150
e.g. ``ZARR_ARRAY__ORDER=F``.
151151

152152
Configuration options include the following:

0 commit comments

Comments
 (0)