diffusers
diffusers copied to clipboard
[PyPI publishing] feat: automate the process of pypi publication to some extent.
What does this PR do?
This PR adds utilities to semi-automate the process of publishing a new release on PyPI and notifying our internal Slack channel about it.
Synopsis
setup.py clearly lays out the steps needed in order for us to prepare a new library and publish it on PyPI. Steps from 1 - 6 need careful inspection and might often require manual intervention. But steps 7 - 9 and making an announcement on Slack about the release don't require it IMO and can be systematically automated.
Design
- As mentioned earlier, the PR assumes that we need some level of babysitting till step 6 of the publishing process. So, the workflow,
pypi_publish.yamlstarts after it. More specifically, it gets triggered after a tag is created and pushed. It then does the following:
- Checks out the latest release branch.
- Builds the wheel and distribution.
- Pushes to the Test PyPI server.
- Runs a small import test (as prescribed in
setup.py). - If the above test succeeds, pushes to the main PyPI.
- The step that comes after PyPI publishing is publishing the release on our GitHub with the release notes. We then usually (should) notify in an internal Slack channel about the release. This is handled by
notify_slack_about_release.yml. This workflow gets triggered after a release is published on our GitHub.
Considerations
- Both the workflows mentioned above have "workflow_dispatch" included as their additional triggers so that they can be run manually when needed.
- I have extensively tested this design with a dummy repository: https://github.com/sayakpaul/blossom/. You can find the actions here. The released package on PyPI is here. Dummy Slack channel for testing:
#temp-notification-bot-testwhere.
@LysandreJik @yiyixuxu @DN6 WDYT?
@DN6 LMK what you think. Would like to test-drive this with the upcoming release 🚗