Skip to content

Commit 665847a

Browse files
authored
Merge branch 'main' into feature/rectilinear-chunk-grid
2 parents 84f47d3 + e94504e commit 665847a

15 files changed

Lines changed: 232 additions & 35 deletions

File tree

.github/workflows/codspeed.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CodSpeed Benchmarks
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
# `workflow_dispatch` allows CodSpeed to trigger backtest
9+
# performance analysis in order to generate initial data.
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
benchmarks:
17+
name: Run benchmarks
18+
runs-on: codspeed-macro
19+
steps:
20+
- uses: actions/checkout@v5
21+
with:
22+
fetch-depth: 0 # grab all branches and tags
23+
- name: Set up Python
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: "3.11"
27+
- name: Install Hatch
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install hatch
31+
- name: Run the benchmarks
32+
uses: CodSpeedHQ/action@v4
33+
with:
34+
mode: walltime
35+
run: hatch run test.py3.11-minimal:pytest tests/benchmarks --codspeed

.github/workflows/gpu_test.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ concurrency:
1919

2020
jobs:
2121
test:
22-
name: py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }}
22+
name: py=${{ matrix.python-version }}, deps=${{ matrix.dependency-set }}
2323

2424
runs-on: gpu-runner
2525
strategy:
2626
matrix:
2727
python-version: ['3.11']
28-
numpy-version: ['2.2']
2928
dependency-set: ["minimal"]
3029

3130
steps:
@@ -61,11 +60,11 @@ jobs:
6160
pip install hatch
6261
- name: Set Up Hatch Env
6362
run: |
64-
hatch env create gputest.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}
65-
hatch env run -e gputest.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env
63+
hatch env create gputest.py${{ matrix.python-version }}-${{ matrix.dependency-set }}
64+
hatch env run -e gputest.py${{ matrix.python-version }}-${{ matrix.dependency-set }} list-env
6665
- name: Run Tests
6766
run: |
68-
hatch env run --env gputest.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage-gpu
67+
hatch env run --env gputest.py${{ matrix.python-version }}-${{ matrix.dependency-set }} run-coverage-gpu
6968
7069
- name: Upload coverage
7170
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1

.github/workflows/hypothesis.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
strategy:
2525
matrix:
2626
python-version: ['3.12']
27-
numpy-version: ['2.2']
2827
dependency-set: ["optional"]
2928

3029
steps:
@@ -47,8 +46,8 @@ jobs:
4746
pip install hatch
4847
- name: Set Up Hatch Env
4948
run: |
50-
hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}
51-
hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env
49+
hatch env create test.py${{ matrix.python-version }}-${{ matrix.dependency-set }}
50+
hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.dependency-set }} list-env
5251
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
5352
- name: Restore cached hypothesis directory
5453
id: restore-hypothesis-cache
@@ -64,7 +63,7 @@ jobs:
6463
id: status
6564
run: |
6665
echo "Using Hypothesis profile: $HYPOTHESIS_PROFILE"
67-
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-hypothesis
66+
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.dependency-set }} run-hypothesis
6867
6968
# explicitly save the cache so it gets updated, also do this even if it fails.
7069
- name: Save cached hypothesis directory

.github/workflows/test.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,27 @@ concurrency:
1616

1717
jobs:
1818
test:
19-
name: os=${{ matrix.os }}, py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }}
19+
name: os=${{ matrix.os }}, py=${{ matrix.python-version }}, deps=${{ matrix.dependency-set }}
2020

