zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Add `upload-pypi` option to disable upload to Pypi #440

Closed leplatrem closed 5 months ago

leplatrem commented 6 months ago

I know this PR is not ready to merge, but would like to hear your feedback before polishing docs and writing tests.

I'm using zest.releaser with an after_checkout that builds the UI with Node.

I want to publish the built wheels/archives from a Github Action, using the official action that supports trusted publishing. See https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

For that, I want zest.releaser to build everything but without uploading to Pypi.

I would run it with:

[zest.releaser]
create-wheel = yes
upload-pypi = no

and release --no-input

What do you think?

Note: I could also run the build commands directly in the Github Action instead of using release

mauritsvanrees commented 5 months ago

You can already say:

[zest.releaser]
release = no

But then no distributions are made, and in your case you do want the distributions, so this is no option, right? Just checking if I understand you correctly.

In that case, your solution sounds fine.

Just wondering if it would be better to turn this into a question. That could be done in the _ask_upload method. default would be True, like it is now, and with the new option you can set it to False. Since it is a question, you can still override it during release, except when you call it with --no-input of course. But then, before this question is asked, we call is_pypi_configured and this gives an error if you do not have a pypi configuration. So the way you have it now may be the best.

leplatrem commented 5 months ago

Thank you for your detailed answer.

But then no distributions are made, and in your case you do want the distributions, so this is no option, right? Just checking if I understand you correctly.

Yes, that was the idea.

I'm sorry but in the end I won't need this work, another solution was chosen to inject the built UI into the package, and we don't use the hook anymore. Shall I close it or do you want to keep it open in case someone wants to take over?

reinout commented 5 months ago

Your idea does sound like something I could use in the future, so I'd like to get it in. I'm merging it into a branch instead of into master, then I can do a bit of cleanup and a changelog and so without you needing to keep your branch open. Okay?

reinout commented 5 months ago

https://zestreleaser.readthedocs.io/en/latest/options.html : your upload-pypi is in there now. (Should you ever need it :-) )