-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix PyPy compilation #120
Fix PyPy compilation #120
Conversation
I've reverted the fix to check if the wheel builds fail for PyPy. |
The PyPy wheel builds fail without the patch here, let's make sure they pass now. |
…els are available
For now I've made it so that we only build wheels for PyPy versions where there are Numpy wheels as I think that is a reasonable compromise (otherwise we have to build Numpy from source on PyPy and we need to add a bit of complexity to get that to work). Then we match what Numpy does and we also ensure that PyERFA does build with PyPy without going over the top. |
Ok I think this is fine now and ready for review. Once/if this is merged, I would suggest tagging a new bugfix release so that we can fix the conda build (conda-forge/pyerfa-feedstock#31) |
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.
I hope at some point in the not too distant future we can just require newer gcc and be done with it, but for now this is very nice!
p.s. I'm happy to have a pyerfa 2.0.1.1 with as main |
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.
LGTM
Great! With two approvals, I'll go ahead and merge this, and make a new release that also includes a fix for #123 (which is quite serious) |
- Define `Py_LIMITED_API` and `NPY_TARGET_VERSION` macros in setup.py rather than in the C source code. - Don't define Numpy's `struct _typeobject` if we are building for PyPy because PyPy doesn't implement Python's limited C API (see liberfa/pyerfa#120). - Define `struct _typeobject` workaround after including Python.h, not before, because on PyPy, Python.h defines the macros that we depend on to detect whether we are building under PyPy. - Use `NPY_TARGET_VERSION` for builds that are backwards-compatible with old versions of Numpy. - Build with any version of Numpy >=1.25 and <2 (see liberfa/pyerfa#121).
When compiling with PyPy, it looks like _typeobject is already defined by PyPy itself - this causes the conda-forge build to fail since it includes PyPy builds: https://github.com/conda-forge/pyerfa-feedstock/pull/31/checks?check_run_id=17819660419
This PR does the simple fix of making sure we don't redefine _typeobject if we are using PyPy which should be harmless for CPython.
I'm also adding PyPy wheels here to see if they are fast enough to build as this would be a good regression test in itself and would also be nice to provide PyPy wheels.