Skip to content

Commit 90c58f6

Browse files
authored
Merge branch 'main' into format_specification
2 parents 7d7fb0f + 8579e21 commit 90c58f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+101
-419
lines changed

.github/workflows/minimal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Setup Miniconda
18-
uses: conda-incubator/setup-miniconda@v2.2.0
18+
uses: conda-incubator/setup-miniconda@v3.0.1
1919
with:
2020
channels: conda-forge
2121
environment-file: environment.yml

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
with:
4343
fetch-depth: 0
4444
- name: Setup Miniconda
45-
uses: conda-incubator/setup-miniconda@v2.2.0
45+
uses: conda-incubator/setup-miniconda@v3.0.1
4646
with:
4747
channels: conda-forge
4848
python-version: ${{ matrix.python-version }}

.github/workflows/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
with:
6565
name: releases
6666
path: dist
67-
- uses: pypa/gh-action-pypi-publish@v1.8.10
67+
- uses: pypa/gh-action-pypi-publish@v1.8.11
6868
with:
6969
user: __token__
7070
password: ${{ secrets.pypi_password }}

.github/workflows/windows-testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0
24-
- uses: conda-incubator/setup-miniconda@v2.2.0
24+
- uses: conda-incubator/setup-miniconda@v3.0.1
2525
with:
2626
auto-update-conda: true
2727
python-version: ${{ matrix.python-version }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ coverage.xml
5151

5252
# Sphinx documentation
5353
docs/_build/
54+
docs/_autoapi/
5455

5556
# PyBuilder
5657
target/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
# Respect `exclude` and `extend-exclude` settings.
1515
args: ["--force-exclude"]
1616
- repo: https://github.com/psf/black
17-
rev: 22.12.0
17+
rev: 23.10.1
1818
hooks:
1919
- id: black
2020
- repo: https://github.com/codespell-project/codespell

.readthedocs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ build:
77

88
sphinx:
99
configuration: docs/conf.py
10+
fail_on_warning: true
1011

1112
python:
1213
install:
1314
- method: pip
1415
path: .
1516
extra_requirements:
1617
- docs
18+
19+
formats: all

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

bench/compress_normal.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from zarr import blosc
99

1010
if __name__ == "__main__":
11-
1211
sys.path.insert(0, "..")
1312

1413
# setup

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS =
5+
SPHINXOPTS = -W --keep-going
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build

docs/api/core.rst

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
The Array class (``zarr.core``)
22
===============================
3-
.. module:: zarr.core
43

5-
.. autoclass:: Array
6-
7-
.. automethod:: __getitem__
8-
.. automethod:: __setitem__
9-
.. automethod:: get_basic_selection
10-
.. automethod:: set_basic_selection
11-
.. automethod:: get_mask_selection
12-
.. automethod:: set_mask_selection
13-
.. automethod:: get_block_selection
14-
.. automethod:: set_block_selection
15-
.. automethod:: get_coordinate_selection
16-
.. automethod:: set_coordinate_selection
17-
.. automethod:: get_orthogonal_selection
18-
.. automethod:: set_orthogonal_selection
19-
.. automethod:: digest
20-
.. automethod:: hexdigest
21-
.. automethod:: resize
22-
.. automethod:: append
23-
.. automethod:: view
24-
.. automethod:: astype
4+
.. automodapi:: zarr.core
5+
:no-heading:

docs/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"sphinx.ext.autosummary",
4343
"sphinx.ext.viewcode",
4444
"sphinx.ext.intersphinx",
45+
"sphinx_automodapi.automodapi",
4546
"numpydoc",
4647
"sphinx_issues",
4748
"sphinx_copybutton",
@@ -52,6 +53,9 @@
5253
numpydoc_class_members_toctree = False
5354
issues_github_path = "zarr-developers/zarr-python"
5455

56+
automodapi_inheritance_diagram = False
57+
automodapi_toctreedirnm = "_autoapi"
58+
5559
# Add any paths that contain templates here, relative to this directory.
5660
templates_path = ["_templates"]
5761

@@ -144,6 +148,7 @@
144148
},
145149
],
146150
"collapse_navigation": True,
151+
"navigation_with_keys": False,
147152
}
148153

