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

Add build-system to pyproject.toml for PEP 517 (-m build) #323

Merged
merged 19 commits into from
Mar 15, 2021

Conversation

altendky
Copy link
Member

@altendky altendky commented Mar 3, 2021

Like #314 but with a prebuild step using build instead of tox-wheel integrated into the tox run. It has been expressed that tox-wheel has the added benefit of being the same thing in CI and locally. I do like this but something about that setup is broken with PyPy on Windows, and this works... Also, using tox-wheel in CI is a bit odd since every tox environment in every job would be rebuilding the wheel rather than building it once and testing that to-be-published artifact everywhere. So, I think some drawbacks both ways. Also, not being the same as Twisted is a downside. Then again, Twisted isn't testing on PyPy on macOS or Windows.

Note that the code in tox_build.sh can't be put in tox.ini since it uses wildcards and tox doesn't support those (but yay, tox 4.1 maybe will).

@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

Merging #323 (f8a5592) into master (4eb4b24) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #323   +/-   ##
=======================================
  Coverage   96.78%   96.78%           
=======================================
  Files          20       20           
  Lines        1183     1183           
  Branches      106      106           
=======================================
  Hits         1145     1145           
  Misses         20       20           
  Partials       18       18           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4eb4b24...f8a5592. Read the comment docs.

@altendky altendky changed the title Pep517 prebuild Add build-system to pyproject.toml for PEP 517 (-m build) Mar 3, 2021
@altendky altendky marked this pull request as ready for review March 3, 2021 05:18
@altendky altendky requested a review from graingert March 3, 2021 20:54
@altendky altendky requested review from adiroiban and a team March 9, 2021 01:37
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

It looks good. Thanks.

I guess thare are many ways to do it.

As long as the Ci works, I am happy with any solution pushed by @altendky :)

Thanks!

@altendky altendky merged commit 3aac85b into twisted:master Mar 15, 2021
@altendky altendky deleted the pep517-prebuild branch March 15, 2021 15:54
python -m build --sdist --outdir ${toxinidir}/dist/ ${toxinidir}
tar -xvf ${toxinidir}/dist/*
cd *
# build the wheel from the sdist

Choose a reason for hiding this comment

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

Why do we need to build the wheel from the sdist, and not build the wheel directly? Feels like you don't need this indirection, you're only testing the correctness of setuptools backend at best.

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes sure that the sdist was in the path of what is tested. Trio does it. Made enough sense to me to do it too. I don't know what errors I might be able to have that could make a wheel work but an sdist be broken. It may well be 'excessive' but it do you see harm that it could do? The overall goal is to make sure that the actual files to be published are what is tested. Not just that 'some wheel built in some situation is tested'. Likewise for sdist.

Copy link
Member

Choose a reason for hiding this comment

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

https://twistedmatrix.com/trac/ticket/10103 would have been caught if I'd have used this strategy

Choose a reason for hiding this comment

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

If you go down this path why not also test that direct wheel build works? I'm sure they'll be some edge case in some situation when src to sdist works, sdist to wheel also, but src to wheel does not 🤷‍♂️

Choose a reason for hiding this comment

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

And it's not some wheel in some situation. The builder ensures it's a pep 517/518 situation.

Choose a reason for hiding this comment

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

How do you generate your packages to upload to pypi?

Copy link
Member Author

Choose a reason for hiding this comment

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

This code that we are discussing. They are built, archived in GitHub Actions. Downloaded for tests and checks. If all is still well, they are downloaded and then published to PyPI. At least that is the presently-being-developed workflow. This PR does the first bit, #315 is adding the automated PyPI upload.

Choose a reason for hiding this comment

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

I see, thanks 👍🏻

Choose a reason for hiding this comment

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

Perhaps you want a wheel-from-sdist option for build project so you don't have to do this dance 🤷🏻

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe. We'll see what everyone else thinks I guess. pypa/build#257

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.

4 participants