Skip to content

Commit

Permalink
chore(deps): drop support for python 3.10 and numpy 1.24 (zarr-develo…
Browse files Browse the repository at this point in the history
…pers#2217)

* chore(deps): drop support for python 3.10 and numpy 124

* lint

* bump python in readthedocs

* fix array import in docs

* try on 3.12

* style: pre-commit fixes

* fixup

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jhamman and pre-commit-ci[bot] authored Sep 26, 2024
1 parent 6984294 commit 0e4cc7e
Show file tree
Hide file tree
Showing 26 changed files with 70 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
numpy-version: ['1.24', '1.26', '2.0']
python-version: ['3.11', '3.12']
numpy-version: ['1.25', '1.26', '2.0']
dependency-set: ["minimal", "optional"]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.12"

sphinx:
configuration: docs/conf.py
Expand Down
4 changes: 2 additions & 2 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ Documentation
* Update docs to use ``python -m pytest``.
By :user:`Ray Bell <raybellwaves>` :issue:`923`.

* Fix versionadded tag in zarr.core.Array docstring.
* Fix versionadded tag in zarr.Array docstring.
By :user:`Juan Nunez-Iglesias <jni>` :issue:`852`.

* Doctest seem to be stricter now, updating tostring() to tobytes().
Expand Down Expand Up @@ -1896,7 +1896,7 @@ Enhancements
:user:`John Kirkham <jakirkham>`, :issue:`92`, :issue:`122`.

* **Viewing an array as a different dtype**. The ``Array`` class has a new
:func:`zarr.core.Array.astype` method, which is a convenience that enables an
:func:`zarr.Array.astype` method, which is a convenience that enables an
array to be viewed as a different dtype. By :user:`John Kirkham <jakirkham>`,
:issue:`94`, :issue:`96`.

Expand Down
50 changes: 25 additions & 25 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Zarr has several functions for creating arrays. For example::
>>> import zarr
>>> z = zarr.zeros((10000, 10000), chunks=(1000, 1000), dtype='i4')
>>> z
<zarr.core.Array (10000, 10000) int32>
<zarr.Array (10000, 10000) int32>

The code above creates a 2-dimensional array of 32-bit integers with 10000 rows
and 10000 columns, divided into chunks where each chunk has 1000 rows and 1000
Expand Down Expand Up @@ -168,7 +168,7 @@ compression ratio. Zarr arrays provide a ``info`` property which can be used to
print some diagnostics, e.g.::

>>> z.info
Type : zarr.core.Array
Type : zarr.Array
Data type : int32
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Expand Down Expand Up @@ -260,7 +260,7 @@ Here is an example using a delta filter with the Blosc compressor::
>>> data = np.arange(100000000, dtype='i4').reshape(10000, 10000)
>>> z = zarr.array(data, chunks=(1000, 1000), filters=filters, compressor=compressor)
>>> z.info
Type : zarr.core.Array
Type : zarr.Array
Data type : int32
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Expand Down Expand Up @@ -302,15 +302,15 @@ Groups can also contain arrays, e.g.::

>>> z1 = bar.zeros('baz', shape=(10000, 10000), chunks=(1000, 1000), dtype='i4')
>>> z1
<zarr.core.Array '/foo/bar/baz' (10000, 10000) int32>
<zarr.Array '/foo/bar/baz' (10000, 10000) int32>

Arrays are known as "datasets" in HDF5 terminology. For compatibility with h5py,
Zarr groups also implement the ``create_dataset()`` and ``require_dataset()``
methods, e.g.::

>>> z = bar.create_dataset('quux', shape=(10000, 10000), chunks=(1000, 1000), dtype='i4')
>>> z
<zarr.core.Array '/foo/bar/quux' (10000, 10000) int32>
<zarr.Array '/foo/bar/quux' (10000, 10000) int32>

Members of a group can be accessed via the suffix notation, e.g.::

Expand All @@ -323,7 +323,7 @@ call, e.g.::
>>> root['foo/bar']
<zarr.hierarchy.Group '/foo/bar'>
>>> root['foo/bar/baz']
<zarr.core.Array '/foo/bar/baz' (10000, 10000) int32>
<zarr.Array '/foo/bar/baz' (10000, 10000) int32>

The :func:`zarr.hierarchy.Group.tree` method can be used to print a tree
representation of the hierarchy, e.g.::
Expand All @@ -344,7 +344,7 @@ sub-directories, e.g.::
<zarr.hierarchy.Group '/'>
>>> z = root.zeros('foo/bar/baz', shape=(10000, 10000), chunks=(1000, 1000), dtype='i4')
>>> z
<zarr.core.Array '/foo/bar/baz' (10000, 10000) int32>
<zarr.Array '/foo/bar/baz' (10000, 10000) int32>

Groups can be used as context managers (in a ``with`` statement).
If the underlying store has a ``close`` method, it will be called on exit.
Expand Down Expand Up @@ -388,7 +388,7 @@ property. E.g.::

>>> bar.info
Name : /foo/bar
Type : zarr.core.Array
Type : zarr.Array
Data type : int64
Shape : (1000000,)
Chunk shape : (100000,)
Expand All @@ -403,7 +403,7 @@ property. E.g.::

>>> baz.info
Name : /foo/baz
Type : zarr.core.Array
Type : zarr.Array
Data type : float32
Shape : (1000, 1000)
Chunk shape : (100, 100)
Expand Down Expand Up @@ -472,7 +472,7 @@ Note that although this functionality is similar to some of the advanced
indexing capabilities available on NumPy arrays and on h5py datasets, **the Zarr
API for advanced indexing is different from both NumPy and h5py**, so please
read this section carefully. For a complete description of the indexing API,
see the documentation for the :class:`zarr.core.Array` class.
see the documentation for the :class:`zarr.Array` class.

Indexing with coordinate arrays
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -880,10 +880,10 @@ Here is an example using S3Map to read an array created previously::
>>> root = zarr.group(store=store)
>>> z = root['foo/bar/baz']
>>> z
<zarr.core.Array '/foo/bar/baz' (21,) |S1>
<zarr.Array '/foo/bar/baz' (21,) |S1>
>>> z.info
Name : /foo/bar/baz
Type : zarr.core.Array
Type : zarr.Array
Data type : |S1
Shape : (21,)
Chunk shape : (7,)
Expand Down Expand Up @@ -1150,7 +1150,7 @@ your array, then you can use an array with a fixed-length bytes dtype. E.g.::

>>> z = zarr.zeros(10, dtype='S6')
>>> z
<zarr.core.Array (10,) |S6>
<zarr.Array (10,) |S6>
>>> z[0] = b'Hello'
>>> z[1] = b'world!'
>>> z[:]
Expand All @@ -1166,7 +1166,7 @@ A fixed-length unicode dtype is also available, e.g.::
>>> text_data = greetings * 10000
>>> z = zarr.array(text_data, dtype='U20')
>>> z
<zarr.core.Array (120000,) <U20>
<zarr.Array (120000,) <U20>
>>> z[:]
array(['¡Hola mundo!', 'Hej Världen!', 'Servus Woid!', ...,
'Helló, világ!', 'Zdravo svete!', 'เฮลโลเวิลด์'],
Expand All @@ -1182,7 +1182,7 @@ E.g. using ``VLenUTF8``::
>>> import numcodecs
>>> z = zarr.array(text_data, dtype=object, object_codec=numcodecs.VLenUTF8())
>>> z
<zarr.core.Array (120000,) object>
<zarr.Array (120000,) object>
>>> z.filters
[VLenUTF8()]
>>> z[:]
Expand All @@ -1194,7 +1194,7 @@ is a short-hand for ``dtype=object, object_codec=numcodecs.VLenUTF8()``, e.g.::

>>> z = zarr.array(text_data, dtype=str)
>>> z
<zarr.core.Array (120000,) object>
<zarr.Array (120000,) object>
>>> z.filters
[VLenUTF8()]
>>> z[:]
Expand All @@ -1210,7 +1210,7 @@ e.g.::
>>> bytes_data = [g.encode('utf-8') for g in greetings] * 10000
>>> z = zarr.array(bytes_data, dtype=bytes)
>>> z
<zarr.core.Array (120000,) object>
<zarr.Array (120000,) object>
>>> z.filters
[VLenBytes()]
>>> z[:]
Expand All @@ -1225,7 +1225,7 @@ integer. E.g.::
>>> categorize = numcodecs.Categorize(greetings, dtype=object)
>>> z = zarr.array(text_data, dtype=object, object_codec=categorize)
>>> z
<zarr.core.Array (120000,) object>
<zarr.Array (120000,) object>
>>> z.filters
[Categorize(dtype='|O', astype='|u1', labels=['¡Hola mundo!', 'Hej Världen!', 'Servus Woid!', ...])]
>>> z[:]
Expand Down Expand Up @@ -1275,7 +1275,7 @@ and stores the same primitive type (a.k.a. a ragged array), the

>>> z = zarr.empty(4, dtype=object, object_codec=numcodecs.VLenArray(int))
>>> z
<zarr.core.Array (4,) object>
<zarr.Array (4,) object>
>>> z.filters
[VLenArray(dtype='<i8')]
>>> z[0] = np.array([1, 3, 5])
Expand All @@ -1291,7 +1291,7 @@ primitive dtype such as 'i4' or 'f8'. E.g.::

>>> z = zarr.empty(4, dtype='array:i8')
>>> z
<zarr.core.Array (4,) object>
<zarr.Array (4,) object>
>>> z.filters
[VLenArray(dtype='<i8')]
>>> z[0] = np.array([1, 3, 5])
Expand Down Expand Up @@ -1367,7 +1367,7 @@ ratios, depending on the correlation structure within the data. E.g.::
>>> a = np.arange(100000000, dtype='i4').reshape(10000, 10000).T
>>> c = zarr.array(a, chunks=(1000, 1000))
>>> c.info
Type : zarr.core.Array
Type : zarr.Array
Data type : int32
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Expand All @@ -1381,7 +1381,7 @@ ratios, depending on the correlation structure within the data. E.g.::
Chunks initialized : 100/100
>>> f = zarr.array(a, chunks=(1000, 1000), order='F')
>>> f.info
Type : zarr.core.Array
Type : zarr.Array
Data type : int32
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Expand Down Expand Up @@ -1549,7 +1549,7 @@ with thread synchronization::
>>> z = zarr.zeros((10000, 10000), chunks=(1000, 1000), dtype='i4',
... synchronizer=zarr.ThreadSynchronizer())
>>> z
<zarr.core.Array (10000, 10000) int32>
<zarr.Array (10000, 10000) int32>

This array is safe to read or write within a multi-threaded program.

Expand All @@ -1563,7 +1563,7 @@ some networked file systems). E.g.::
... chunks=(1000, 1000), dtype='i4',
... synchronizer=synchronizer)
>>> z
<zarr.core.Array (10000, 10000) int32>
<zarr.Array (10000, 10000) int32>

