Repository navigation
BLD: add option to build future-compatible abi3 wheels - #1600
neutrinoceros wants to merge 2 commits into
Conversation
|
|
||
| # restrict LIMITED_API usage: | ||
| # - require an env var PYPROJ_LIMITED_API=1 | ||
| # - LIMITED_API is not compatible with free-threading (as of CPython 3.14) |
There was a problem hiding this comment.
note this comment is going to age like milk because there's a new version of the Limited API coming up in Python 3.15 that's compatible with both GIL-enabled and free-threaded builds. However there are a couple other blockers right now (Cython and setuptools both have work-in-progress patches to support this). Note that I'd be happy to revisit this later this year to add cp315-abi3.abi3t as a target
2da1367 to
029ffef
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1600 +/- ##
==========================================
- Coverage 95.84% 95.81% -0.04%
==========================================
Files 20 20
Lines 1879 1886 +7
==========================================
+ Hits 1801 1807 +6
- Misses 78 79 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Mind enabling this in the wheel builds to test? |
b3a69bb to
a577583
Compare
|
enabling this in CI revealed that it is currently blocked by cython and indeed, compilation then predictibly fails because the generated module isn't limited-api-compliant |
|
You could test it by adding a flag to use the slower alternative: Line 20 in 40d7cf8 |
8721db0 to
0ef9dbf
Compare
|
thanks for the pointer. I now expect the current CI run to succeed. Should I drop the second commit before undrafting ? |
0ef9dbf to
0482753
Compare
This allows targeting CPython's LimitedAPI (and stable ABI) by setting
PYPROJ_LIMITED_API=1at build time. Resulting wheels are future compatible with yet-unreleased Python versions.The trade-off is that runtime performance might be impacted, though I suggest measuring it against real load-bearing applications, as I found that in many numpy-based extensions the impact to be negligible or even non-measurable.
I could successfully build the package and run the test suite with this locally.
I suggest a couple possible approaches to leverage this:
cp314-abi3target to the existing build matrix. Version-specific wheels will still be prefered by installers when available but will default to these otherwise, instead of having to, and often failing to build pyproj from source.cp311-abi3wheel per platform. If there are no visible performance regressions this is definitely the way to go.