Skip to content

Commit d58fca7

Browse files
authored
Support Python 3.11 (#5226)
* support python311 * review actions
1 parent 619de4e commit d58fca7

File tree

16 files changed

+395
-98
lines changed

16 files changed

+395
-98
lines changed

.github/workflows/ci-tests.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
os: ["ubuntu-latest"]
38-
python-version: ["3.10"]
38+
python-version: ["3.11"]
3939
session: ["doctest", "gallery", "linkcheck"]
4040
include:
4141
- os: "ubuntu-latest"
42-
python-version: "3.10"
42+
python-version: "3.11"
4343
session: "tests"
4444
coverage: "--coverage"
45+
- os: "ubuntu-latest"
46+
python-version: "3.10"
47+
session: "tests"
4548
- os: "ubuntu-latest"
4649
python-version: "3.9"
4750
session: "tests"

.github/workflows/ci-wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
strategy:
5555
fail-fast: false
5656
matrix:
57-
python-version: ["3.8", "3.9", "3.10"]
57+
python-version: ["3.8", "3.9", "3.10", "3.11"]
5858
session: ["wheel"]
5959
env:
6060
ENV_NAME: "ci-wheels"

benchmarks/asv.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// * No build-time environment variables.
2020
// * Is run in the same environment as the ASV install itself.
2121
"delegated_env_commands": [
22-
"PY_VER=3.10 nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
22+
"PY_VER=3.11 nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
2323
],
2424
// The parent directory of the above environment.
2525
// The most recently modified environment in the directory will be used.

benchmarks/bm_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _prep_data_gen_env() -> None:
6060
"""
6161

6262
root_dir = BENCHMARKS_DIR.parent
63-
python_version = "3.10"
63+
python_version = "3.11"
6464
data_gen_var = "DATA_GEN_PYTHON"
6565
if data_gen_var in environ:
6666
print("Using existing data generation environment.")

docs/src/whatsnew/latest.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ This document explains the changes made to Iris for this release
6060
🔗 Dependencies
6161
===============
6262

63-
#. N/A
63+
#. `@rcomer`_ and `@bjlittle`_ (reviewer) added testing support for python
64+
3.11. (:pull:`5226`)
6465

6566

6667
📚 Documentation

lib/iris/tests/test_coding_standards.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def test_python_versions():
7171
This test is designed to fail whenever Iris' supported Python versions are
7272
updated, insisting that versions are updated EVERYWHERE in-sync.
7373
"""
74-
latest_supported = "3.10"
75-
all_supported = ["3.8", "3.9", latest_supported]
74+
latest_supported = "3.11"
75+
all_supported = ["3.8", "3.9", "3.10", latest_supported]
7676

7777
root_dir = Path(__file__).parents[3]
7878
workflows_dir = root_dir / ".github" / "workflows"

lib/iris/tests/unit/experimental/ugrid/mesh/test_Connectivity.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
# importing anything else.
1010
import iris.tests as tests # isort:skip
1111

12+
from platform import python_version
1213
from xml.dom import minidom
1314

1415
import numpy as np
1516
from numpy import ma
17+
from pkg_resources import parse_version
1618

1719
from iris._lazy_data import as_lazy_data, is_lazy_data
1820
from iris.experimental.ugrid.mesh import Connectivity
@@ -61,10 +63,14 @@ def test_indices(self):
6163

6264
def test_read_only(self):
6365
attributes = ("indices", "cf_role", "start_index", "location_axis")
66+
if parse_version(python_version()) >= parse_version("3.11"):
67+
msg = "object has no setter"
68+
else:
69+
msg = "can't set attribute"
6470
for attribute in attributes:
6571
self.assertRaisesRegex(
6672
AttributeError,
67-
"can't set attribute",
73+
msg,
6874
setattr,
6975
self.connectivity,
7076
attribute,

lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
# importing anything else.
1212
import iris.tests as tests # isort:skip
1313

14+
from platform import python_version
1415
import re
1516
import unittest.mock as mock
1617

1718
import dask.array as da
1819
import numpy as np
20+
from pkg_resources import parse_version
1921
import pytest
2022

2123
from iris._lazy_data import as_lazy_data, is_lazy_data
@@ -77,8 +79,12 @@ def setUp(self):
7779
def test_fixed_metadata(self):
7880
# Check that you cannot set any of these on an existing MeshCoord.
7981
meshcoord = self.meshcoord
82+
if parse_version(python_version()) >= parse_version("3.11"):
83+
msg = "object has no setter"
84+
else:
85+
msg = "can't set attribute"
8086
for prop in ("mesh", "location", "axis"):
81-
with self.assertRaisesRegex(AttributeError, "can't set"):
87+
with self.assertRaisesRegex(AttributeError, msg):
8288
setattr(meshcoord, prop, mock.sentinel.odd)
8389

8490
def test_coord_system(self):

noxfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
nox.options.reuse_existing_virtualenvs = True
1717

1818
#: Python versions we can run sessions under
19-
_PY_VERSIONS_ALL = ["3.8", "3.9", "3.10"]
19+
_PY_VERSIONS_ALL = ["3.8", "3.9", "3.10", "3.11"]
2020
_PY_VERSION_LATEST = _PY_VERSIONS_ALL[-1]
2121

2222
#: One specific python version for docs builds

requirements/iris.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
py310.yml
1+
py311.yml

0 commit comments

Comments
 (0)