diff --git a/.github/workflows/build-with-clang.yml b/.github/workflows/build-with-clang.yml index 7332f74..b9ffef5 100644 --- a/.github/workflows/build-with-clang.yml +++ b/.github/workflows/build-with-clang.yml @@ -55,7 +55,7 @@ jobs: - name: Install mkl-service dependencies run: | - pip install meson-python cython cmake ninja + pip install meson-python "cython>=3.1.0" cmake ninja - name: List oneAPI folder content run: ls ${{ env.ONEAPI_ROOT }}/compiler diff --git a/.github/workflows/build-with-standard-clang.yml b/.github/workflows/build-with-standard-clang.yml index 4089dcf..d4b3ed6 100644 --- a/.github/workflows/build-with-standard-clang.yml +++ b/.github/workflows/build-with-standard-clang.yml @@ -46,7 +46,7 @@ jobs: - name: Install mkl-service dependencies run: | - pip install meson-python cython cmake ninja mkl-devel + pip install meson-python "cython>=3.1.0" cmake ninja mkl-devel - name: Build mkl-service run: | diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index 26839a6..efd87a7 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -37,7 +37,7 @@ jobs: - name: Build with pip run: | - pip install --no-cache-dir meson-python ninja cmake cython + pip install --no-cache-dir meson-python ninja cmake "cython>=3.1.0" pip install -e ".[test]" --no-build-isolation --verbose pip list python -m pytest -v mkl/tests diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 99e7337..4053eb5 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -21,15 +21,13 @@ requirements: - cmake - ninja - python - - python-gil # [py>=314] - pip >=25.0 - mkl-devel # [not osx] - mkl-devel <2024 # [osx] - - cython + - cython >=3.1.0 - wheel >=0.45.1 run: - python - - python-gil # [py>=314] - {{ pin_compatible('mkl') }} test: diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 410fe71..d1755da 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -22,15 +22,14 @@ requirements: - cmake - ninja - python + - python-build - python-gil # [py>=314] - - python-build >=1.2.2 - pip >=25.0 - mkl-devel - - cython + - cython >=3.1.0 - wheel >=0.45.1 run: - python - - python-gil # [py>=314] - {{ pin_compatible('mkl') }} test: diff --git a/mkl/_mklinitmodule.c b/mkl/_mklinitmodule.c index 33abdf5..11571dd 100644 --- a/mkl/_mklinitmodule.c +++ b/mkl/_mklinitmodule.c @@ -200,6 +200,12 @@ PyMODINIT_FUNC PyInit__mklinit(void) return NULL; } +#ifdef Py_GIL_DISABLED + /* Declare that this module supports running without the GIL so the + * free-threaded interpreter does not re-enable it on import. */ + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif + return m; } #else diff --git a/mkl/_py_mkl_service.pyx b/mkl/_py_mkl_service.pyx index 975a454..72908fe 100644 --- a/mkl/_py_mkl_service.pyx +++ b/mkl/_py_mkl_service.pyx @@ -25,6 +25,7 @@ # distutils: language = c # cython: language_level=3 +# cython: freethreading_compatible=True import numbers import warnings diff --git a/pyproject.toml b/pyproject.toml index 9ed27ab..884c499 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ build-backend = "mesonpy" requires = [ "meson-python>=0.13.0", "ninja", - "Cython", + "Cython>=3.1.0", "mkl-devel", "cmake" ]