Skip to content

Commit 198cc4e

Browse files
authored
Merge pull request TEOS-10#216 from ocefpaf/abi3
Implement ABI3 wheels
2 parents 1ddb79f + 9a698bc commit 198cc4e

File tree

5 files changed

+35
-32
lines changed

5 files changed

+35
-32
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels"
3737
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
3838
env:
39-
# Skips pypy and musllinux for now.
40-
CIBW_SKIP: "pp* cp36-* cp37-* cp38-* *-musllinux*"
39+
CIBW_SKIP: "*-musllinux*"
40+
CIBW_BUILD: "cp311-* cp314-*"
4141
CIBW_ARCHS: ${{ matrix.arch }}
4242
CIBW_BUILD_FRONTEND: build
4343
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28

.github/workflows/tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
17+
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
1818
os: [ windows-latest, ubuntu-latest, macos-latest ]
19-
# https://scientific-python.org/specs/spec-0000/
20-
numpy-version: ["==1.24", ">=2"]
21-
exclude:
22-
- python-version: "3.12"
23-
numpy-version: "==1.24"
2419
fail-fast: false
2520

2621
steps:

pyproject.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
build-backend = "setuptools.build_meta"
33
requires = [
44
"build",
5-
"numpy>=2.0.0rc1,<3; python_version>='3.9'",
6-
"oldest-supported-numpy; python_version<'3.9'",
5+
"numpy>=2,<3",
76
"pip>9.0.1",
87
"setuptools>=42",
98
"setuptools-scm[toml]>=3.4",
@@ -13,21 +12,18 @@ requires = [
1312
[project]
1413
name = "gsw"
1514
description = "Gibbs Seawater Oceanographic Package of TEOS-10"
16-
license = { text = "BSD-3-Clause" }
15+
license = "BSD-3-Clause"
16+
license-files = [ "LICENSE.txt" ]
1717
authors = [
1818
{ name = "Eric Firing, Filipe Fernandes", email = "[email protected]" },
1919
]
20-
requires-python = ">=3.8"
20+
requires-python = ">=3.11"
2121
classifiers = [
2222
"Development Status :: 5 - Production/Stable",
2323
"Intended Audience :: Science/Research",
24-
"License :: OSI Approved :: BSD License",
2524
"Operating System :: OS Independent",
2625
"Programming Language :: Python",
2726
"Programming Language :: Python :: 3 :: Only",
28-
"Programming Language :: Python :: 3.8",
29-
"Programming Language :: Python :: 3.9",
30-
"Programming Language :: Python :: 3.10",
3127
"Programming Language :: Python :: 3.11",
3228
"Programming Language :: Python :: 3.12",
3329
"Programming Language :: Python :: 3.13",
@@ -39,14 +35,13 @@ dynamic = [
3935
"version",
4036
]
4137
dependencies = [
42-
"numpy>=1.21",
38+
"numpy>=2",
4339
]
4440
urls.documentation = "https://teos-10.github.io/GSW-Python/"
4541
urls.homepage = "https://www.teos-10.org/"
4642
urls.repository = "https://github.com/TEOS-10/GSW-python"
4743

4844
[tool.setuptools]
49-
license-files = [ "LICENSE.txt" ]
5045
zip-safe = false
5146
include-package-data = true
5247
packages = [ "gsw", "gsw.tests" ]

setup.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
rootpath = os.path.abspath(os.path.dirname(__file__))
1515

1616

17+
DEFINE_MACROS = [
18+
("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
19+
# 0x030B0000 -> 3.11
20+
("Py_LIMITED_API", "0x030B0000"),
21+
("CYTHON_LIMITED_API", None),
22+
]
23+
1724
def read(*parts):
1825
return open(os.path.join(rootpath, *parts)).read()
1926

@@ -49,9 +56,15 @@ def build_extensions(self):
4956
]
5057

5158
config = {
52-
"ext_modules": [Extension("gsw._gsw_ufuncs", ufunc_src_list)],
59+
"ext_modules": [
60+
Extension(
61+
"gsw._gsw_ufuncs",
62+
ufunc_src_list,
63+
define_macros=DEFINE_MACROS,
64+
py_limited_api=True)],
5365
"include_dirs": [os.path.join(rootpath, "src", "c_gsw")],
5466
"cmdclass": {"build_ext": build_ext},
67+
"options": {"bdist_wheel": {"py_limited_api": "cp311"}},
5568
}
5669

5770
setup(**config)

src/method_bodies.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,32 @@ geo_strf_dyn_height(PyObject *NPY_UNUSED(self), PyObject *args)
2626
ct_a = (PyArrayObject *)PyArray_ContiguousFromAny(ct_o, NPY_DOUBLE, 1, 1);
2727
if (ct_a == NULL)
2828
{
29-
Py_XDECREF(sa_a);
29+
Py_XDECREF((PyObject *)sa_a);
3030
return NULL;
3131
}
3232
p_a = (PyArrayObject *)PyArray_ContiguousFromAny(p_o, NPY_DOUBLE, 1, 1);
3333
if (p_a == NULL)
3434
{
35-
Py_XDECREF(sa_a);
36-
Py_XDECREF(ct_a);
35+
Py_XDECREF((PyObject *)sa_a);
36+
Py_XDECREF((PyObject *)ct_a);
3737
return NULL;
3838
}
3939
n_levels = PyArray_DIM(sa_a, 0);
4040
if (PyArray_DIM(ct_a, 0) != n_levels || PyArray_DIM(p_a, 0) != n_levels)
4141
{
4242
PyErr_SetString(PyExc_ValueError,
4343
"Arguments SA, CT, and p must have the same dimensions.");
44-
Py_XDECREF(sa_a);
45-
Py_XDECREF(ct_a);
46-
Py_XDECREF(p_a);
44+
Py_XDECREF((PyObject *)sa_a);
45+
Py_XDECREF((PyObject *)ct_a);
46+
Py_XDECREF((PyObject *)p_a);
4747
return NULL;
4848
}
4949
dh_a = (PyArrayObject *)PyArray_NewLikeArray(sa_a, NPY_CORDER, NULL, 0);
5050
if (dh_a == NULL)
5151
{
52-
Py_XDECREF(sa_a);
53-
Py_XDECREF(ct_a);
54-
Py_XDECREF(p_a);
52+
Py_XDECREF((PyObject *)sa_a);
53+
Py_XDECREF((PyObject *)ct_a);
54+
Py_XDECREF((PyObject *)p_a);
5555
return NULL;
5656
}
5757
ret = gsw_geo_strf_dyn_height((double *)PyArray_DATA(sa_a),
@@ -60,15 +60,15 @@ geo_strf_dyn_height(PyObject *NPY_UNUSED(self), PyObject *args)
6060
p_ref,
6161
n_levels,
6262
(double *)PyArray_DATA(dh_a));
63-
Py_XDECREF(sa_a);
64-
Py_XDECREF(ct_a);
65-
Py_XDECREF(p_a);
63+
Py_XDECREF((PyObject *)sa_a);
64+
Py_XDECREF((PyObject *)ct_a);
65+
Py_XDECREF((PyObject *)p_a);
6666

6767
if (ret == NULL)
6868
{
6969
PyErr_SetString(PyExc_RuntimeError,
7070
"gws_geo_strf_dyn_height failed; check input arguments");
71-
Py_XDECREF(dh_a);
71+
Py_XDECREF((PyObject *)dh_a);
7272
return NULL;
7373
}
7474
return (PyObject *)dh_a;

0 commit comments

Comments
 (0)