Skip to content

Commit 0067909

Browse files
authored
Drop support for Python 3.9 (#584)
Bump latest supported version of Python to 3.10. Run tests under "latest" with Python 3.13. Python 3.9 reaches EOL by 31 Oct 2025. Bump minimum required version of Numba to v0.56 and of sklearn to v1.1. Address some small Ruff complains after bumping minimum supported version of Python.
1 parent 818dedc commit 0067909

File tree

9 files changed

+21
-22
lines changed

9 files changed

+21
-22
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ jobs:
4646
- optional
4747
include:
4848
- dependencies: oldest
49-
python: "3.9"
49+
python: "3.10"
5050
- dependencies: latest
51-
python: "3.12"
51+
python: "3.13"
5252
- dependencies: optional
53-
python: "3.12"
53+
python: "3.13"
5454
# test on macos-13 (x86) using oldest dependencies and python 3.8
5555
- os: macos-13
5656
dependencies: oldest
57-
python: "3.9"
57+
python: "3.10"
5858
exclude:
5959
# don't test on macos-latest (arm64) with oldest dependencies
6060
- os: macos-latest

harmonica/_equivalent_sources/gradient_boosted.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def _create_windows(self, coordinates, shuffle=True):
368368
# Remove empty windows
369369
source_windows_nonempty = []
370370
data_windows_nonempty = []
371-
for src, data in zip(source_windows, data_windows):
371+
for src, data in zip(source_windows, data_windows, strict=True):
372372
if src.size > 0 and data.size > 0:
373373
source_windows_nonempty.append(src)
374374
data_windows_nonempty.append(data)

harmonica/_io/icgem_gdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def load_icgem_gdf(fname, **kwargs):
4444
"""
4545
rawdata, metadata = _read_gdf_file(fname, **kwargs)
4646
shape = (int(metadata["latitude_parallels"]), int(metadata["longitude_parallels"]))
47-
data = dict(zip(metadata["attributes"], rawdata))
47+
data = dict(zip(metadata["attributes"], rawdata, strict=True))
4848
coords = {
4949
"longitude": data["longitude"].reshape(shape)[0, :],
5050
"latitude": data["latitude"].reshape(shape)[:, 0][::-1],

harmonica/tests/test_prism_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def test_to_pyvista(dummy_layer, properties, drop_null_prisms):
430430
assert pv_grid.n_cells == 20
431431
assert pv_grid.n_points == 20 * 8
432432
# Check coordinates of prisms
433-
for prism, cell in zip(layer.prism_layer._to_prisms(), pv_grid.cell):
433+
for prism, cell in zip(layer.prism_layer._to_prisms(), pv_grid.cell, strict=True):
434434
npt.assert_allclose(prism, cell.bounds)
435435
# Check properties of the prisms
436436
if properties is None:

harmonica/tests/test_tesseroid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,8 @@ def test_spherical_shell_two_dim_adaptive_discret(
706706
# Define boundary coordinates of each tesseroid
707707
top = ellipsoid.mean_radius
708708
bottom = top - thickness
709-
for w, e in zip(west, east):
710-
for s, n in zip(south, north):
709+
for w, e in zip(west, east, strict=True):
710+
for s, n in zip(south, north, strict=False):
711711
tesseroids.append([w, e, s, n, bottom, top])
712712
# Get analytical solutions
713713
analytical = spherical_shell_analytical(top, bottom, density, radius)
@@ -748,8 +748,8 @@ def test_spherical_shell_three_dim_adaptive_discret(thickness, field):
748748
latitude = np.linspace(-90, 90, shape[1] + 1)
749749
west, east = longitude[:-1], longitude[1:]
750750
south, north = latitude[:-1], latitude[1:]
751-
for w, e in zip(west, east):
752-
for s, n in zip(south, north):
751+
for w, e in zip(west, east, strict=False):
752+
for s, n in zip(south, north, strict=False):
753753
tesseroids.append([w, e, s, n, bottom, top])
754754
# Get analytical solutions
755755
analytical = spherical_shell_analytical(top, bottom, density, radius)

harmonica/tests/test_tesseroid_variable_density.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ def test_single_density_based_discretization(
237237
assert len(tesseroids) == 2
238238
# Check the horizontal coordinates of the tesseroids
239239
for tess in tesseroids:
240-
for coord, original_coord in zip(tess[:4], tesseroid):
241-
npt.assert_allclose(coord, original_coord)
240+
npt.assert_allclose(tess[:4], tesseroid[:4])
242241

243242
# Check the radial coordinates
244243
# ----------------------------
@@ -429,8 +428,8 @@ def build_spherical_shell(bottom, top, shape=(6, 12)):
429428
west, east = longitude[:-1], longitude[1:]
430429
south, north = latitude[:-1], latitude[1:]
431430
tesseroids = []
432-
for w, e in zip(west, east):
433-
for s, n in zip(south, north):
431+
for w, e in zip(west, east, strict=False):
432+
for s, n in zip(south, north, strict=False):
434433
tesseroids.append([w, e, s, n, bottom, top])
435434
return tesseroids
436435

harmonica/tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
@pytest.mark.parametrize(
39-
("angles", "vector"), [(a, v) for a, v in zip(ANGLES, VECTORS)]
39+
("angles", "vector"), [(a, v) for a, v in zip(ANGLES, VECTORS, strict=True)]
4040
)
4141
def test_magnetic_ang_to_vec_float(angles, vector):
4242
"""
@@ -53,7 +53,7 @@ def test_magnetic_ang_to_vec_float(angles, vector):
5353

5454
@pytest.mark.parametrize("degrees", [False, True], ids=("radians", "degrees"))
5555
@pytest.mark.parametrize(
56-
("angles", "vector"), [(a, v) for a, v in zip(ANGLES, VECTORS)]
56+
("angles", "vector"), [(a, v) for a, v in zip(ANGLES, VECTORS, strict=False)]
5757
)
5858
def test_magnetic_vec_to_angles_float(angles, vector, degrees):
5959
"""

harmonica/tests/test_visualizations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_prism_to_pyvista(prisms, density):
7979
assert pv_grid.n_cells == 4
8080
assert pv_grid.n_points == 32
8181
# Check coordinates of prisms
82-
for prism, cell in zip(prisms, pv_grid.cell):
82+
for prism, cell in zip(prisms, pv_grid.cell, strict=True):
8383
npt.assert_allclose(prism, cell.bounds)
8484
# Check properties of the prisms
8585
assert pv_grid.n_arrays == 1

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ classifiers = [
2222
"Topic :: Scientific/Engineering",
2323
"Topic :: Software Development :: Libraries",
2424
"Programming Language :: Python :: 3 :: Only",
25-
"Programming Language :: Python :: 3.9",
2625
"Programming Language :: Python :: 3.10",
2726
"Programming Language :: Python :: 3.11",
2827
"Programming Language :: Python :: 3.12",
28+
"Programming Language :: Python :: 3.13",
2929
]
30-
requires-python = ">=3.9"
30+
requires-python = ">=3.10"
3131
dependencies = [
3232
"numpy >= 1.23",
3333
"pandas >= 1.4",
3434
"scipy >= 1.9",
35-
"scikit-learn >= 1.0",
36-
"numba >= 0.53",
35+
"scikit-learn >= 1.1",
36+
"numba >= 0.57",
3737
"xarray >= 2022.03",
3838
"verde >= 1.8.1",
3939
"xrft >= 1.0",

0 commit comments

Comments
 (0)