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

ENH: determine wheel tags by Python interpreter introspection & tests and CI improvements #202

Merged
merged 12 commits into from
Nov 16, 2022

Conversation

dnicolodi
Copy link
Member

Looking at the wheel tags generation code in packaging and in wheel it looks like it is full of cruft to support old interpreter versions. I tried to see how much effort it takes to have the most minimal compliant implementation. This for now only tests that my implementation returns the same values as the packaging-based one. Pushing it here just to have the tests run in CI.

@dnicolodi dnicolodi force-pushed the tags branch 21 times, most recently from 5fbd7d0 to 1d81d62 Compare November 12, 2022 01:46
@dnicolodi
Copy link
Member Author

The code turns out nice and simple. The most complex part is a workaround for some macOS SDK bug. It would be nice if more of this string fiddling would be implemented in the standard library, but it does not seem as fragile as I was fearing. @FFY00 It would be nice if sysconfig on Windows would expose SOABI too.

I went ahead and replaced the use of packaging code with this implementation for the generation of the tags. Please have a look. @eli-schwartz

The tests failures on macOS are due to the fact that a version of packaging with the macOS SDK workaround has not been released yet. I'm not sure what the best solution is here.

@dnicolodi dnicolodi force-pushed the tags branch 6 times, most recently from 2296a72 to a1ed04c Compare November 12, 2022 14:04
@dnicolodi
Copy link
Member Author

@FFY00 I think this is now ready. After some serious debugging effort the CI should be happy now. Please take a look.

I would appreciate if we could cut a release after merging this, unless there are other important things pending. I would like to go back to release wheels for Python 3.7, which is the thing that originally prompted this work.

The extension modules filename suffixes do not contain enough
information to correctly determine the wheel tags. Instead introspect
the Python interpreter to derive the wheel tags. This is the same
approach used by other PEP517 backends, most notably wheel. The wheel
contents only to determine whether the wheel contains python ABI
dependent modules or other platform dependent code.

The packaging module is the reference wheel tags derivation
implementation and it is used (or vendored) by most python packages
dealing with wheels. However, the API provided by packaging is
cumbersome to use for our purposes and, with the goal of merging this
code into Meson in the future, it is good to avoid an additional
dependency. Therefore, the tags derivation code is reimplemented.

Tests are added to verify that the tags produced by meson-python agree
with the ones produced by packaging to ensure that the two
implementations will not diverge.

Fixes mesonbuild#142, fixes mesonbuild#189, fixes mesonbuild#190.
Looking for the string 'any' in the wheel filenames triggers when the
platform tag contains the string 'manylinux'. The ABI and platform
tags are anyhow verified a few lines above.
Also skip the tests on Cygwin.
Remove (wrong!) cross platform setup for test run only on Linux.
GitPython does not bring any particularly useful abstraction, is one
more dependency, and makes debugging failures in the test setup
harder.
Cygwin was installed but the regular Python interpreter was actually
used to run the test. Fix this. Also merge Cygwin tests setup
definition with the one for other environments.

The Python distributed by Cygwin is broken and requires some peculiar
maneuvers to make it suitable to create virtual environments. Address
that in the CI configuration.
Copy link
Member

@FFY00 FFY00 left a comment

Choose a reason for hiding this comment

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

I think this looks good. Huge thanks for working on this @dnicolodi! 🎉

@henryiii
Copy link
Contributor

I would appreciate if we could cut a release after merging this

I'm happy to finish off #175 as soon as this goes if if you'd like that too - that's quite important for building on non-wheel-supported platforms.

@henryiii
Copy link
Contributor

Great work, by the way! :)

@FFY00
Copy link
Member

FFY00 commented Nov 16, 2022

We have a couple things ready that are blocked by fixes on the PR, after we get this in we can merger all the blocked stuff and make a release.

@dnicolodi
Copy link
Member Author

The system ninja work would be very nice to have indeed.

@henryiii
Copy link
Contributor

henryiii commented Nov 16, 2022

This "passes" but the pytest -> test name change messes up the require checks. Personally, I prefer having a "pass" check that depends on all the other checks, and then only require that (one per workflow, unfortunately if you have multiple workflows, but still much simpler than maintaining one per job, and if you change the checks all the old merged PRs don't change to orange dots).

@dnicolodi
Copy link
Member Author

dnicolodi commented Nov 16, 2022

Yeah. Sorry, I didn't realize that the rename would have caused this issue. However, also the readthedocs job is stuck, so this is not the only thing preventing this from being merged automatically. Now that all the CI jobs are fixed, can't we simply require that all jobs succeed? I'm not sure why the status of old PRs should change changing the definition of the checks for future PRs. It seems a GitHub bug to me.

Edit: I don't have the rights to check this for the meson-python project, but on another project of mines I don't find the option to allow the merge only when all CI jobs pass anymore. I was sure there was something to this effect. All I find now is the possibility to manually select individual "checks". I would be an useful feature if it would at least accept a glob pattern or something, but having to manually select and click through the list really sucks.

I'll have a look at how to define a "collect" job that depends on all the tests in the "tests.yml" workflow. This indeed should make the manual selection suck a bit less. Thanks for the hint @henryiii

@FFY00
Copy link
Member

FFY00 commented Nov 16, 2022

I am gonna merge as-is and temporarily disable the required checks in the branch protection rules. I really like @henryiii's proposal, so we could work on that and add the required checks again.

@FFY00 FFY00 merged commit f50c591 into mesonbuild:main Nov 16, 2022
sageb0t pushed a commit to sagemath/sagetrac-mirror that referenced this pull request Nov 17, 2022
dnicolodi pushed a commit to stefanv/meson-python that referenced this pull request Feb 15, 2023
dnicolodi pushed a commit that referenced this pull request Feb 15, 2023
FFY00 pushed a commit that referenced this pull request Feb 17, 2023
The X got lost in the big refactoring in #202.

Signed-off-by: Filipe Laíns <[email protected]>
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 this pull request may close these issues.

7 participants