Skip to content
Merged
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
20 changes: 9 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,59 +41,62 @@
fi

wheels:
name: Build / ${{ matrix.os }} / Python 3.${{ matrix.python.minor }}
name: Build / ${{ matrix.os }} / Python 3.${{ matrix.python.minor }} / FT${{ matrix.python.ft }}
needs: matrix_config
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.matrix_config.outputs.matrix_os) }}
python:
- {minor: 10, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt'}
- {minor: 11, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt'}
- {minor: 12, req_build: 'requirements-build-3_12.txt', req_test: 'requirements-dev-3_12.txt'}
- {minor: 13, req_build: 'requirements-build-3_13.txt', req_test: 'requirements-dev-3_13.txt'}
- {minor: 10, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt', ft: '0'}
- {minor: 11, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt', ft: '0'}
- {minor: 12, req_build: 'requirements-build-3_12.txt', req_test: 'requirements-dev-3_12.txt', ft: '0'}
- {minor: 13, req_build: 'requirements-build-3_13.txt', req_test: 'requirements-dev-3_13.txt', ft: '0'}
- {minor: 13t, req_build: 'requirements-build-3_13.txt', req_test: 'requirements-dev-3_13.txt', ft: '1'}

runs-on: ${{ matrix.os }}
outputs:
artifact_names: ${{ steps.record_artifacts.outputs.artifact_names }}
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@master
- run: echo '::add-matcher::.github/problem-matchers/gcc.json'
if: startsWith(matrix.os, 'macos-') || startsWith(matrix.os, 'ubuntu-')
- run: echo '::add-matcher::.github/problem-matchers/msvc.json'
if: startsWith(matrix.os, 'windows-')

- uses: pypa/cibuildwheel@v2.23.3
if: matrix.os != 'macos-13-xlarge'
with:
output-dir: dist
env:
CIBW_BUILD: cp3${{ matrix.python.minor }}-*
CIBW_ARCHS_WINDOWS: x86 AMD64
CIBW_ARCHS_MACOS: x86_64
CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }}
CIBW_BEFORE_TEST: pip install -r {project}/${{ matrix.python.req_test }}
CIBW_TEST_COMMAND: pytest {project}/test
CIBW_ENABLE: ${{ matrix.python.ft == '1' && 'cpython-freethreading' || '' }}

- run: pip install pipx
if: matrix.os == 'macos-13-xlarge'
- uses: pypa/cibuildwheel@v2.23.3
if: matrix.os == 'macos-13-xlarge'
with:
output-dir: dist
env:
CIBW_BUILD: cp3${{ matrix.python.minor }}-macosx_arm64
CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }}
CIBW_BEFORE_TEST: pip install -r {project}/${{ matrix.python.req_test }}
CIBW_TEST_COMMAND: pytest {project}/test
CIBW_ENABLE: ${{ matrix.python.ft == '1' && 'cpython-freethreading' || '' }}

- uses: actions/upload-artifact@v4
with:
name: dist-wheels-${{ matrix.os }}-py3${{ matrix.python.minor }} # Unique artifact name
name: dist-wheels-${{ matrix.os }}-py3${{ matrix.python.minor }}-t${{ matrix.python.ft }} # Unique artifact name
path: dist/*

upload:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Publish
if: github.event_name == 'release'
needs: [tar_gz, wheels]
Expand All @@ -105,11 +108,6 @@
path: dist
merge-multiple: true

# - name: Flatten dist directory
# run: |
# find dist -mindepth 2 -type f \( -name '*.whl' -o -name '*.tar.gz' \) \
# -exec mv {} dist/ \;

- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion requirements-build-3_13.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy==2.2.5
numpy==2.3.1
setuptools==80.*
2 changes: 1 addition & 1 deletion requirements-dev-3_13.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy==2.2.5
numpy==2.3.1
pytest==8.3.3
invoke==2.2.0
hypothesis==6.131.16
5 changes: 4 additions & 1 deletion src/_arraykit.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static struct PyModuleDef arraykit_module = {
.m_methods = arraykit_methods,
};

PyObject *
PyObject*
PyInit__arraykit(void)
{
import_array();
Expand Down Expand Up @@ -134,6 +134,9 @@ PyInit__arraykit(void)
Py_XDECREF(m);
return NULL;
}
#ifdef Py_GIL_DISABLED
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
#endif
return m;
}

18 changes: 14 additions & 4 deletions src/auto_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,13 @@ fami_iternext(FAMIObject *self)
else {
PyObject* t = PyTuple_New(2);
if (!t) { return NULL; }
#if PY_VERSION_HEX >= 0x030D0000 // Python 3.13+
PyObject* k = PyList_GetItemRef(self->fam->keys, index);
#else
PyObject* k = PyList_GET_ITEM(self->fam->keys, index);
Py_INCREF(k);
Py_XINCREF(k);
#endif
if (!k) { return NULL; }
PyTuple_SET_ITEM(t, 0, k);
PyTuple_SET_ITEM(t, 1, PyLong_FromSsize_t(index));
return t;
Expand All @@ -438,8 +443,13 @@ fami_iternext(FAMIObject *self)
return PyArray_ToScalar(PyArray_GETPTR1(self->keys_array, index), self->keys_array);
}
else {
#if PY_VERSION_HEX >= 0x030D0000 // Python 3.13+
PyObject* yield = PyList_GetItemRef(self->fam->keys, index);
#else
PyObject* yield = PyList_GET_ITEM(self->fam->keys, index);
Py_INCREF(yield);
Py_XINCREF(yield);
#endif
if (!yield) { return NULL; }
return yield;
}
}
Expand Down Expand Up @@ -1302,11 +1312,11 @@ lookup(FAMObject *self, PyObject *key) {
return self->table[table_pos].keys_pos;
}

// Insert a key_pos, hash pair into the table. Assumes table already has appropriate size. When inserting a new itme, `hash` is -1, forcing a fresh hash to be computed here. Return 0 on success, -1 on error.
// Insert a key_pos, hash pair into the table. Assumes table already has appropriate size. When inserting a new item, `hash` is -1, forcing a fresh hash to be computed here. Return 0 on success, -1 on error.
static int
insert_obj(
FAMObject *self,
PyObject *key,
PyObject *key, // NOTE: a borrowed reference
Py_ssize_t keys_pos,
Py_hash_t hash)
{
Expand Down
Loading