Skip to content

Commit 4f0eb85

Browse files
authored
Merge pull request astropy#18236 from astrofrog/py-limited-api-build
Include a limited API build in CI, disabling incompatible extensions
2 parents 09795ab + ac799d5 commit 4f0eb85

4 files changed

Lines changed: 39 additions & 3 deletions

File tree

.github/workflows/ci_workflows.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,37 @@ jobs:
134134
test_command: pytest -p no:warnings --astropy-header -m "not hypothesis" -k "not test_data_out_of_range and not test_set_locale and not TestQuantityTyping" --pyargs astropy
135135
targets: |
136136
- cp311-manylinux_x86_64
137+
138+
139+
test_limited_api_build:
140+
141+
# Test to make sure that we can build astropy with the limited API
142+
# Currently, several extensions do not compile, so we remove them for
143+
# now to make sure the remaining ones build fine. Once all the exceptions
144+
# are removed, we can remove this job and instead opt in to the limited
145+
# API in one of the main build+test tox jobs.
146+
147+
runs-on: ubuntu-latest
148+
name: Python 3.11 (build only, partial) with limited API
149+
needs: [initial_checks]
150+
steps:
151+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
152+
with:
153+
persist-credentials: false
154+
fetch-depth: 0
155+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
156+
name: Install Python
157+
with:
158+
python-version: "3.11"
159+
- run: |
160+
rm \
161+
astropy/cosmology/_src/setup_package.py \
162+
astropy/table/_column_mixins.pyx \
163+
astropy/table/setup_package.py \
164+
astropy/utils/xml/setup_package.py \
165+
astropy/wcs/setup_package.py
166+
name: Remove incompatible extensions
167+
- run: pipx run build
168+
name: Run build
169+
env:
170+
EXTENSION_HELPERS_PY_LIMITED_API: 'cp311'

astropy/io/fits/hdu/compressed/src/compression.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <unquantize.h>
1010
#include <ricecomp.h>
1111

12+
/* The following is needed in order to avoid compilation warnings related to calloc() */
13+
#include <stdlib.h>
1214

1315
/* Define docstrings */
1416
static char module_docstring[] = "Core compression/decompression functions wrapped from cfitsio.";

astropy/io/votable/src/tablewriter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ write_tabledata(PyObject* self, PyObject *args, PyObject *kwds)
220220
if (!supports_empty_values) goto exit;
221221
for (i = 0; i < ncols; ++i) {
222222
supports_empty_values[i] = PyObject_IsTrue(
223-
PyList_GET_ITEM(py_supports_empty_values, i));
223+
PyList_GetItem(py_supports_empty_values, i));
224224
}
225225

226226
if ((buf = PyMem_Malloc((size_t)buf_size * sizeof(CHAR))) == NULL) goto exit;
@@ -234,7 +234,7 @@ write_tabledata(PyObject* self, PyObject *args, PyObject *kwds)
234234
if (_write_cstring(&buf, &buf_size, &x, " <TR>\n", 6)) goto exit;
235235

236236
for (j = 0; j < ncols; ++j) {
237-
if ((converter = PyList_GET_ITEM(converters, j)) == NULL) goto exit;
237+
if ((converter = PyList_GetItem(converters, j)) == NULL) goto exit;
238238
if ((array_val = PySequence_GetItem(array_row, j)) == NULL) goto exit;
239239
if ((mask_val = PySequence_GetItem(mask_row, j)) == NULL) goto exit;
240240

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ requires = ["setuptools>=77.0.0",
168168
"setuptools_scm>=8.0.0",
169169
"cython>=3.0.0, <4",
170170
"numpy>=2.0.0, <3",
171-
"extension-helpers>=1,<2"]
171+
"extension-helpers>=1.4,<2"]
172172
build-backend = "setuptools.build_meta"
173173

174174
[tool.setuptools]

0 commit comments

Comments
 (0)