diff --git a/pyproject.toml b/pyproject.toml index 4b8cbd3800..4d1b5e2ee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = [ "setuptools", "setuptools_scm>=6.2", "wheel", - "cython", + "cython>=3.0", "numpy>=2.0.0rc1" ] diff --git a/setup.py b/setup.py index 4dc2b0da48..8420794546 100644 --- a/setup.py +++ b/setup.py @@ -127,6 +127,9 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): rsl_lib_path = os.path.join(rsl_path, "lib") rsl_include_path = os.path.join(rsl_path, "include") +# Set a variable for the numpy flags to add to cython +define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] + # build the RSL IO and FourDD dealiaser if RSL is installed if check_rsl_path(rsl_lib_path, rsl_include_path): fourdd_sources = [ @@ -146,6 +149,7 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): library_dirs=[rsl_lib_path], include_dirs=[rsl_include_path, "pyart/correct/src"] + [get_include()], runtime_library_dirs=[rsl_lib_path], + define_macros=define_macros, ) # Cython wrapper around RSL io @@ -156,6 +160,7 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): library_dirs=[rsl_lib_path], include_dirs=[rsl_include_path] + [get_include()], runtime_library_dirs=[rsl_lib_path], + define_macros=define_macros, ) extensions.append(extension_rsl) @@ -170,6 +175,7 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): "pyart.__check_build._check_build", sources=["pyart/__check_build/_check_build.pyx"], include_dirs=[get_include()], + define_macros=define_macros, ) extensions.append(extension_check_build) @@ -179,22 +185,30 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): "pyart.correct._fast_edge_finder", sources=["pyart/correct/_fast_edge_finder.pyx"], include_dirs=[get_include()], + define_macros=define_macros, ) extension_1d = Extension( "pyart.correct._unwrap_1d", sources=["pyart/correct/_unwrap_1d.pyx"], include_dirs=[get_include()], + define_macros=define_macros, ) unwrap_sources_2d = ["pyart/correct/_unwrap_2d.pyx", "pyart/correct/unwrap_2d_ljmu.c"] extension_2d = Extension( - "pyart.correct._unwrap_2d", sources=unwrap_sources_2d, include_dirs=[get_include()] + "pyart.correct._unwrap_2d", + sources=unwrap_sources_2d, + include_dirs=[get_include()], + define_macros=define_macros, ) unwrap_sources_3d = ["pyart/correct/_unwrap_3d.pyx", "pyart/correct/unwrap_3d_ljmu.c"] extension_3d = Extension( - "pyart.correct._unwrap_3d", sources=unwrap_sources_3d, include_dirs=[get_include()] + "pyart.correct._unwrap_3d", + sources=unwrap_sources_3d, + include_dirs=[get_include()], + define_macros=define_macros, ) extensions.append(extension_edge_finder) @@ -207,12 +221,14 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): "pyart.io._sigmetfile", sources=["pyart/io/_sigmetfile.pyx"], include_dirs=[get_include()], + define_macros=define_macros, ) extension_nexrad = Extension( "pyart.io.nexrad_interpolate", sources=["pyart/io/nexrad_interpolate.pyx"], include_dirs=[get_include()], + define_macros=define_macros, ) extensions.append(extension_sigmet) @@ -224,18 +240,21 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): sources=["pyart/map/ckdtree.pyx"], include_dirs=[get_include()], libraries=libraries, + define_macros=define_macros, ) extension_load_nn = Extension( "pyart.map._load_nn_field_data", sources=["pyart/map/_load_nn_field_data.pyx"], include_dirs=[get_include()], + define_macros=define_macros, ) extension_gate_to_grid = Extension( "pyart.map._gate_to_grid_map", sources=["pyart/map/_gate_to_grid_map.pyx"], libraries=libraries, + define_macros=define_macros, ) extensions.append(extension_ckd) @@ -245,7 +264,9 @@ def check_rsl_path(rsl_lib_path, rsl_include_path): # Retrieve pyx extensions extension_kdp = Extension( - "pyart.retrieve._kdp_proc", sources=["pyart/retrieve/_kdp_proc.pyx"] + "pyart.retrieve._kdp_proc", + sources=["pyart/retrieve/_kdp_proc.pyx"], + define_macros=define_macros, ) extensions.append(extension_kdp)