-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update to Cython 3 #1567
update to Cython 3 #1567
Conversation
@@ -46,14 +46,14 @@ def run(self): | |||
|
|||
setup( | |||
install_requires=_REQUIREMENTS, | |||
ext_modules=[ | |||
ext_modules=cythonize([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using cythonize
rather than cython's build_ext
seems to be more standard nowadays, and lets us set the language level directive.
@@ -129,9 +127,9 @@ cdef class _ManagedRaster: | |||
self.block_xbits = numpy.log2(self.block_xsize) | |||
self.block_ybits = numpy.log2(self.block_ysize) | |||
self.block_nx = ( | |||
self.raster_x_size + (self.block_xsize) - 1) / self.block_xsize | |||
self.raster_x_size + (self.block_xsize) - 1) // self.block_xsize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was relying on python 2 style integer division. Now we need to explicitly use floor division.
@@ -10,7 +10,6 @@ | |||
# scripts/convert-requirements-to-conda-yml.py as though it can only be found | |||
# on pip. | |||
|
|||
Cython<3.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cython doesn't really belong in requirements because it's only needed to build invest, and because it's listed under build-system.requires
in pyproject.toml
, pip installs it for us in a separate virtual environment at build time.
extra_compile_args=compiler_and_linker_args, | ||
extra_link_args=compiler_and_linker_args, | ||
language='c++' | ||
language='c++', | ||
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This takes care of the deprecated numpy API warnings we've had forever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @emlys , this all looks good to me.
Description
Fixes #556
Checklist