Skip to content
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

Shims required to support GEOS version-specific functions in Cython #255

Open
brendan-ward opened this issue Nov 17, 2020 · 3 comments
Open
Labels
to-shapely This issue needs to be transferred to shapely

Comments

@brendan-ward
Copy link
Contributor

The standard approach of declaring an entry for a GEOS function in _geos.pxd does not work when the function is not available in a given older version of GEOS.

In the C extension, we are able to use macros like GEOS_SINCE_3_7_0 to conditionally include these for the compiler.

I don't see a similar mechanism for Cython.

It looks like other projects (e.g,. Fiona) deal with this by defining shim *.pxd files that are dynamically selected and used for the build based on the targeted version of the C library. I'm not yet sure how those handle functions that were introduced into later versions of the C library.

Is there a better alternative approach?

@snowman2
Copy link
Contributor

rasterio/rasterio#2016

@snowman2
Copy link
Contributor

Another example: Toblerity/Fiona#979

@brendan-ward
Copy link
Contributor Author

Thanks @snowman2 !

One challenge here compared to rasterio / Fiona is that we don't require an environment variable indicating GEOS version when geos-config is not available (e.g., on Windows?). However, it might be a good idea for us to do so in order to check and enforce minimum GEOS version, and then using compile_time_env in setup.py becomes straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to-shapely This issue needs to be transferred to shapely
Projects
None yet
Development

No branches or pull requests

3 participants