Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = [
"setuptools_scm[toml]>=7.0",
"wheel",
"oldest-supported-numpy",
"Cython"
"Cython>=3.0"
]
# Defined by PEP 517
build-backend = "setuptools.build_meta"
Expand Down
2 changes: 1 addition & 1 deletion requirements/cf-units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
# setup dependencies
- setuptools >=45
- setuptools_scm >=7.0
- cython
- cython >=3.0
- numpy

# core dependencies
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
cythonize = False

COMPILER_DIRECTIVES = {}
DEFINE_MACROS = None
# This Cython macro disables a build warning, obsolete with Cython>=3
# see : https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#numpy-c-api
DEFINE_MACROS = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
FLAG_COVERAGE = "--cython-coverage" # custom flag enabling Cython line tracing
BASEDIR = Path(__file__).resolve().parent
PACKAGE = "cf_units"
Expand Down Expand Up @@ -119,7 +121,7 @@ def _set_builtin(name, value):

if FLAG_COVERAGE in sys.argv or environ.get("CYTHON_COVERAGE", None):
COMPILER_DIRECTIVES = {"linetrace": True}
DEFINE_MACROS = [("CYTHON_TRACE", "1"), ("CYTHON_TRACE_NOGIL", "1")]
DEFINE_MACROS += [("CYTHON_TRACE", "1"), ("CYTHON_TRACE_NOGIL", "1")]
if FLAG_COVERAGE in sys.argv:
sys.argv.remove(FLAG_COVERAGE)
print('enable: "linetrace" Cython compiler directive')
Expand All @@ -142,6 +144,8 @@ def _set_builtin(name, value):
[udunits_ext] = cythonize(
udunits_ext,
compiler_directives=COMPILER_DIRECTIVES,
# Assert python 3 source syntax: Currently required to suppress a warning,
# even though this is now the default (as-of Cython v3).
language_level="3str",
)

Expand Down