Skip to content

Commit d3ed2a9

Browse files
stephenworsleypre-commit-ci[bot]trexfeathers
authored
SPEC 0: drop py310 and support py313 (SciTools#6195)
* increase references to python version * refresh lockfiles * tweak asv.conf.json * revert to old xml behaviour * revert lockfile * recreate lockfile * unescape in assertXMLElement * unescape in assert_XML_Element * fix filename context * make unescaping more specific * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix xml printing * fix xml printing * fix benchmarks * undo benchmark removal * update asv commit hash * add docstring --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>
1 parent 5769d3b commit d3ed2a9

File tree

14 files changed

+146
-124
lines changed

14 files changed

+146
-124
lines changed

.github/workflows/ci-tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
os: ["ubuntu-latest"]
38-
python-version: ["3.12"]
38+
python-version: ["3.13"]
3939
session: ["doctest", "gallery", "linkcheck"]
4040
include:
4141
- os: "ubuntu-latest"
42-
python-version: "3.12"
42+
python-version: "3.13"
4343
session: "tests"
4444
coverage: "--coverage"
4545
- os: "ubuntu-latest"
46-
python-version: "3.11"
46+
python-version: "3.12"
4747
session: "tests"
4848
- os: "ubuntu-latest"
49-
python-version: "3.10"
49+
python-version: "3.11"
5050
session: "tests"
5151

5252
env:

.github/workflows/ci-wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
strategy:
5353
fail-fast: false
5454
matrix:
55-
python-version: ["3.10", "3.11", "3.12"]
55+
python-version: ["3.11", "3.12", "3.13"]
5656
session: ["wheel"]
5757
env:
5858
ENV_NAME: "ci-wheels"

benchmarks/bm_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _check_requirements(package: str) -> None:
6666

6767
def _prep_data_gen_env() -> None:
6868
"""Create or access a separate, unchanging environment for generating test data."""
69-
python_version = "3.12"
69+
python_version = "3.13"
7070
data_gen_var = "DATA_GEN_PYTHON"
7171
if data_gen_var in environ:
7272
echo("Using existing data generation environment.")

docs/src/whatsnew/latest.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ This document explains the changes made to Iris for this release
8080
🔗 Dependencies
8181
===============
8282

83-
#. N/A
84-
83+
#. `@stephenworsley`_ dropped support for ``py310`` and adopted support for ``py313``
84+
as per the `SPEC 0`_ schedule. (:pull:`6195`)
8585

8686
📚 Documentation
8787
================
@@ -125,3 +125,5 @@ This document explains the changes made to Iris for this release
125125

126126
.. comment
127127
Whatsnew resources in alphabetical order:
128+
129+
.. _SPEC 0: https://scientific-python.org/specs/spec-0000/

lib/iris/cube.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def xml(self, checksum=False, order=True, byteorder=True):
173173

174174
# return our newly created XML string
175175
doc = Cube._sort_xml_attrs(doc)
176-
return doc.toprettyxml(indent=" ")
176+
return iris.util._print_xml(doc)
177177

178178
def extract(self, constraints):
179179
"""Filter each of the cubes which can be filtered by the given constraints.
@@ -3782,7 +3782,7 @@ def xml(
37823782

37833783
# Print our newly created XML
37843784
doc = self._sort_xml_attrs(doc)
3785-
return doc.toprettyxml(indent=" ")
3785+
return iris.util._print_xml(doc)
37863786

37873787
def _xml_element(self, doc, checksum=False, order=True, byteorder=True):
37883788
cube_xml_element = doc.createElement("cube")

lib/iris/tests/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def assertXMLElement(self, obj, reference_filename):
562562
# this is to be compatible with stored test output where xml attrs are stored in alphabetical order,
563563
# (which was default behaviour in python <3.8, but changed to insert order in >3.8)
564564
doc = iris.cube.Cube._sort_xml_attrs(doc)
565-
pretty_xml = doc.toprettyxml(indent=" ")
565+
pretty_xml = iris.util._print_xml(doc)
566566
reference_path = self.get_result_path(reference_filename)
567567
self._check_same(pretty_xml, reference_path, type_comparison_name="XML")
568568

lib/iris/tests/_shared_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def assert_XML_element(obj, reference_filename):
555555
# this is to be compatible with stored test output where xml attrs are stored in alphabetical order,
556556
# (which was default behaviour in python <3.8, but changed to insert order in >3.8)
557557
doc = iris.cube.Cube._sort_xml_attrs(doc)
558-
pretty_xml = doc.toprettyxml(indent=" ")
558+
pretty_xml = iris.util._print_xml(doc)
559559
reference_path = get_result_path(reference_filename)
560560
_check_same(pretty_xml, reference_path, type_comparison_name="XML")
561561

lib/iris/tests/test_coding_standards.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def test_python_versions():
6969
Test is designed to fail whenever Iris' supported Python versions are
7070
updated, insisting that versions are updated EVERYWHERE in-sync.
7171
"""
72-
latest_supported = "3.12"
73-
all_supported = ["3.10", "3.11", latest_supported]
72+
latest_supported = "3.13"
73+
all_supported = ["3.11", "3.12", latest_supported]
7474

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

lib/iris/tests/test_util.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ def test_output_file(self, tmp_path):
235235
test_cube_a.standard_name = "relative_humidity"
236236
test_cube_a.units = cf_units.Unit("m")
237237

238-
with tmp_path / "tmp" as filename:
239-
with open(filename, "w") as f:
240-
iris.util.describe_diff(test_cube_a, test_cube_b, output_file=f)
241-
f.close()
238+
filename = tmp_path / "tmp"
239+
with open(filename, "w") as f:
240+
iris.util.describe_diff(test_cube_a, test_cube_b, output_file=f)
241+
f.close()
242242

243-
_shared_utils.assert_files_equal(filename, "incompatible_cubes.str.txt")
243+
_shared_utils.assert_files_equal(filename, "incompatible_cubes.str.txt")

lib/iris/util.py

+23
Original file line numberDiff line numberDiff line change
@@ -2320,3 +2320,26 @@ def equalise_cubes(
23202320
# Return a CubeList result = the *original* cubes, as modified
23212321
result = CubeList(cubes)
23222322
return result
2323+
2324+
2325+
def _print_xml(doc):
2326+
"""Print xml in a standard fashion.
2327+
2328+
Modifies :meth: `xml.dom.minidom.Document.toprettyxml` to maintain backwards
2329+
compatibilitiy with the way Iris expects arrays to be represented. Changes to
2330+
xml introduced with https://github.com/python/cpython/pull/107947 mean that
2331+
newlines in attributes are escaped by default. This reverts to the old behaviour
2332+
by replacing the escaped newlines with proper newlines.
2333+
2334+
Parameters
2335+
----------
2336+
doc : :class: `xml.dom.minidom.Document`
2337+
The xml document to be printed.
2338+
2339+
Returns
2340+
-------
2341+
str
2342+
Standard string representation of xml document.
2343+
"""
2344+
result = doc.toprettyxml(indent=" ")
2345+
return result.replace("&#10;", "\n")

noxfile.py

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

1717
#: Python versions we can run sessions under
18-
_PY_VERSIONS_ALL = ["3.10", "3.11", "3.12"]
18+
_PY_VERSIONS_ALL = ["3.11", "3.12", "3.13"]
1919
_PY_VERSION_LATEST = _PY_VERSIONS_ALL[-1]
2020

2121
#: One specific python version for docs builds

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ classifiers = [
2222
"Operating System :: Unix",
2323
"Programming Language :: Python",
2424
"Programming Language :: Python :: 3 :: Only",
25-
"Programming Language :: Python :: 3.10",
2625
"Programming Language :: Python :: 3.11",
2726
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2828
"Programming Language :: Python :: Implementation :: CPython",
2929
"Topic :: Scientific/Engineering",
3030
"Topic :: Scientific/Engineering :: Atmospheric Science",
@@ -50,7 +50,7 @@ keywords = [
5050
]
5151
license = {text = "BSD-3-Clause"}
5252
name = "scitools-iris"
53-
requires-python = ">=3.10"
53+
requires-python = ">=3.11"
5454

5555
[project.urls]
5656
Code = "https://github.com/SciTools/iris"

0 commit comments

Comments
 (0)