Skip to content
Draft

Abi3 #216

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ updates:
groups:
github-actions:
patterns:
- '*'
- '*'
cooldown:
default-days: 4
4 changes: 2 additions & 2 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels"
uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0
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
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-ast
- id: debug-statements
Expand All @@ -20,18 +20,18 @@ repos:
- --ignore-words-list=nin,preformed,wih,

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.6.0
rev: v2.11.1
hooks:
- id: pyproject-fmt


- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.12.7
rev: v0.14.6
hooks:
- id: ruff

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.11.0
rev: v1.17.0
hooks:
- id: zizmor

Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ 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.9"
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",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
]
dynamic = [
Expand All @@ -45,7 +45,6 @@ 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" ]
Expand Down
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
26 changes: 13 additions & 13 deletions src/method_bodies.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ 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);
if (PyArray_DIM(ct_a, 0) != n_levels || PyArray_DIM(p_a, 0) != n_levels)
{
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),
Expand All @@ -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;
Expand Down
Loading