149154
# Add any paths that contain custom themes here, relative to this directory.
@@ -331,6 +336,7 @@ def setup(app):
331336
intersphinx_mapping = {
332337
"python": ("https://docs.python.org/", None),
333338
"numpy": ("https://numpy.org/doc/stable/", None),
339+
"numcodecs": ("https://numcodecs.readthedocs.io/en/stable/", None),
334340
}
335341

336342

docs/contributing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ Creating a development environment
8585
To work with the Zarr source code, it is recommended to set up a Python virtual
8686
environment and install all Zarr dependencies using the same versions as are used by
8787
the core developers and continuous integration services. Assuming you have a Python
88-
3 interpreter already installed, and have also installed the virtualenv package, and
89-
you have cloned the Zarr source code and your current working directory is the root of
90-
the repository, you can do something like the following::
88+
3 interpreter already installed, and you have cloned the Zarr source code and your
89+
current working directory is the root of the repository, you can do something like
90+
the following::
9191

9292
$ mkdir -p ~/pyenv/zarr-dev
9393
$ python -m venv ~/pyenv/zarr-dev

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Zarr-Python
1919

2020
**Version**: |version|
2121

22-
**Download documentation**: `Zipped HTML <https://zarr.readthedocs.io/_/downloads/en/stable/htmlzip/>`_
22+
**Download documentation**: `PDF/Zipped HTML/EPUB <https://readthedocs.org/projects/zarr/downloads/>`_
2323

2424
**Useful links**:
2525
`Installation <installation.html>`_ |
@@ -60,6 +60,7 @@ Zarr is a file storage format for chunked, compressed, N-dimensional arrays base
6060
+++
6161

6262
.. button-ref:: tutorial
63+
:ref-type: ref
6364
:expand:
6465
:color: dark
6566
:click-parent:

docs/release.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,37 @@ Release notes
1818
Unreleased
1919
----------
2020

21+
Docs
22+
~~~~
23+
24+
* Minor correction and changes in documentation.
25+
By :user:`Sanket Verma <MSanKeys963>` :issue:`1509`.
26+
27+
* Fix typo in documentation.
28+
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1554`
29+
30+
* The documentation build now fails if there are any warnings.
31+
By :user:`David Stansby <dstansby>` :issue:`1548`.
32+
33+
* Add links to ``numcodecs`` docs in the tutorial.
34+
By :user:`David Stansby <dstansby>` :issue:`1535`.
35+
36+
* Enable offline formats for documentation builds.
37+
By :user:`Sanket Verma <MSanKeys963>` :issue:`1551`.
38+
39+
* Minor tweak to advanced indexing tutorial examples.
40+
By :user:`Ross Barnowski <rossbar>` :issue:`1550`.
41+
42+
2143
Maintenance
2244
~~~~~~~~~~~
2345

46+
* Cache result of ``FSStore._fsspec_installed()``.
47+
By :user:`Janick Martinez Esturo <ph03>` :issue:`1581`.
48+
49+
* Extend copyright notice to 2023.
50+
By :user:`Jack Kelly <JackKelly>` :issue:`1528`.
51+
2452
* Change occurrence of ``io.open()`` into ``open()``.
2553
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1421`.
2654

@@ -33,6 +61,10 @@ Maintenance
3361
* Allow ``black`` code formatter to be run with any Python version.
3462
By :user:`David Stansby <dstansby>` :issue:`1549`.
3563

64+
* Remove ``sphinx-rtd-theme`` dependency from ``pyproject.toml``.
65+
By :user:`Sanket Verma <MSanKeys963>` :issue:`1563`.
66+
67+
3668
.. _release_2.16.1:
3769

3870
2.16.1
@@ -161,10 +193,12 @@ Major changes
161193