This array is safe to read or write from multiple processes.

Expand Down Expand Up @@ -1631,7 +1631,7 @@ arrays, as long as the units are specified. E.g.::

>>> z = zarr.array(['2007-07-13', '2006-01-13', '2010-08-13'], dtype='M8[D]')
>>> z
<zarr.core.Array (3,) datetime64[D]>
<zarr.Array (3,) datetime64[D]>
>>> z[:]
array(['2007-07-13', '2006-01-13', '2010-08-13'], dtype='datetime64[D]')
>>> z[0]
Expand Down
25 changes: 12 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ maintainers = [
{ name = "Norman Rzepka" },
{ name = "Ryan Abernathey" }
]
requires-python = ">=3.10"
requires-python = ">=3.11"
# If you add a new dependency here, please also add it to .pre-commit-config.yml
dependencies = [
'asciitree',
'numpy>=1.24',
'numpy>=1.25',
'fasteners',
'numcodecs>=0.10.0',
'numcodecs>=0.10.2',
'fsspec>2024',
'crc32c',
'typing_extensions',
Expand All @@ -45,7 +45,6 @@ classifiers = [
'Topic :: Software Development :: Libraries :: Python Modules',
'Operating System :: Unix',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
Expand Down Expand Up @@ -130,18 +129,18 @@ dependencies = [
features = ["test", "extra"]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12"]
numpy = ["1.24", "1.26", "2.0"]
python = ["3.11", "3.12"]
numpy = ["1.25", "1.26", "2.0"]
version = ["minimal"]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12"]
numpy = ["1.24", "1.26", "2.0"]
python = ["3.11", "3.12"]
numpy = ["1.25", "1.26", "2.0"]
features = ["optional"]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12"]
numpy = ["1.24", "1.26", "2.0"]
python = ["3.11", "3.12"]
numpy = ["1.25", "1.26", "2.0"]
features = ["gpu"]

[tool.hatch.envs.test.scripts]
Expand All @@ -161,8 +160,8 @@ dependencies = [
features = ["test", "extra", "gpu"]

[[tool.hatch.envs.gputest.matrix]]
python = ["3.10", "3.11", "3.12"]
numpy = ["1.24", "1.26", "2.0"]
python = ["3.11", "3.12"]
numpy = ["1.25", "1.26", "2.0"]
version = ["minimal"]

[tool.hatch.envs.gputest.scripts]
Expand Down Expand Up @@ -249,7 +248,7 @@ ignore = [
]

[tool.mypy]
python_version = "3.10"
python_version = "3.11"
ignore_missing_imports = true
namespace_packages = false

Expand Down
2 changes: 1 addition & 1 deletion src/zarr/abc/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

if TYPE_CHECKING:
from collections.abc import Awaitable, Callable, Iterable
from typing import Self

import numpy as np
from typing_extensions import Self

from zarr.abc.store import ByteGetter, ByteSetter
from zarr.core.array_spec import ArraySpec
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/abc/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing_extensions import Self
from typing import Self

from zarr.core.common import JSON

Expand Down
5 changes: 2 additions & 3 deletions src/zarr/abc/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
from abc import ABC, abstractmethod
from asyncio import gather
from collections.abc import AsyncGenerator, Iterable
from types import TracebackType
from typing import TYPE_CHECKING, Any, NamedTuple, Protocol, runtime_checkable

if TYPE_CHECKING:
from collections.abc import AsyncGenerator, Iterable
from types import TracebackType
from typing import Any, TypeAlias

from typing_extensions import Self
from typing import Any, Self, TypeAlias

from zarr.core.buffer import Buffer, BufferPrototype
from zarr.core.common import AccessModeLiteral, BytesLike
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from zarr.registry import register_codec

if TYPE_CHECKING:
from typing_extensions import Self
from typing import Self

from zarr.core.array_spec import ArraySpec
from zarr.core.buffer import Buffer
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from zarr.registry import register_codec

if TYPE_CHECKING:
from typing_extensions import Self
from typing import Self

from zarr.core.array_spec import ArraySpec

Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/crc32c_.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from zarr.registry import register_codec

if TYPE_CHECKING:
from typing_extensions import Self
from typing import Self

from zarr.core.array_spec import ArraySpec
from zarr.core.buffer import Buffer
Expand Down
Loading

0 comments on commit 0e4cc7e

Please sign in to comment.