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

Hatch-mypyc uses the building platform during cross-compilation, not the target platform (_PYTHON_HOST_PLATFORM) #24

Closed
ichard26 opened this issue Nov 12, 2022 · 2 comments · Fixed by pypa/hatch#672

Comments

@ichard26
Copy link

ichard26 commented Nov 12, 2022

Hey, so Black uses hatch-mypyc. It's great and we're happy we can finally use modern packaging standards! Unfortunately, it broke our cross-architecture macOS builds. When using CIBW to build universal2 and arm64 wheels for macOS, the wheels end up with the wrong platform tag. For example, here they are labelled to support x86_64, but they're arm64 wheels in reality.

Setuptools labels the wheels correctly. Hatchling only supports inferring the platform tag for the machine the build is taking place on and ignores _PYTHON_HOST_PLATFORM (which CIBW sets during a cross-platform macOS build).

My best guess at how setuptools selects the right platform tag during cross-compilation

Figuring out where the platform tags stored in .dist-info come from isn't nearly as obvious -- I barely know the setuptools codebase

I did not catch this issue while reviewing the original PR so this affected the 22.10.0 release (psf/black#3312). In the interim, I'm fixing the wheel platform tags by hand before publishing them to PyPI. It works, but it isn't ideal 🙂

cc @zsol since he is way more knowledgeable about this kind of stuff than me

@ofek
Copy link
Owner

ofek commented Nov 24, 2022

related: PyO3/maturin#1289

@ofek
Copy link
Owner

ofek commented Dec 7, 2022

from @henryiii:

https://github.com/scikit-build/scikit-build-core/blob/e9a6e97a0ae7ffffcb5c3756112b2a59339bb4ef/src/scikit_build_core/builder/builder.py#L51-L55 is how I do it.

ARCHFLAGS is how setuptools targets other arch’s and cibuildwheel and conda set it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants