Skip to content

Commit 45bd872

Browse files
Update Python version requirements, and document. (#187)
* Update Python version requirements, and document. * Test with Iris release, in place of latest-main. * Fiddle with tests matrix. * More cautious availablility checking for zarr remote access test. * Revise statement of Iris test version. * Skip zarr3 files if zarr<3 in env. * Check xarray conversion does not copy, in a way which supports older versions of xarray. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0bd70c0 commit 45bd872

File tree

5 files changed

+44
-19
lines changed

5 files changed

+44
-19
lines changed

.github/workflows/ci-tests.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
session: ["tests", "doctests-docs", "doctests-api"]
29-
python-version: ["3.12", "3.13"]
29+
python-version: ["3.10", "3.11", "3.12", "3.13"]
30+
exclude:
31+
- session: "doctests-docs"
32+
python-version: "3.10"
33+
- session: "doctests-docs"
34+
python-version: "3.11"
35+
- session: "doctests-docs"
36+
python-version: "3.12"
37+
- session: "doctests-api"
38+
python-version: "3.10"
39+
- session: "doctests-api"
40+
python-version: "3.11"
41+
- session: "doctests-api"
42+
python-version: "3.12"
43+
3044
defaults:
3145
run:
3246
shell: bash -l {0}
@@ -51,13 +65,6 @@ jobs:
5165
run: |
5266
conda install --yes numpy pytest pytest-mock iris xarray filelock requests zarr aiohttp fsspec
5367
54-
- name: "Install *latest* Iris"
55-
run: |
56-
git clone https://github.com/SciTools/iris.git ./iris
57-
cd iris
58-
pip install -e .
59-
cd ..
60-
6168
- name: "Install repo-under-test"
6269
run: |
6370
python -m pip install --no-deps --editable .

docs/details/interface_support.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
.. _interface_support:
22

3-
Support for Interface Packages
4-
==============================
3+
Support for Interfaces and Dependencies
4+
=======================================
5+
6+
Python Compatibility
7+
--------------------
8+
NcData currently supports Python >= 3.10, and is tested against 3.10, 3.11, 3.12 and 3.13.
59

610
NetCDF4 Compatibility
711
---------------------
@@ -94,10 +98,10 @@ masked data to NaNs.
9498
See : `issue#66 <https://github.com/pp-mo/ncdata/issues/66>`_
9599

96100

97-
Iris Features
98-
-------------
101+
Iris Compatibility
102+
------------------
99103
The `Continuous Integration testing on GitHub`_ tests against the
100-
latest-current "main" branch of Iris.
104+
latest release of Iris.
101105

102106
Ncdata is compatible with iris >= v3.7.0
103107
see : `support added in v3.7.0 <https://scitools-iris.readthedocs.io/en/stable/whatsnew/3.7.html#internal>`_

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authors = [
1414
{name = "Patrick Peglar", email = "[email protected]"},
1515
]
1616
description = "Abstract NetCDF data objects, providing fast data transfer between analysis packages."
17-
requires-python = ">=3.7, <3.14"
17+
requires-python = ">=3.10"
1818
keywords = [
1919
"cf-metadata",
2020
"data-analysis",
@@ -33,9 +33,6 @@ classifiers = [
3333
"Operating System :: Unix",
3434
"Programming Language :: Python",
3535
"Programming Language :: Python :: 3 :: Only",
36-
"Programming Language :: Python :: 3.7",
37-
"Programming Language :: Python :: 3.8",
38-
"Programming Language :: Python :: 3.9",
3936
"Programming Language :: Python :: 3.10",
4037
"Programming Language :: Python :: 3.11",
4138
"Programming Language :: Python :: 3.12",

tests/integration/test_zarr_to_iris.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
import iris
88
import pytest
99
import xarray as xr
10+
import zarr
1011
from ncdata.iris_xarray import cubes_from_xarray as conversion_func
1112

13+
zarr_major_version = int(zarr.__version__.split(".")[0])
14+
1215

1316
def _return_kwargs():
1417
time_coder = xr.coders.CFDatetimeCoder(use_cftime=True)
@@ -51,6 +54,9 @@ def test_load_zarr2_local():
5154
_run_checks(cube)
5255

5356

57+
@pytest.mark.skipif(
58+
zarr_major_version < 3, reason="Zarr3 file not supported by zarr v2."
59+
)
5460
def test_load_zarr3_local():
5561
"""Test loading a Zarr3 store from local FS."""
5662
zarr_path = (
@@ -88,9 +94,17 @@ def _is_url_ok(url):
8894
"https://uor-aces-o.s3-ext.jc.rl.ac.uk/"
8995
"esmvaltool-zarr/pr_Amon_CNRM-ESM2-1_02Kpd-11_r1i1p2f2_gr_200601-220112.zarr3"
9096
)
91-
_S3_accessible = _is_url_ok(S3_TEST_PATH)
9297

98+
# Check 3 files, as we apparently sometimes get 'partial success'
99+
_S3_accessible = all(
100+
_is_url_ok(S3_TEST_PATH + subpath)
101+
for subpath in ["", "/.zattrs", "/.zmetadata"]
102+
)
93103

104+
105+
@pytest.mark.skipif(
106+
zarr_major_version < 3, reason="Zarr3 file not supported by zarr v2."
107+
)
94108
@pytest.mark.skipif(not _S3_accessible, reason="S3 url not accessible")
95109
def test_load_remote_zarr():
96110
"""Test loading a remote Zarr store.

tests/unit/xarray/test_to_xarray.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ def test_real_nocopy():
6161

6262
# Check that the data content is the *SAME ARRAY*
6363
xr_data = xrds.variables["var_x"]._data
64-
assert xr_data is real_numpy_data
64+
# There may be a wrapper object, for some versions of xarray,
65+
# so test by modifying the original + check that the result tracks it.
66+
real_numpy_data[-1] = 777
67+
assert np.all(xr_data == real_numpy_data)
6568

6669

6770
@pytest.mark.parametrize("scaleandoffset", ["WITHscaling", "NOscaling"])

0 commit comments

Comments
 (0)