From 168cea12d9d5721fe6a1d9e00b18a56a0082a095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Fri, 28 Jul 2023 14:51:11 +0200 Subject: [PATCH] BLD: switch to Cython 3.0, forbid deprecated Numpy C API in generated code --- .github/workflows/wheels.yaml | 2 +- pyproject.toml | 6 +++--- setup.py | 9 ++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index a2eacf7..d5cee04 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -76,7 +76,7 @@ jobs: - name: Install build time dependencies shell: bash run: | - python -m pip install "Cython>=0.29.21,<3.0" + python -m pip install "Cython>=3.0,<3.1" python -m pip install oldest-supported-numpy python -m pip install --upgrade wheel python -m pip install --upgrade setuptools diff --git a/pyproject.toml b/pyproject.toml index cf2adee..6fee9bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] requires = [ "setuptools>=61.2", - "Cython>=0.29.22,<3.0", + + # see https://github.com/yt-project/ewah_bool_utils/issues/52 + "Cython>=3.0, <3.1", "oldest-supported-numpy", - # see https://github.com/numpy/numpy/pull/18389 - "wheel>=0.36.2", ] [project] diff --git a/setup.py b/setup.py index 535b2be..74a5c4f 100644 --- a/setup.py +++ b/setup.py @@ -16,16 +16,20 @@ else: std_libs = ["m"] +define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] + extensions = [ Extension( "ewah_bool_utils.ewah_bool_wrap", ["ewah_bool_utils/ewah_bool_wrap.pyx"], + define_macros=define_macros, include_dirs=["ewah_bool_utils", "ewah_bool_utils/cpp", np.get_include()], language="c++", ), Extension( "ewah_bool_utils.morton_utils", ["ewah_bool_utils/morton_utils.pyx"], + define_macros=define_macros, extra_compile_args=omp_args, extra_link_args=omp_args, libraries=std_libs, @@ -35,6 +39,7 @@ "ewah_bool_utils._testing", ["ewah_bool_utils/_testing.pyx"], include_dirs=["ewah_bool_utils", "ewah_bool_utils/cpp", np.get_include()], + define_macros=define_macros, extra_compile_args=["-O3"], language="c++", ), @@ -44,8 +49,6 @@ setup( ext_modules=cythonize( extensions, - compiler_directives={ - "language_level": 3 # this option can be removed when Cython >= 3.0 is required - }, + compiler_directives={"language_level": 3}, ), )