Skip to content

Commit

Permalink
Have cibuildwheel also create source distribution.
Browse files Browse the repository at this point in the history
Does it *actually* make sense for a job called "cibuildwheel" to build a
source distribution? I mean, not really, if you go by the words
literally. The whole point of the job, it would seem, is to build
*wheels*. And here we are building a *source* distribution. Completely
absurd! Absolutely ridiculous! Has nothing to do with the name of the
job!

Au contrare mon frère, the while the name of the job would indicate that
it should only build wheels, the *purpose* of the job, truly, is to
build all things that should be uploaded to PyPI. With that
understanding, the cibuildwheel job should certainly be the job that
builds the source distribution as well.

"But", perhapse you say, "the way you are building the source
distribution is an absurdity! You install the package first, then build
the source distribution!  Why build the package if you just want the
source? The rest of the job is *already* building everything anyway!"

Ah yes, an excellent point. Ideally, one would not need to install the
package to simply create a source distribution. That certainly seems
counterintuitive. However, in our case, the way our setup script works
is to download *and build* our dependencies in a single step. This is
clearly not *conceptually* the best way to do it, but it sure as heck is
convenient. Plus we don't understand setuptools when we get right down to
it, and we don't want to figure out how to separate the fetching from the
building. It's not my idea of a good time.

Anyway, this is a Good Commit™ because then you don't have to build a
sdist manually later. And when I say "you" I really mean "I", since I
am the one that does it. And when I have to do manual steps, I do them
wrong. Not all the time, but sometimes. Often enough that I fear them.
With this commit in place, you can just download all artifacts, then
upload them to PyPI. Someday, perhaps, we will allow GitHub to upload to
PyPI automatically, once we build up confidence.
  • Loading branch information
Cody Piersall committed Jan 16, 2024
1 parent a4334e7 commit 760a98a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,22 @@ jobs:
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
# create the source distribution
make_sdist:
name: Make SDist
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules

- name: Build SDist
run: |
pip install build
pip install -e .
python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

0 comments on commit 760a98a

Please sign in to comment.