Skip to content

Commit 5e896fb

Browse files
authored
Merge pull request #308 from GeoStat-Framework/py314_support
support py313 and py314
2 parents e02baad + e1b01cf commit 5e896fb

File tree

9 files changed

+133
-81
lines changed

9 files changed

+133
-81
lines changed

.github/workflows/main.yml

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ jobs:
1616
source_check:
1717
name: source check
1818
runs-on: ubuntu-latest
19-
strategy:
20-
fail-fast: false
2119

2220
steps:
2321
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: "0"
2424

25-
- name: Set up Python 3.9
25+
- name: Set up Python 3.11
2626
uses: actions/setup-python@v5
2727
with:
28-
python-version: 3.9
28+
python-version: 3.11
2929

3030
- name: Install dependencies
3131
run: |
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: black check
3636
run: |
37-
python -m black --check --diff --color .
37+
python -m black --check --diff --color .
3838
3939
- name: isort check
4040
run: |
@@ -50,49 +50,48 @@ jobs:
5050
strategy:
5151
fail-fast: false
5252
matrix:
53-
# macos-13 is an intel runner, macos-14 is apple silicon
54-
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
53+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-15-intel, macos-latest] # windows-11-arm (no scipy)
5554

5655
steps:
5756
- uses: actions/checkout@v4
5857
with:
59-
fetch-depth: '0'
58+
fetch-depth: "0"
6059

6160
- name: Build wheels
62-
uses: pypa/cibuildwheel@v2.18.0
61+
uses: pypa/cibuildwheel@v3.2.1
6362
with:
64-
output-dir: dist
63+
output-dir: dist-wheel-${{ matrix.os }}
6564

