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: provide an option to build just the source distribution, allow skipping wheel builds #83

Closed
agriyakhetarpal opened this issue Jan 9, 2024 · 7 comments · Fixed by #98

Comments

@agriyakhetarpal
Copy link

Hi! Thanks for writing this tool – I have been finding it very useful. As noted in the issue title, I was wondering if it would be possible to provide an input with this GitHub Action, say, in the format below:

Some implementation details

    steps:

      - name:  Build and inspect this package
        uses: hynek/build-and-inspect-python-package@v1
        with:
          type: [sdist]  # can be an array with the entries [sdist, wheel] by default,
          # note: maybe having just [wheel] doesn't make sense, maybe it does?

or perhaps an input wheel: false/true, which would then map to the

  1. python -m build --sdist, and
  2. python -m build --wheel

commands respectively. I'm not sure how the workflow has been implemented, but it would be nice to add more things like displaying the size of the sdist as a whole or individual files in bytes / kilobytes, disable build isolation if needed as well (i.e., through the --no-build-isolation command-line flag); if it's possible – but then that's a separate issue from this one.

Motivation

I am using this action to inspect my package and look at the tree of contents of my source distribution, but most of the times I don't need to build a wheel as well and upload its GitHub Actions artifact alongside it, because I use cibuildwheel for that owing to compiled components in the wheel, in which case it is better to do so via a separate job matrix.

Footnotes

I am happy to submit a PR shall I receive some pointers for this in the current codebase :)

@agriyakhetarpal
Copy link
Author

agriyakhetarpal commented Jan 9, 2024

Actually, it would also make sense to allow users to opt out of uploading the PyPI README as well, if these extra options are considered. I read through the code and from a preliminary overview I assume it's just going to be some if-else clauses for the individual steps where these artifacts are produced – I can write a PR if needed.

@adrn
Copy link

adrn commented Mar 6, 2024

I was just looking for this option myself!

@agriyakhetarpal
Copy link
Author

@adrn, if you are interested – I ended up writing a variation of my own by copying what I wanted to the job summary outputs: https://github.com/agriyakhetarpal/hugo-python-distributions/blob/d735ead65079a7dd25411e8b254f3cb2c3760c9a/.github/workflows/ci.yml#L110

It uses the same tree command but with different command-line inputs (just a matter of personal preference), please feel free to use it.

Here is a sample output, the only difference is that I do not use the timestamps.


PSA: I am still willing to contribute and implement this here by writing a PR in case others like me may require this functionality 🙂

@hynek
Copy link
Owner

hynek commented Mar 23, 2024

Sorry, I haven't responded faster, I tend to work in bulks.

I'm trying to understand, what problem you're trying to solve by introducing complexity? I understand that you don't need the wheel or readme, but what's the harm?

@agriyakhetarpal
Copy link
Author

agriyakhetarpal commented Mar 23, 2024

Hi @hynek – no worries about the delay. There isn't too big of a problem, really – but, to advocate that this isn't too niche a use case, having this option would be helpful in some of the following ones, and this list is by no means exhaustive:

  1. Building my wheel can take much more magnitudes of time in comparison to building an sdist, and I'm running BAIPP in a job that is parallel to the rest of my PR tests – especially if the wheel is a compiled one
  2. I might have custom behaviour when building the source distribution, for example:
    a. I may be using scikit-build-core and may wish to execute CMake when building it
    a. Or, similarly, I might be overriding the default behaviour for the installation via command classes provided by setuptools, such as setuptools.command.build_py or setuptools.command.sdist
  3. I am adding data files to arbitrary locations inside the sdist or if I don't want them inside the sdist (but I do want them in the wheel – where I don't need to inspect the wheel)
  4. I like to build my wheel in-tree and not from the sdist (current behaviour), because python -m build --sdist --wheel and python -m build --wheel have different meanings

and so on.

@hynek
Copy link
Owner

hynek commented Mar 23, 2024

Right, 4 is on purpose in fact, but I can see there's cases where it doesn't make sense.

I'll look into it, but it's gonna be an if/else in the shell block. I've seen you used a matrix which is elegant but also much slower/much more CI overhead and I'm really trying to make it as fast as possible (see also #86). 😅

@agriyakhetarpal
Copy link
Author

agriyakhetarpal commented Mar 23, 2024

Thanks! I'm definitely considering returning to your action instead of my own implementation, would be good to get support for uv. For some more reference, build added official support too quite recently: pypa/build#751. See also: astral-sh/uv#1510 in case they decide to add their own uv build command. These might be helpful for your PR (but build might take a bit longer to cut a release).

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 a pull request may close this issue.

3 participants