Skip to content

Commit

Permalink
Merge pull request #51 from neutrinoceros/cython3
Browse files Browse the repository at this point in the history
BLD: switch to Cython 3.0, forbid deprecated Numpy C API in generated code
  • Loading branch information
matthewturk authored Aug 15, 2023
2 parents 44f5097 + 168cea1 commit 181564d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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++",
),
Expand All @@ -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},
),
)

0 comments on commit 181564d

Please sign in to comment.