CI: Stage release packages to PyPI through GHA#137
Conversation
Summary by CodeRabbit
WalkthroughA new GitHub Actions workflow for automating Python package builds and publishing to PyPI has been added, alongside documentation detailing the release process. The workflow supports multiple triggers and conditional publishing, while the documentation guides maintainers through versioning, tagging, and pushing releases. Additionally, the Python package setup was updated to include a new subpackage. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #137 +/- ##
=======================================
Coverage 99.54% 99.54%
=======================================
Files 18 18
Lines 438 438
=======================================
Hits 436 436
Misses 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/release-pypi.yml (1)
67-68: Allow manual dispatch runs to publish when desired.Under
workflow_dispatchthe job currently never publishes because thestartsWith(github.event.ref, 'refs/tags')guard evaluates tofalse.
Consider adding an explicit input (e.g.publish: true/false) or relaxing the condition so maintainers can trigger a one-off publish without creating a tag.Example diff:
- - name: Publish package to PyPI - if: startsWith(github.event.ref, 'refs/tags') + - name: Publish package to PyPI + if: | + startsWith(github.event.ref, 'refs/tags') || + (github.event_name == 'workflow_dispatch' && inputs.publish == 'true')docs/release.md (1)
11-19: Streamline the push instruction.
git push --follow-tagspushes the commit and its tags in one command, keeping the history linear and reducing chances of forgetting the second push.-```shell -git push && git push --tags -``` +```shell +git push --follow-tags +```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/release-pypi.yml(1 hunks)docs/release.md(1 hunks)
🔇 Additional comments (2)
.github/workflows/release-pypi.yml (2)
28-30: Verify thatsetup-pythonsupports3.13onubuntu-latest.
actions/setup-pythondoes not always provide the next-major CPython release immediately after it is cut. Picking a version that is not yet present on the runner images will cause the entire workflow to fail at the “Set up Python” step.If 3.13 availability is uncertain, pin to the latest confirmed-available stable (e.g.
3.12) or add a second matrix entry so releases are not blocked.
35-41: Ensure thepypienvironment exists and contains the required trusted-publisher settings.The job references
environment: pypiand requests theid-token: writepermission.
If the repository does not actually define an environment named “pypi” with the PyPI trusted-publisher configuration, the job will error when attempting to acquire the OIDC token.Please double-check the repository settings (Settings ▸ Environments) before merging.
############################ # Package would be ignored # ############################ Python recognizes 'epo_ops.middlewares.cache' as an importable package, but it is absent from setuptools' `packages` configuration. This leads to an ambiguous overall configuration. If you want to distribute this package, please make sure that 'epo_ops.middlewares.cache' is explicitly added to the `packages` configuration field.
About
Let's use trusted publishing to stage packages to PyPI through GHA.
-- https://pypi.org/manage/project/python-epo-ops-client/settings/publishing/