66-
- uses: actions/upload-artifact@v3
65+
- uses: actions/upload-artifact@v4
6766
with:
68-
path: ./dist/*.whl
67+
name: dist-wheel-${{ matrix.os }}
68+
path: ./dist-wheel-${{ matrix.os }}/*.whl
6969

7070
build_sdist:
71-
name: sdist on ${{ matrix.os }} with py ${{ matrix.ver.py }} numpy${{ matrix.ver.np }} scipy${{ matrix.ver.sp }}
71+
name: sdist on ${{ matrix.os }} with py==${{ matrix.ver.py }} numpy${{ matrix.ver.np }} scipy${{ matrix.ver.sp }} sklearn${{ matrix.ver.sk }}
7272
runs-on: ${{ matrix.os }}
7373
strategy:
7474
fail-fast: false
7575
matrix:
76-
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
77-
# https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
76+
os:
77+
[ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-14]
7878
ver:
79-
- {py: '3.8', np: '==1.20.0', sp: '==1.5.4'}
80-
- {py: '3.9', np: '==1.20.0', sp: '==1.5.4'}
81-
- {py: '3.10', np: '==1.21.6', sp: '==1.7.2'}
82-
- {py: '3.11', np: '==1.23.2', sp: '==1.9.2'}
83-
- {py: '3.12', np: '==1.26.2', sp: '==1.11.2'}
84-
- {py: '3.12', np: '>=2.0.0rc1', sp: '>=1.13.0'}
79+
- { py: "3.9", np: "==1.20.0", sp: "==1.5.4", sk: "==0.24.0" }
80+
- { py: "3.10", np: "==1.21.6", sp: "==1.7.2", sk: "==1.0.2" }
81+
- { py: "3.11", np: "==1.23.2", sp: "==1.9.2", sk: "==1.1.3" }
82+
- { py: "3.12", np: "==1.26.2", sp: "==1.11.2", sk: "==1.3.1" }
83+
- { py: "3.13", np: "==2.1.0", sp: "==1.14.1", sk: "==1.5.2" }
84+
- { py: "3.14", np: "==2.3.2", sp: "==1.16.1", sk: "==1.7.2" }
85+
- { py: "3.14", np: ">=2.3.2", sp: ">=1.16.1", sk: ">=1.7.2" }
8586
exclude:
8687
- os: macos-14
87-
ver: {py: '3.8', np: '==1.20.0', sp: '==1.5.4'}
88-
- os: macos-14
89-
ver: {py: '3.9', np: '==1.20.0', sp: '==1.5.4'}
88+
ver: { py: "3.9", np: "==1.20.0", sp: "==1.5.4", sk: "==0.24.0" }
9089
- os: macos-14
91-
ver: {py: '3.10', np: '==1.21.6', sp: '==1.7.2'}
90+
ver: { py: "3.10", np: "==1.21.6", sp: "==1.7.2", sk: "==1.0.2" }
9291
steps:
9392
- uses: actions/checkout@v4
9493
with:
95-
fetch-depth: '0'
94+
fetch-depth: "0"
9695

9796
- name: Set up Python ${{ matrix.ver.py }}
9897
uses: actions/setup-python@v5
@@ -102,41 +101,74 @@ jobs:
102101
- name: Install dependencies
103102
run: |
104103
python -m pip install --upgrade pip
105-
pip install build "coveralls>=3.0.0"
104+
pip install build
106105
107-
- name: Install PyKrige
106+
- name: Install pykrige
108107
run: |
109108
pip install -v --editable .[test]
110109
110+
- name: Install pinned dependencies
111+
run: |
112+
pip install "numpy${{ matrix.ver.np }}" "scipy${{ matrix.ver.sp }}" "scikit-learn${{ matrix.ver.sk }}"
113+
111114
- name: Run tests
112-
env:
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114115
run: |
115-
pip install "numpy${{ matrix.ver.np }}" "scipy${{ matrix.ver.sp }}"
116-
python -m pytest --cov pykrige --cov-report term-missing -v tests/
117-
python -m coveralls --service=github
116+
python -m pytest -v tests/
118117
119118
- name: Build sdist
120119
run: |
121120
# PEP 517 package builder from pypa
122-
python -m build --sdist --outdir dist .
121+
python -m build --sdist --outdir dist-sdist .
123122
124-
- uses: actions/upload-artifact@v3
125-
if: matrix.os == 'ubuntu-latest' && matrix.ver.py == '3.9'
123+
- uses: actions/upload-artifact@v4
124+
if: matrix.os == 'ubuntu-latest' && matrix.ver.py == '3.11'
126125
with:
127-
path: dist/*.tar.gz
126+
name: dist-sdist
127+
path: dist-sdist/*.tar.gz
128+
129+
coverage:
130+
name: coverage
131+
runs-on: ubuntu-latest
132+
steps:
133+
- uses: actions/checkout@v4
134+
with:
135+
fetch-depth: '0'
136+
137+
- name: Set up Python 3.11
138+
uses: actions/setup-python@v5
139+
with:
140+
python-version: 3.11
141+
142+
- name: Install dependencies
143+
run: |
144+
python -m pip install --upgrade pip
145+
pip install "coveralls>=3.0.0"
146+
147+
- name: Install pykrige
148+
run: |
149+
pip install -v --editable .[test]
150+
151+
- name: Run tests
152+
env:
153+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
run: |
155+
pip install "numpy${{ matrix.ver.np }}"
156+
python -m pytest --cov pykrige --cov-report term-missing -v tests/
157+
python -m coveralls --service=github
128158
129159
upload_to_pypi:
130160
needs: [build_wheels, build_sdist]
131161
runs-on: ubuntu-latest
132162

133163
steps:
134-
- uses: actions/download-artifact@v2
164+
- uses: actions/download-artifact@v4
135165
with:
136-
name: artifact
166+
pattern: dist-*
167+
merge-multiple: true
137168
path: dist
138169

139170
- name: Publish to Test PyPI
171+
# only if working on main
140172
if: github.ref == 'refs/heads/main'
141173
uses: pypa/gh-action-pypi-publish@release/v1
142174
with:

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ Changelog
22
=========
33

44

5+
Version 1.7.3
6+
-------------
7+
*October 16, 2025*
8+
9+
See [#308](https://github.com/GeoStat-Framework/PyKrige/pull/308)
10+
11+
**Changes**
12+
13+
* add wheels for Python 3.13 and 3.14 as well as for Linux aarch64
14+
* pin the earliest supported scikit-learn release alongside NumPy/SciPy in the sdist CI
15+
* allow the housing-based classification/regression tests to attempt loading the California housing dataset and skip cleanly when the download fails
16+
17+
**Bug fixes**
18+
19+
* prevent `ValueError` from NumPy when pseudo inverse kriging statistics encounter duplicate coordinates by keeping distance vectors 1-D
20+
21+
522
Version 1.7.2
623
-------------
724
*May 27, 2024*

examples/05_kriging_1D.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
An example of 1D kriging with PyKrige
66
"""
7+
78
import matplotlib.pyplot as plt
89
import numpy as np
910

examples/06_exact_values_example_1D.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
============
55
66
PyKrige demonstration and usage
7-
as a non-exact interpolator in 1D.
7+
as a non-exact interpolator in 1D.
88
"""
99

1010
import matplotlib.pyplot as plt

pyproject.toml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[build-system]
22
requires = [
3-
"setuptools>=64",
4-
"setuptools_scm>=7",
5-
"numpy>=2.0.0rc1,<2.3; python_version >= '3.9'",
6-
"scipy>=1.13.0,<2; python_version >= '3.9'",
7-
"oldest-supported-numpy; python_version < '3.9'",
8-
"scipy>=1.3.2,<2; python_version < '3.9'",
9-
"Cython>=3.0.10,<3.1.0",
3+
"setuptools>=77",
4+
"wheel",
5+
"Cython>=3",
6+
"numpy>=2",
7+
"scipy>=1.5.4",
8+
"pentapy>=1.1.0,<2",
9+
"setuptools_scm[toml]>=7",
1010
]
1111
build-backend = "setuptools.build_meta"
1212

1313
[project]
14-
requires-python = ">=3.8"
14+
requires-python = ">=3.9"
1515
name = "PyKrige"
1616
description = "Kriging Toolkit for Python."
1717
authors = [
@@ -21,26 +21,27 @@ maintainers = [
2121
{name = "Sebastian Müller, Roman Yurchak", email = "[email protected]"},
2222
]
2323
readme = "README.md"
24-
license = {text = "BSD-3-Clause"}
24+
license = "BSD-3-Clause"
25+
license-files = ["LICENSE"]
2526
dynamic = ["version"]
2627
classifiers = [
2728
"Development Status :: 5 - Production/Stable",
2829
"Intended Audience :: Developers",
2930
"Intended Audience :: End Users/Desktop",
3031
"Intended Audience :: Science/Research",
31-
"License :: OSI Approved :: BSD License",
3232
"Natural Language :: English",
3333
"Operating System :: Unix",
3434
"Operating System :: Microsoft",
3535
"Operating System :: MacOS",
3636
"Programming Language :: Python",
3737
"Programming Language :: Python :: 3",
3838
"Programming Language :: Python :: 3 :: Only",
39-
"Programming Language :: Python :: 3.8",
4039
"Programming Language :: Python :: 3.9",
4140
"Programming Language :: Python :: 3.10",
4241
"Programming Language :: Python :: 3.11",
4342
"Programming Language :: Python :: 3.12",
43+
"Programming Language :: Python :: 3.13",
44+
"Programming Language :: Python :: 3.14",
4445
"Topic :: Scientific/Engineering",
4546
"Topic :: Scientific/Engineering :: GIS",
4647
"Topic :: Scientific/Engineering :: Mathematics",
@@ -49,7 +50,7 @@ classifiers = [
4950
]
5051
dependencies = [
5152
"numpy>=1.20.0",
52-
"scipy>=1.1.0,<2",
53+
"scipy>=1.5.4,<2",
5354
]
5455

5556
[project.optional-dependencies]
@@ -86,9 +87,6 @@ Homepage = "https://github.com/GeoStat-Framework/PyKrige"
8687
Source = "https://github.com/GeoStat-Framework/PyKrige"
8788
Tracker = "https://github.com/GeoStat-Framework/PyKrige/issues"
8889

89-
[tool.setuptools]
90-
license-files = ["LICENSE"]
91-
9290
[tool.setuptools_scm]
9391
write_to = "src/pykrige/_version.py"
9492
write_to_template = "__version__ = '{version}'"
@@ -155,8 +153,11 @@ max-line-length = 100
155153
[tool.cibuildwheel]
156154
# Switch to using build
157155
build-frontend = "build"
158-
# Disable building PyPy wheels on all platforms, 32bit and musllinux builds, py3.6/7
159-
skip = ["cp36-*", "cp37-*", "pp*", "*-win32", "*-manylinux_i686", "*-musllinux_*"]
156+
# Disable building py3.6/7/8, pp3.8, 32bit linux
157+
skip = ["*-win32", "*_i686", "*-musllinux_*", "cp31?t-*"]
160158
# Run the package tests using `pytest`
161159
test-extras = "test"
162160
test-command = "pytest -v {package}/tests"
161+
162+
environment.PIP_ONLY_BINARY = "numpy,scipy"
163+
environment.PIP_PREFER_BINARY = "1"

src/pykrige/core.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ def _krige(
700700
# measurement points (X) and the kriging point (coords)
701701
if coordinates_type == "euclidean":
702702
d = squareform(pdist(X, metric="euclidean"))
703-
bd = np.squeeze(cdist(X, coords[None, :], metric="euclidean"))
703+
bd = np.asarray(cdist(X, coords[None, :], metric="euclidean")).ravel()
704704

705705
# geographic coordinate distances still calculated in the old way...
706706
# assume X[:, 0] ('x') => lon, X[:, 1] ('y') => lat
@@ -709,12 +709,14 @@ def _krige(
709709
x1, x2 = np.meshgrid(X[:, 0], X[:, 0], sparse=True)
710710
y1, y2 = np.meshgrid(X[:, 1], X[:, 1], sparse=True)
711711
d = great_circle_distance(x1, y1, x2, y2)
712-
bd = great_circle_distance(
713-
X[:, 0],
714-
X[:, 1],
715-
coords[0] * np.ones(X.shape[0]),
716-
coords[1] * np.ones(X.shape[0]),
717-
)
712+
bd = np.asarray(
713+
great_circle_distance(
714+
X[:, 0],
715+
X[:, 1],
716+
coords[0] * np.ones(X.shape[0]),
717+
coords[1] * np.ones(X.shape[0]),
718+
)
719+
).ravel()
718720

719721
# this check is done when initializing variogram, but kept here anyways...
720722
else:
@@ -725,7 +727,7 @@ def _krige(
725727
# check if kriging point overlaps with measurement point
726728
if np.any(np.absolute(bd) <= 1e-10):
727729
zero_value = True
728-
zero_index = np.where(bd <= 1e-10)[0][0]
730+
zero_index = int(np.flatnonzero(bd <= 1e-10)[0])
729731

730732
# set up kriging matrix
731733
n = X.shape[0]

tests/test_classification_krige.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ def test_krige_classification_housing():
6969

7070
try:
7171
housing = fetch_california_housing()
72-
except (ssl.SSLError, urllib.error.URLError):
73-
ssl._create_default_https_context = ssl._create_unverified_context
74-
try:
75-
housing = fetch_california_housing()
76-
except PermissionError:
77-
# This can raise permission error on Appveyor
78-
pytest.skip("Failed to load california housing dataset")
79-
ssl._create_default_https_context = ssl.create_default_context
72+
except (
73+
ssl.SSLError,
74+
urllib.error.URLError,
75+
urllib.error.HTTPError,
76+
PermissionError,
77+
):
78+
pytest.skip("Failed to load california housing dataset")
8079

8180
# take only first 1000
8281
p = housing["data"][:1000, :-2]

tests/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Testing code.
33
Updated BSM February 2017
44
"""
5+
56
import os
67
import sys
78

0 commit comments

Comments
 (0)