2121
strategy:
2222
matrix:
2323
python-version: ['3.11', '3.12', '3.13']
24-
numpy-version: ['1.26', '2.2']
2524
dependency-set: ["minimal", "optional"]
2625
os: ["ubuntu-latest"]
2726
include:
2827
- python-version: '3.11'
29-
numpy-version: '1.26'
3028
dependency-set: 'optional'
3129
os: 'macos-latest'
30+
3231
- python-version: '3.13'
33-
numpy-version: '2.2'
3432
dependency-set: 'optional'
3533
os: 'macos-latest'
34+
3635
- python-version: '3.11'
37-
numpy-version: '1.26'
3836
dependency-set: 'optional'
3937
os: 'windows-latest'
38+
4039
- python-version: '3.13'
41-
numpy-version: '2.2'
4240
dependency-set: 'optional'
4341
os: 'windows-latest'
4442
runs-on: ${{ matrix.os }}
@@ -58,13 +56,13 @@ jobs:
5856
pip install hatch
5957
- name: Set Up Hatch Env
6058
run: |
61-
hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}
62-
hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env
59+
hatch env create test.py${{ matrix.python-version }}-${{ matrix.dependency-set }}
60+
hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.dependency-set }} list-env
6361
- name: Run Tests
6462
env:
6563
HYPOTHESIS_PROFILE: ci
6664
run: |
67-
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage
65+
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.dependency-set }} run-coverage
6866
- name: Upload coverage
6967
if: ${{ matrix.dependency-set == 'optional' && matrix.os == 'ubuntu-latest' }}
7068
uses: codecov/codecov-action@v5
@@ -152,4 +150,4 @@ jobs:
152150
contains(needs.*.result, 'cancelled')
153151
run: exit 1
154152
- name: Success
155-
run: echo Success!
153+
run: echo Success!

changes/3562.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add continuous performance benchmarking infrastructure.

changes/3636.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The minimum required version of NumPy is now 2.0.

changes/3656.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed *rich* and *mypy* from the `[test]` dependencies, and added a new `[dev]` dependency group that can be used to install all the development dependencies.

docs/contributing.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,13 @@ If an existing Zarr format version changes, or a new version of the Zarr format
264264
## Release procedure
265265

