Skip to content

Commit

Permalink
ADD: Add updated cython and flags for numpy (#1564)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrover1 authored Apr 16, 2024
1 parent db95df7 commit def1f9f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [
"setuptools",
"setuptools_scm>=6.2",
"wheel",
"cython",
"cython>=3.0",
"numpy>=2.0.0rc1"
]

Expand Down
27 changes: 24 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit def1f9f

Please sign in to comment.