162194
* Improve Zarr V3 support, adding partial store read/write and storage transformers.
163195
Add new features from the `v3 spec <https://zarr-specs.readthedocs.io/en/latest/core/v3.0.html>`_:
196+
164197
* storage transformers
165198
* `get_partial_values` and `set_partial_values`
166199
* efficient `get_partial_values` implementation for `FSStoreV3`
167200
* sharding storage transformer
201+
168202
By :user:`Jonathan Striebel <jstriebel>`; :issue:`1096`, :issue:`1111`.
169203

170204
* N5 nows supports Blosc.

docs/tutorial.rst

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,17 @@ Indexing with coordinate arrays
480480
Items from a Zarr array can be extracted by providing an integer array of
481481
coordinates. E.g.::
482482

483-
>>> z = zarr.array(np.arange(10))
483+
>>> z = zarr.array(np.arange(10) ** 2)
484484
>>> z[:]
485-
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
486-
>>> z.get_coordinate_selection([1, 4])
487-
array([1, 4])
485+
array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])
486+
>>> z.get_coordinate_selection([2, 5])
487+
array([ 4, 25])
488488

489489
Coordinate arrays can also be used to update data, e.g.::
490490

491-
>>> z.set_coordinate_selection([1, 4], [-1, -2])
491+
>>> z.set_coordinate_selection([2, 5], [-1, -2])
492492
>>> z[:]
493-
array([ 0, -1, 2, 3, -2, 5, 6, 7, 8, 9])
493+
array([ 0, 1, -1, 9, 16, -2, 36, 49, 64, 81])
494494

495495
For multidimensional arrays, coordinates must be provided for each dimension,
496496
e.g.::
@@ -534,17 +534,17 @@ Indexing with a mask array
534534

535535
Items can also be extracted by providing a Boolean mask. E.g.::
536536

537-
>>> z = zarr.array(np.arange(10))
537+
>>> z = zarr.array(np.arange(10) ** 2)
538538
>>> z[:]
539-
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
539+
array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])
540540
>>> sel = np.zeros_like(z, dtype=bool)
541-
>>> sel[1] = True
542-
>>> sel[4] = True
541+
>>> sel[2] = True
542+
>>> sel[5] = True
543543
>>> z.get_mask_selection(sel)
544-
array([1, 4])
544+
array([ 4, 25])
545545
>>> z.set_mask_selection(sel, [-1, -2])
546546
>>> z[:]
547-
array([ 0, -1, 2, 3, -2, 5, 6, 7, 8, 9])
547+
array([ 0, 1, -1, 9, 16, -2, 36, 49, 64, 81])
548548

549549
Here's a multidimensional example::
550550

@@ -986,7 +986,7 @@ It is also possible to initialize the filesystem outside of Zarr and then pass
986986
it through. This requires creating an :class:`zarr.storage.FSStore` object
987987
explicitly. For example::
988988

989-
>>> import s3fs * doctest: +SKIP
989+
>>> import s3fs # doctest: +SKIP
990990
>>> fs = s3fs.S3FileSystem(anon=True) # doctest: +SKIP
991991
>>> store = zarr.storage.FSStore('/zarr-demo/store', fs=fs) # doctest: +SKIP
992992
>>> g = zarr.open_group(store) # doctest: +SKIP
@@ -1175,8 +1175,9 @@ A fixed-length unicode dtype is also available, e.g.::
11751175
For variable-length strings, the ``object`` dtype can be used, but a codec must be
11761176
provided to encode the data (see also :ref:`tutorial_objects` below). At the time of
11771177
writing there are four codecs available that can encode variable length string
1178-
objects: :class:`numcodecs.VLenUTF8`, :class:`numcodecs.JSON`, :class:`numcodecs.MsgPack`.
1179-
and :class:`numcodecs.Pickle`. E.g. using ``VLenUTF8``::
1178+
objects: :class:`numcodecs.vlen.VLenUTF8`, :class:`numcodecs.json.JSON`,
1179+
:class:`numcodecs.msgpacks.MsgPack`. and :class:`numcodecs.pickles.Pickle`.
1180+
E.g. using ``VLenUTF8``::
11801181

