-
Notifications
You must be signed in to change notification settings - Fork 602
Closed
Milestone
Description
NumPy 2.0 is coming soon, and we should ensure shapely is fully compatible to ensure a smooth transition of our users. Overview issue on numpy's side:
Quick summary of the most important aspects for us:
- NumPy 2.0 as a major release changes the C ABI, so any package that builds against the NumPy C API like shapely will have to be rebuilt with numpy 2.0 to be able to run with numpy 2.0. That also means that our current released packages (built with older versions of numpy) will break (fail to import) with numpy 2.0, and so we should ideally add a
numpy<2pin.
This happens at the moment when installing shapely from a wheel in an environment with numpy nightly.
- Since numpy 1.25, we don't need
oldest-supported-numpyanymore (https://numpy.org/devdocs/release/1.25.0-notes.html#compiling-against-the-numpy-c-api-is-now-backwards-compatible-by-default and https://github.com/scipy/oldest-supported-numpy#deprecation-notice-for-numpy-20), so for newer Python versions (where the minimum supported version of numpy is <=1.25), we can start compiling with the latest numpy.
This also helps with the point above, because once numpy 2.0 is released, we can therefore built against numpy 2.0 and have a resulting wheel that can run with both numpy 1.x and 2.0. See https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice for more details. - Additionally to C ABI changes, there are also a whole set of changes in the Python API, and so we should test with numpy nightly to ensure we are compatible on that front.
We don't yet test with numpy nightly
A to do list based on my current understanding:
- Start testing with numpy nightly (we currently only use
--prein the dev build, so we only get a dev numpy when they do a beta or RC release). This will ensure that shapely at least builds and runs fine with the upcoming numpy. -> TST: test against numpy nightly #1973 - We should ideally do another release of shapely that adds a
numpy<2pin, so that when numpy 2.0 is out and someone doespip install shapely, you don't get a broken env. Therefore, for the maintenance 2.0.x branch:- Add a
numpy<2pin to the requirements in the maintenance branch -> COMPAT: Add a numpy<2 pin to install requirements for 2.0.x #1975 - Make another 2.0.x release
- Add a
- For the main development branch, we don't need a runtime pin but we need to update the build dependencies for packaging:
- Update the build-system
requiresto use latest numpy instead ofoldest-supported-numpy-> BLD: update build-system requires to use latest numpy instead of oldest-supported-numpy + build nightly wheels with numpy nightly #1974 - Upload nightly wheels when possible (depending on Request access for shapely scientific-python/upload-nightly-action#63)
- Update the build-system
- Address
copychanges in(as)arrayand__array__- COMPAT: fix assert_geometries_equal to work with numpy 2.0 copy changes #2007
- Update
__array__to accept a copy keyword: ENH: add copy=None to CoordinateSequence.__array__ #2053
Metadata
Metadata
Assignees
Labels
No labels