Skip to content

WHL: build and distribute stable-ABI-compliant wheels - #18420

Merged
astrofrog merged 2 commits into
astropy:mainfrom
neutrinoceros:whl/build-abi3-wheels
Jul 12, 2025
Merged

astrofrog merged 2 commits into
astropy:mainfrom
neutrinoceros:whl/build-abi3-wheels

Conversation

@neutrinoceros

@neutrinoceros neutrinoceros commented Jul 11, 2025 •

Copy link
Copy Markdown
Contributor

Description

Close #18163
Close #18336

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@neutrinoceros neutrinoceros added this to the v7.2.0 milestone Jul 11, 2025
@neutrinoceros neutrinoceros added Build all wheels Run all the wheel builds rather than just a selection Limited API labels Jul 11, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@pllim

pllim commented Jul 11, 2025 •

Copy link
Copy Markdown
Member

Do we still need 313t spec if there is 314 now?

- name: Python 3.13t (free-threading) with recommended dependencies

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Yes. The current stable abi doesn't work on 3.13t or 3.14t (which is one of the reasons why we wanted to make it optional), and we can't yet move this job to 3.14t because none of our deps have wheels on PyPI yet.
but while we're discussing this, it's worth mentionning that CPython devs want the next stable abi to be free-threading compatible, so, assuming we can comply with it, we could get 3.15t-instalable wheels for free when we add support for 3.15

@pllim
pllim requested a review from a team July 11, 2025 15:00
@pllim

pllim commented Jul 11, 2025

Copy link
Copy Markdown
Member

I don't think change log is needed but release manager can always overrule.

Thanks!

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Surprisingly, this works as I expect on macOS and windows (all archs), but not on Linux: all jobs produced 3 wheels each (one for each Python version), never tagging the ABI as abi3. Before investigating further, let me ask @astrofrog if he thinks this could be a simple bug in extensions-helper ?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

never mind I just remembered I saw something similar once; I think it has to do with os-specific ways envs are isolated, and can easily be worked-around in cibuildwheel (once you know what to look for). Let me give this another shot.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Now the env var is correctly passed to the build env on all platforms, however, building currently fails on Linux. It looks to me like the env var isn't having all desired effects, in particular, it seems like the Py_LIMITED_API macro is somehow defined too late (i.e., after Python.h was already included). I don't yet understand why this problem wasn't caught in existing CI and what's the important difference in a cibuildwheel context.
However, it might be obvious to @henryiii, so let me try my luck :)

@neutrinoceros
neutrinoceros force-pushed the whl/build-abi3-wheels branch 3 times, most recently from 9a403db to 3d1e740 Compare July 11, 2025 20:16
@neutrinoceros

neutrinoceros commented Jul 11, 2025 •

Copy link
Copy Markdown
Contributor Author

Actually I may have been misreading the logs, I think they were showing genuine compile-time issues (that do not necessarily show up as fatal errors on all compilers, hence why we didn't see them before ?). Any way, I'll try something new and take the compilers seriously for now.

@neutrinoceros
neutrinoceros force-pushed the whl/build-abi3-wheels branch from 513901f to 6ad8348 Compare July 11, 2025 20:30
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

I'm getting there. Letting CI run 100% one last (🤞🏻) time.

@neutrinoceros
neutrinoceros force-pushed the whl/build-abi3-wheels branch from 6ad8348 to 4806e07 Compare July 12, 2025 07:17
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Alright, this is now ready for review.

@neutrinoceros
neutrinoceros marked this pull request as ready for review July 12, 2025 07:17
@neutrinoceros
neutrinoceros force-pushed the whl/build-abi3-wheels branch from 4806e07 to bc5b9e9 Compare July 12, 2025 07:53

@mcara mcara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for WCS

@astrofrog astrofrog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@astrofrog

Copy link
Copy Markdown
Member

Don't think there's any reason not to merge, might as well start exercise this for the dev wheels. We can easily disable the limited API wheels again if needed.

@astrofrog
astrofrog merged commit d02ffa9 into astropy:main Jul 12, 2025
@neutrinoceros
neutrinoceros deleted the whl/build-abi3-wheels branch July 12, 2025 16:54
@pllim

pllim commented Jul 12, 2025

Copy link
Copy Markdown
Member

Thank you for your hard work on this!

@astrofrog

Copy link
Copy Markdown
Member

Yes thank you for the epic effort on this!

@astrofrog

Copy link
Copy Markdown
Member

Just to close the loop on this - it all works fine! See dev wheels here:

https://anaconda.org/astropy/astropy/files?type=pypi&version=7.2.dev288%2Bgd02ffa90d6

The wheel building now takes 1h45 instead of 2h15 roughly, so saves 30 minutes on every wheel build job. The reason it hasn't shaved off more is because we still run the test suite on all versions, but I think that's probably sensible for now.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

That's actually the recommendation from Python's docs:

we recommend testing an extension with all minor Python versions it supports, and preferably to build with the lowest such version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using the limited Python API in astropy

4 participants