PyWavelets / pywt

PyWavelets - Wavelet Transforms in Python
http://pywavelets.readthedocs.org
MIT License
1.97k stars 460 forks source link

CI: Add CI to release nightly wheels against free-threaded Python 3.13 #756

Closed andfoy closed 4 days ago

andfoy commented 4 days ago

This PR adds a CI workflow to produce nightly PyWavelets releases that are compatible with the free-threaded Python 3.13 distribution.

andfoy commented 4 days ago

Right now, this CI is failing when trying to build on musllinux_1_2. The flagged compilation error comes from one of the CPython header files, internal/pycore_backoff.h, which fails with the following traceback (available on this log trace)

cc -Ipywt/_extensions/_cwt.cpython-313t-x86_64-linux-musl.so.p -Ipywt/_extensions -I../pywt/_extensions -I../pywt/_extensions/c -Ipywt -I/opt/_internal/cpython-3.13.0b2-nogil/lib/python3.13/site-packages/numpy/_core/include -I/opt/_internal/cpython-3.13.0b2-nogil/include/python3.13t -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O3 -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_22_API_VERSION -DPY_EXTENSION -DHAVE_C99_COMPLEX -DCYTHON_CCOMPLEX=1 -MD -MQ pywt/_extensions/_cwt.cpython-313t-x86_64-linux-musl.so.p/meson-generated__cwt.c.o -MF pywt/_extensions/_cwt.cpython-313t-x86_64-linux-musl.so.p/meson-generated__cwt.c.o.d -o pywt/_extensions/_cwt.cpython-313t-x86_64-linux-musl.so.p/meson-generated__cwt.c.o -c pywt/_extensions/_cwt.cpython-313t-x86_64-linux-musl.so.p/_cwt.c
    In file included from /opt/_internal/cpython-3.13.0b2-nogil/include/python3.13t/internal/pycore_code.h:474,
                     from /opt/_internal/cpython-3.13.0b2-nogil/include/python3.13t/internal/pycore_frame.h:13,
                     from pywt/_extensions/_cwt.cpython-313t-x86_64-linux-musl.so.p/_cwt.c:30813:
    /opt/_internal/cpython-3.13.0b2-nogil/include/python3.13t/internal/pycore_backoff.h:113:33: error: expected declaration specifiers or '...' before numeric constant
      113 | #define COLD_EXIT_INITIAL_VALUE 64
          |                                 ^~
    /opt/_internal/cpython-3.13.0b2-nogil/include/python3.13t/internal/pycore_code.h:493:15: note: in expansion of macro 'COLD_EXIT_INITIAL_VALUE'
      493 | static_assert(COLD_EXIT_INITIAL_VALUE > ADAPTIVE_COOLDOWN_VALUE,
          |               ^~~~~~~~~~~~~~~~~~~~~~~
    /opt/_internal/cpython-3.13.0b2-nogil/include/python3.13t/internal/pycore_code.h:494:5: error: expected declaration specifiers or '...' before string constant
      494 |     "Cold exit value should be larger than adaptive cooldown value");
          |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

According to the internet, the expected declaration error seems to be caused to a syntax error, however, after inspecting the header file in question, there are no syntax errors available. Also this issue is not occurring under glibc builds

rgommers commented 4 days ago

Thanks @andfoy. Looks like the problem was that we were still building with C99 (hat tip to @ngoldbaum for correctly guessing that that was the problem, based on a static_assert being triggered in CPython - this is known to happen for C code generated by Cython and compiled with -std=c99); the commit I just pushed changes it to using C17.

rgommers commented 4 days ago

Passing manylinux and musllinux wheel builds: CI log

rgommers commented 4 days ago

Everything in order, cp313t wheels are up at https://anaconda.org/scientific-python-nightly-wheels/PyWavelets/files now.