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

Feature request: Add option to build an sdist and build all the wheels from the sdist #1769

Open
pettyalex opened this issue Feb 29, 2024 · 1 comment

Comments

@pettyalex
Copy link

Description

Hello,

I am curious if you've ever considered adding an option to cibuildwheel or to its github action to first create an sdist and then build all of the wheels from the sdist rather than directly creating wheels from the repository? I know that I could do this with more steps in a Github Action by first using build to make an sdist, then untarring the sdist into a directory and pointing cibuildwheel into that dir, but it would be nice if the cibuildwheel action or package directly supported doing that for me.

Making an sdist to build wheels from would solve multiple problems that I encountered while exploring cibuildwheel with Plink's Pgenlib package: https://github.com/chrchang/plink-ng/tree/master/2.0/Python . I am not associated with the Plink project, just an enthusiastic user who has fixed some mac packaging problems with it previously. For context, Pgenlib was distributing broken sdists on ARM64, because required headers were not in the MANIFEST.in. I expected cibuildwheel to fail to build because of the broken sdist, but because cibuildwheel builds directly from the repository it was able to produce wheels, wheels that are not buildable from the sdist. This made me realize that there are a lot of different ways to misconfigure sdist packaging that will cause a wheel built from the package vs a wheel built from the sdist to be different, which is not desirable.

A completely separate problem that I encountered with cibuildwheel in Pgenlib is that Pgenlib has sources and headers that are symlinks to outside the python package: https://github.com/chrchang/plink-ng/tree/master/2.0/Python/src/plink2/simde. These symlinks are dereferenced when an sdist is created, meaning that the files are all copied into the sdist and everything works perfectly, and wheels are buildable from the sdist. However, when building with cibuildwheel on Linux, it will try to copy these symlinks into the Docker container, which will not dereference them and results in a completely broken build on Linux.

I realize both of these are edge cases, but I believe that the intent of wheels is that they should be equivalent to what would be compiled from the sdist, so it would be nice to have cibuildwheel able to build from repository -> sdist -> wheels with a simple config flag rather than having to do it in more steps in a github action.

I'm attaching a link to the ci config that I used and a successful run showing wheels built on Mac OS that could not have been built from the sdist, because at the time that pipeline ran the MANIFEST.in did not include necessary headers.

If you want more context of the specific packaging problem that Pgenlib had, here it is: chrchang/plink-ng#261

Build log

https://github.com/chrchang/plink-ng/actions/runs/8075816315/job/22063274477?pr=262

CI config

https://github.com/chrchang/plink-ng/pull/262/files

@henryiii
Copy link
Contributor

You can use pipx run build --sdist to make the SDist, then point cibuildwheel at the SDist - we support building directly from SDist. You can even make the SDist in one job, then transfer it to all your cibuildwheel jobs via upload/download artifact, something a single action could not do.

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

No branches or pull requests

2 participants