Publish palace-util and palace-opds to PyPI on release (PP-4076)#3238
Open
jonathangreen wants to merge 2 commits intomainfrom
Open
Publish palace-util and palace-opds to PyPI on release (PP-4076)#3238jonathangreen wants to merge 2 commits intomainfrom
jonathangreen wants to merge 2 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3238 +/- ##
==========================================
- Coverage 93.30% 93.30% -0.01%
==========================================
Files 498 502 +4
Lines 46147 46155 +8
Branches 6318 6318
==========================================
+ Hits 43059 43066 +7
- Misses 2003 2004 +1
Partials 1085 1085 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f42c076 to
568b49d
Compare
f1f8058 to
8d9177c
Compare
Both packages now declare `dynamic = ["version"]` and source the version from a committed `_version.py` stub via hatchling's regex version source. The stub carries a dev placeholder (0.0.0.dev0) so local / developer builds succeed out-of-box; the PyPI publish workflow overwrites `_version.py` with the dunamai-computed release version right before `uv build` to get the real version into the wheel metadata. The workflow: - Runs a matrix job per package on parallel runners. - Computes version / commit / branch from the release tag via dunamai. - Overwrites the package's _version.py with the computed values so the wheel metadata picks up the release version (see the previous commit for why _version.py is the source of truth). - Pins the intra-workspace dependency before building palace-opds: uv build leaves workspace deps as bare `palace-util` in the wheel's Requires-Dist, which would fail to resolve on PyPI; we sed in `palace-util==<version>` so consumers installing palace-opds get the matching palace-util. - Uploads via pypa/gh-action-pypi-publish@release/v1 with OIDC.
8d9177c to
89c505b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two things:
Dynamic versioning for both workspace packages. Each package's
pyproject.tomlnow declaresdynamic = ["version"]and sources the version from a committed_version.pystub via hatchling's built-inregexversion source. The stub carries a dev placeholder (0.0.0.dev0,__commit__ = None) souv build --package …works out-of-box for local and CI builds without an explicit version override. The release workflow overwrites_version.pywith real dunamai-computed values right beforeuv build, so the wheel metadata picks up the real version.publish-pypi.ymlworkflow triggered by published GitHub Releases. Matrix-builds both packages in parallel, uses PyPI's Trusted Publishing (OIDC) flow. The workflow also pins the intra-workspace dep, sopalace-opdsalways depends on the most recent palace-util.Motivation and Context
With
palace-utilandpalace-opdsextracted as standalone packages, they should be installable from PyPI so downstream Palace services (and the wider OPDS-consuming community forpalace-opds) can depend on them without pulling in thepalace-managermonorepo.palace-manageritself is intentionally NOT published here — it needs additional work first (alembic and friends prevent a clean wheel build).One-time PyPI setup
I need to setup trusted publishing in pypi before we cut a release with this. This is a work in progress. 🚧This setup is complete now.
How Has This Been Tested?
I set this up in my own fork, and published test packages to test.pypi.org. Using the same workflow they published correctly for me:
Checklist