11811182
>>> import numcodecs
11821183
>>> z = zarr.array(text_data, dtype=object, object_codec=numcodecs.VLenUTF8())
@@ -1201,8 +1202,8 @@ is a short-hand for ``dtype=object, object_codec=numcodecs.VLenUTF8()``, e.g.::
12011202
'Helló, világ!', 'Zdravo svete!', 'เฮลโลเวิลด์'], dtype=object)
12021203

12031204
Variable-length byte strings are also supported via ``dtype=object``. Again an
1204-
``object_codec`` is required, which can be one of :class:`numcodecs.VLenBytes` or
1205-
:class:`numcodecs.Pickle`. For convenience, ``dtype=bytes`` (or ``dtype=str`` on Python
1205+
``object_codec`` is required, which can be one of :class:`numcodecs.vlen.VLenBytes` or
1206+
:class:`numcodecs.pickles.Pickle`. For convenience, ``dtype=bytes`` (or ``dtype=str`` on Python
12061207
2.7) can be used as a short-hand for ``dtype=object, object_codec=numcodecs.VLenBytes()``,
12071208
e.g.::
12081209

@@ -1218,7 +1219,7 @@ e.g.::
12181219
b'\xe0\xb9\x80\xe0\xb8\xae\xe0\xb8\xa5\xe0\xb9\x82\xe0\xb8\xa5\xe0\xb9\x80\xe0\xb8\xa7\xe0\xb8\xb4\xe0\xb8\xa5\xe0\xb8\x94\xe0\xb9\x8c'], dtype=object)
12191220

12201221
If you know ahead of time all the possible string values that can occur, you could
1221-
also use the :class:`numcodecs.Categorize` codec to encode each unique string value as an
1222+
also use the :class:`numcodecs.categorize.Categorize` codec to encode each unique string value as an
12221223
integer. E.g.::
12231224

12241225
>>> categorize = numcodecs.Categorize(greetings, dtype=object)
@@ -1245,7 +1246,7 @@ The best codec to use will depend on what type of objects are present in the arr
12451246

12461247
At the time of writing there are three codecs available that can serve as a general
12471248
purpose object codec and support encoding of a mixture of object types:
1248-
:class:`numcodecs.JSON`, :class:`numcodecs.MsgPack`. and :class:`numcodecs.Pickle`.
1249+
:class:`numcodecs.json.JSON`, :class:`numcodecs.msgpacks.MsgPack`. and :class:`numcodecs.pickles.Pickle`.
12491250

12501251
For example, using the JSON codec::
12511252

@@ -1258,7 +1259,7 @@ For example, using the JSON codec::
12581259
array([42, 'foo', list(['bar', 'baz', 'qux']), {'a': 1, 'b': 2.2}, None], dtype=object)
12591260

12601261
Not all codecs support encoding of all object types. The
1261-
:class:`numcodecs.Pickle` codec is the most flexible, supporting encoding any type
1262+
:class:`numcodecs.pickles.Pickle` codec is the most flexible, supporting encoding any type
12621263
of Python object. However, if you are sharing data with anyone other than yourself, then
12631264
Pickle is not recommended as it is a potential security risk. This is because malicious
12641265
code can be embedded within pickled data. The JSON and MsgPack codecs do not have any
@@ -1270,7 +1271,7 @@ Ragged arrays
12701271

12711272
If you need to store an array of arrays, where each member array can be of any length
12721273
and stores the same primitive type (a.k.a. a ragged array), the
1273-
:class:`numcodecs.VLenArray` codec can be used, e.g.::
1274+
:class:`numcodecs.vlen.VLenArray` codec can be used, e.g.::
12741275

12751276
>>> z = zarr.empty(4, dtype=object, object_codec=numcodecs.VLenArray(int))
12761277
>>> z

0 commit comments

Comments
 (0)