diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 95d2064..2bc8882 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -36,8 +36,8 @@ jobs: - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1 env: - # Skips pypy and musllinux for now. - CIBW_SKIP: "pp* cp36-* cp37-* cp38-* *-musllinux*" + CIBW_SKIP: "*-musllinux*" + CIBW_BUILD: "cp311-* cp314-*" CIBW_ARCHS: ${{ matrix.arch }} CIBW_BUILD_FRONTEND: build CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7a3a92f..687d72c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,13 +14,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.11", "3.12", "3.13", "3.14" ] os: [ windows-latest, ubuntu-latest, macos-latest ] - # https://scientific-python.org/specs/spec-0000/ - numpy-version: ["==1.24", ">=2"] - exclude: - - python-version: "3.12" - numpy-version: "==1.24" fail-fast: false steps: diff --git a/pyproject.toml b/pyproject.toml index 93dd545..63d7b6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,8 +2,7 @@ build-backend = "setuptools.build_meta" requires = [ "build", - "numpy>=2.0.0rc1,<3; python_version>='3.9'", - "oldest-supported-numpy; python_version<'3.9'", + "numpy>=2,<3", "pip>9.0.1", "setuptools>=42", "setuptools-scm[toml]>=3.4", @@ -13,21 +12,18 @@ requires = [ [project] name = "gsw" description = "Gibbs Seawater Oceanographic Package of TEOS-10" -license = { text = "BSD-3-Clause" } +license = "BSD-3-Clause" +license-files = [ "LICENSE.txt" ] authors = [ { name = "Eric Firing, Filipe Fernandes", email = "efiring@hawaii.edu" }, ] -requires-python = ">=3.8" +requires-python = ">=3.11" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", @@ -39,14 +35,13 @@ dynamic = [ "version", ] dependencies = [ - "numpy>=1.21", + "numpy>=2", ] urls.documentation = "https://teos-10.github.io/GSW-Python/" urls.homepage = "https://www.teos-10.org/" urls.repository = "https://github.com/TEOS-10/GSW-python" [tool.setuptools] -license-files = [ "LICENSE.txt" ] zip-safe = false include-package-data = true packages = [ "gsw", "gsw.tests" ] diff --git a/setup.py b/setup.py index 4e08805..7effa8d 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,13 @@ rootpath = os.path.abspath(os.path.dirname(__file__)) +DEFINE_MACROS = [ + ("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"), + # 0x030B0000 -> 3.11 + ("Py_LIMITED_API", "0x030B0000"), + ("CYTHON_LIMITED_API", None), +] + def read(*parts): return open(os.path.join(rootpath, *parts)).read() @@ -49,9 +56,15 @@ def build_extensions(self): ] config = { - "ext_modules": [Extension("gsw._gsw_ufuncs", ufunc_src_list)], + "ext_modules": [ + Extension( + "gsw._gsw_ufuncs", + ufunc_src_list, + define_macros=DEFINE_MACROS, + py_limited_api=True)], "include_dirs": [os.path.join(rootpath, "src", "c_gsw")], "cmdclass": {"build_ext": build_ext}, + "options": {"bdist_wheel": {"py_limited_api": "cp311"}}, } setup(**config) diff --git a/src/method_bodies.c b/src/method_bodies.c index c4bf92b..0dec31f 100644 --- a/src/method_bodies.c +++ b/src/method_bodies.c @@ -26,14 +26,14 @@ geo_strf_dyn_height(PyObject *NPY_UNUSED(self), PyObject *args) ct_a = (PyArrayObject *)PyArray_ContiguousFromAny(ct_o, NPY_DOUBLE, 1, 1); if (ct_a == NULL) { - Py_XDECREF(sa_a); + Py_XDECREF((PyObject *)sa_a); return NULL; } p_a = (PyArrayObject *)PyArray_ContiguousFromAny(p_o, NPY_DOUBLE, 1, 1); if (p_a == NULL) { - Py_XDECREF(sa_a); - Py_XDECREF(ct_a); + Py_XDECREF((PyObject *)sa_a); + Py_XDECREF((PyObject *)ct_a); return NULL; } n_levels = PyArray_DIM(sa_a, 0); @@ -41,17 +41,17 @@ geo_strf_dyn_height(PyObject *NPY_UNUSED(self), PyObject *args) { PyErr_SetString(PyExc_ValueError, "Arguments SA, CT, and p must have the same dimensions."); - Py_XDECREF(sa_a); - Py_XDECREF(ct_a); - Py_XDECREF(p_a); + Py_XDECREF((PyObject *)sa_a); + Py_XDECREF((PyObject *)ct_a); + Py_XDECREF((PyObject *)p_a); return NULL; } dh_a = (PyArrayObject *)PyArray_NewLikeArray(sa_a, NPY_CORDER, NULL, 0); if (dh_a == NULL) { - Py_XDECREF(sa_a); - Py_XDECREF(ct_a); - Py_XDECREF(p_a); + Py_XDECREF((PyObject *)sa_a); + Py_XDECREF((PyObject *)ct_a); + Py_XDECREF((PyObject *)p_a); return NULL; } 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) p_ref, n_levels, (double *)PyArray_DATA(dh_a)); - Py_XDECREF(sa_a); - Py_XDECREF(ct_a); - Py_XDECREF(p_a); + Py_XDECREF((PyObject *)sa_a); + Py_XDECREF((PyObject *)ct_a); + Py_XDECREF((PyObject *)p_a); if (ret == NULL) { PyErr_SetString(PyExc_RuntimeError, "gws_geo_strf_dyn_height failed; check input arguments"); - Py_XDECREF(dh_a); + Py_XDECREF((PyObject *)dh_a); return NULL; } return (PyObject *)dh_a;