Skip to content

BLD: Make a sdist [wheel build] #21095

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

Merged
merged 1 commit into from
Mar 16, 2022
Merged

BLD: Make a sdist [wheel build] #21095

merged 1 commit into from
Mar 16, 2022

Conversation

lithomas1
Copy link
Collaborator

@lithomas1 lithomas1 commented Feb 20, 2022

No description provided.

@github-actions github-actions bot added the 36 - Build Build related PR label Feb 20, 2022
@lithomas1 lithomas1 force-pushed the patch-2 branch 2 times, most recently from 5a4f331 to c9652a8 Compare February 25, 2022 04:31
@lithomas1
Copy link
Collaborator Author

@tylerjereddy Do you need this PR for scipy to start migrating to cibuildwheel? I'm a little busy right now but I can try to find some time to finish up the last bits of this PR if its needed urgently.
This should be the last piece of the cibuildwheel migration for numpy.

@tylerjereddy
Copy link
Contributor

Nope, I was just curious and reading the code, for now. I suspect there be a bit of a "wait and see" before adopting in SciPy after NumPy embraces it.

@lithomas1 lithomas1 marked this pull request as ready for review March 7, 2022 03:36
@mattip
Copy link
Member

mattip commented Mar 7, 2022

Nice. I like it that we can get the artifacts from the github action summary.

The new sdist has a LICENSES_bundled.txt file and a numpy.egg-info/ directory that are not found in the sdist uploaded to PyPI.

In both cases, the sdist includes the same unprocessed LICENSE.txt file, I think the missing file in the PyPI sdist is a mistake.

As for the numpy.egg-info directory, it seems to be a build artifact and I think should not be included in the sdist.

@rgommers
Copy link
Member

rgommers commented Mar 7, 2022

In both cases, the sdist includes the same unprocessed LICENSE.txt file, I think the missing file in the PyPI sdist is a mistake.

LICENSES_bundled.txt should be concatenated into LICENSE.txt, so that it's not included separately in the sdist seems right to me. The explanation is probably that setuptools is imported too early, and the MANIFEST.in file is ignored. It contains:

# Exclude license file that we append to the main license when running
# `python setup.py sdist`.  And exclude generated files in repo root.
exclude LICENSES_bundled.txt

@mattip
Copy link
Member

mattip commented Mar 7, 2022

My mistake, the LICENSE.txt in both sdists is the processed one.

@lithomas1 lithomas1 force-pushed the patch-2 branch 2 times, most recently from 22c23cf to eef9aec Compare March 10, 2022 04:30
@lithomas1 lithomas1 marked this pull request as draft March 10, 2022 05:44
@lithomas1
Copy link
Collaborator Author

Thanks for the reviews. I think the main issue right now is that the PEP 517 build is going through setuptools implicitly. This is fine, but it means that there are some changes.

I think I got the license file issue resolved(it was because everything that matched LICENSE was included if not explicitly declared, and license files can't be excluded by setuptools(only distutils), from MANIFEST.in).

Unfortunately, there is no way to remove .egg-info during the build, setuptools needs it to do their version of the MANIFEST thing. Maybe this is fine? (after all the wheels have .dist-info in them, and I'm pretty sure pip will regenerate wheel-info upon install of a sdist without one) Right now, it's proving to be a little bit of a pain to delete the folder from the tarball.

I am willing to hack my way through the rest of this, but I just wanted to first get an opinion on using setuptools. IIUC, numpy is moving away from numpy.distutils/distutils, but I'm not sure whether the conversation on what build system numpy is moving to in the future got resolved.

If setuptools is going to be the preferred way numpy is going to be built in the future, I think it would make sense for me to continue down this path. Otherwise, I think I'll table this until a new build system is decided upon and integrated.

Regardless of build system choice, I think we should probably stick to the PEP 517 way of building sdists, as build isolation/clean environment of CI is probably the main reason for moving sdists building into the CI.

@rgommers
Copy link
Member

Ah that explains it, thanks @lithomas1. We are going to move away from setuptools, and the setuptools way of generating an sdist is known to be inferior to what distutils does. I'd recommend to just stay with:

git clean -xdf
python setup.py sdist

We've done this since forever, and it's reliable. I don't see a problem keeping it like that for another release or two.

@lithomas1 lithomas1 marked this pull request as ready for review March 12, 2022 19:47
@charris
Copy link
Member

charris commented Mar 13, 2022

@lithomas1 Off topic, but I will ask here. Do all the github wheel builds get tested? The OS X multibuild wheels have started failing on Python 3.8 and 3.9 (#21169), while all the github builds are getting uploaded to the nightly repo. I'm wondering is this is due to a lack of testing, or if the github builds are working better.

@lithomas1
Copy link
Collaborator Author

They do get tested(running the "full" tests), but I'm not sure why they would only fail on Azure. I guess something in the configs is different? It might be an issue with the Azure builds as the regular CI here isn't failing.

@lithomas1
Copy link
Collaborator Author

gentle ping @rgommers @mattip. It would be nice to get this merged.

@rgommers
Copy link
Member

I'll have a look now, thanks for the ping @lithomas1

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

This LGTM, only one comment left which can be taken care of in a follow-up (it also applies to wheel builds).

Thanks a lot @lithomas1!

github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
(contains(github.event.pull_request.labels.*.name, '36 - Build') ||
contains(github.event.pull_request.labels.*.name, '03 - Maintenance') ||
Copy link
Member

Choose a reason for hiding this comment

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

Maintenance is a very commonly used label and not particularly relevant for wheel/sdist builds, I would leave that one out.

Copy link
Member

Choose a reason for hiding this comment

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

I see this is done for wheels too, and rationale given is:

# 03 - Maintenance(for dependency upgrades), and

This rationale is not correct; the total number of PRs with this label is ~2250. It can be safely dropped, dependency upgrades that are of interest are not coming in through PRs often (e.g., compilers, or distro BLAS). And if something goes wrong there, it will show up soon enough in the scheduled builds.

@rgommers rgommers merged commit f6efa62 into numpy:main Mar 16, 2022
@rgommers
Copy link
Member

Upload to the Anaconda bucket will only happen from main, so will verify that now with a manual trigger.

@rgommers
Copy link
Member

The manual trigger doesn't seem to work, is this known @lithomas1, or am I doing something wrong by pressing the trigger on the merge commit?

image

See https://github.com/numpy/numpy/actions/runs/1993651328

@rgommers
Copy link
Member

Ah, my bad! There was an unexpected delay after pressing the trigger, and right at that moment my merge commit showed up. So the manual trigger did show up and is running fine now, just ~20 minutes later than expected:

image

@rgommers
Copy link
Member

The upload logic here doesn't seem quite right though, the wheels are getting uploaded while the sdist didn't:

image

See https://github.com/numpy/numpy/runs/5572823596?check_suite_focus=true

@EwoutH
Copy link
Contributor

EwoutH commented Aug 4, 2024

- name: Test the sdist
run: |
# TODO: Don't run test suite, and instead build wheels from sdist
# Depends on pypa/cibuildwheel#1020

This feature got added to cibuildwheel:

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

Successfully merging this pull request may close these issues.

6 participants