266266
Open an issue on GitHub announcing the release using the release checklist template:
267-
[https://github.com/zarr-developers/zarr-python/issues/new?template=release-checklist.md](https://github.com/zarr-developers/zarr-python/issues/new?template=release-checklist.md>). The release checklist includes all steps necessary for the release.
267+
[https://github.com/zarr-developers/zarr-python/issues/new?template=release-checklist.md](https://github.com/zarr-developers/zarr-python/issues/new?template=release-checklist.md>). The release checklist includes all steps necessary for the release.
268+
269+
## Benchmarks
270+
271+
Zarr uses [pytest-benchmark](https://pytest-benchmark.readthedocs.io/en/latest/) for running
272+
performance benchmarks as part of our test suite. The benchmarks can be are found in `tests/benchmarks`.
273+
By default pytest is configured to run these benchmarks as plain tests (i.e., no benchmarking). To run
274+
a benchmark with timing measurements, use the `--benchmark-enable` when invoking `pytest`.
275+
276+
The benchmarks are run as part of the continuous integration suite through [codspeed](https://codspeed.io/zarr-developers/zarr-python).

docs/user-guide/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Required dependencies include:
66

77
- [Python](https://docs.python.org/3/) (3.11 or later)
88
- [packaging](https://packaging.pypa.io) (22.0 or later)
9-
- [numpy](https://numpy.org) (1.26 or later)
9+
- [numpy](https://numpy.org) (2.0 or later)
1010
- [numcodecs](https://numcodecs.readthedocs.io) (0.14 or later)
1111
- [google-crc32c](https://github.com/googleapis/python-crc32c) (1.5 or later)
1212
- [typing_extensions](https://typing-extensions.readthedocs.io) (4.9 or later)

pyproject.toml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ requires-python = ">=3.11"
3333
# If you add a new dependency here, please also add it to .pre-commit-config.yml
3434
dependencies = [
3535
'packaging>=22.0',
36-
'numpy>=1.26',
36+
'numpy>=2.0',
3737
'numcodecs>=0.14',
3838
'google-crc32c>=1.5',
3939
'typing_extensions>=4.12',
@@ -70,18 +70,18 @@ gpu = [
7070
"cupy-cuda12x",
7171
]
7272
cli = ["typer"]
73-
# Development extras
73+
# Testing extras
7474
test = [
7575
"coverage>=7.10",
7676
"pytest",
7777
"pytest-asyncio",
7878
"pytest-cov",
7979
"pytest-accept",
80-
"rich",
81-
"mypy",
8280
'numpydoc',
8381
"hypothesis",
8482
"pytest-xdist",
83+
"pytest-benchmark",
84+
"pytest-codspeed",
8585
"packaging",
8686
"tomlkit",
8787
"uv",
@@ -114,6 +114,14 @@ docs = [
114114
'astroid<4',
115115
'pytest'
116116
]
117+
# All development extras
118+
dev = [
119+
"zarr[optional]",
120+
"zarr[test]",
121+
"zarr[remote_tests]",
122+
"zarr[docs]",
123+
"mypy",
124+
]
117125

118126
[project.scripts]
119127
zarr = "zarr._cli.cli:app"
@@ -150,9 +158,6 @@ version.source = "vcs"
150158
hooks.vcs.version-file = "src/zarr/_version.py"
151159

152160
[tool.hatch.envs.test]
153-
dependencies = [
154-
"numpy~={matrix:numpy}",
155-
]
156161
features = ["test"]
157162

158163
[tool.hatch.envs.test.env-vars]
@@ -163,7 +168,6 @@ COV_CORE_DATAFILE = ".coverage.eager"
163168

164169
[[tool.hatch.envs.test.matrix]]
165170
python = ["3.11", "3.12", "3.13"]
166-
numpy = ["1.26", "2.2"]
167171
deps = ["minimal", "optional"]
168172

169173
[tool.hatch.envs.test.overrides]
@@ -175,28 +179,27 @@ matrix.deps.dependencies = [
175179
run-coverage = "pytest --cov-config=pyproject.toml --cov=src --cov-append --cov-report xml --junitxml=junit.xml -o junit_family=legacy"
176180
run-coverage-html = "pytest --cov-config=pyproject.toml --cov=src --cov-append --cov-report html"
177181
run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pyproject.toml --cov=src --cov-append --cov-report xml --junitxml=junit.xml -o junit_family=legacy"
178-
run = "run-coverage --no-cov"
182+
run = "run-coverage --no-cov --ignore tests/benchmarks"
179183
run-pytest = "run"
180184
run-verbose = "run-coverage --verbose"
181185
run-mypy = "mypy src"
182186
run-hypothesis = "run-coverage -nauto --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful*"
187+
run-benchmark = "pytest --benchmark-enable tests/benchmarks"
183188
list-env = "pip list"
184189

185190
[tool.hatch.envs.gputest]
186191
template = "test"
187192
dependencies = [
188-
"numpy~={matrix:numpy}",
189193
"universal_pathlib",
190194
]
191195
features = ["test", "gpu"]
192196

193197
[[tool.hatch.envs.gputest.matrix]]
194198
python = ["3.11", "3.12", "3.13"]
195-
numpy = ["1.26", "2.2"]
196199
version = ["minimal"]
197200

198201
[tool.hatch.envs.gputest.scripts]
199-
run-coverage = "pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy"
202+
run-coverage = "pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy --ignore tests/benchmarks"
200203
run = "run-coverage --no-cov"
201204
run-verbose = "run-coverage --verbose"
202205
run-mypy = "mypy src"
@@ -234,7 +237,7 @@ python = "3.11"
234237
dependencies = [
235238
'zarr[remote]',
236239
'packaging==22.*',
237-
'numpy==1.26.*',
240+
'numpy==2.0.*',
238241
'numcodecs==0.14.*', # 0.14 needed for zarr3 codecs
239242
'fsspec==2023.10.0',
240243
's3fs==2023.10.0',
@@ -405,7 +408,10 @@ doctest_optionflags = [
405408
"IGNORE_EXCEPTION_DETAIL",
406409
]
407410
addopts = [
408-
"--durations=10", "-ra", "--strict-config", "--strict-markers",
411+
"--benchmark-columns", "min,mean,stddev,outliers,rounds,iterations",
412+
"--benchmark-disable", # benchmark routines run as tests without benchmarking instrumentation
413+
"--durations", "10",
414+
"-ra", "--strict-config", "--strict-markers",
409415
]
410416
filterwarnings = [
411417
"error",

0 commit comments

Comments
 (0)