Skip to content

ci: publish release binaries to PyPI as platform wheels - #4823

Merged
max-sixty merged 4 commits into
mainfrom
ci/publish-pypi
Nov 21, 2026
Merged

max-sixty merged 4 commits into
mainfrom
ci/publish-pypi

Conversation

@worktrunk-bot

@worktrunk-bot worktrunk-bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a PyPI channel for the release, as requested in #4822: uvx --from worktrunk wt, worktrunk as a pyproject.toml dependency, and PEP 723 scripts. Instead of building with maturin, a new job turns the five GitHub Release archives into wheels with wt and git-wt in the scripts directory. PyPI then ships the same bytes as GitHub Releases, Homebrew and winget, including the SignPath-signed wt.exe.

Needs before the first publish: a pending trusted publisher on PyPI for project worktrunk (still unregistered — pypi.org/pypi/worktrunk/json returns 404), with owner max-sixty, repo worktrunk, workflow release.yaml and environment release. Until that exists, publish-pypi fails on the next release. That doesn't block the rest of the release, because the job isn't in announce's needs.

Changes

  • .github/build-wheels.py (stdlib only) reads each worktrunk-<target>.{tar.xz,zip} and writes worktrunk-<version>-py3-none-<platform>.whl containing the two binaries plus METADATA (README as the description, with relative links pointed at the release tag so the logo renders on PyPI; License-Expression: MIT OR Apache-2.0), LICENSE, WHEEL and RECORD. The timestamps are fixed, so the same archives give identical wheels. It errors if any of the five targets is missing, or if the version isn't plain X.Y.Z.
  • build-pypi-wheels runs after host. It downloads the release archives, checks them against their .sha256 files, builds the wheels, runs twine check --strict, and install-smoke-tests the Linux wheel. On PRs it runs against the latest release and doesn't publish, so the packaging gets exercised on every PR. That adds one ~100 MB download job per PR.
  • publish-pypi (environment release, id-token: write) uploads the wheels with pypa/gh-action-pypi-publish, pinned to the SHA of v1.14.3. Prereleases are skipped, as Homebrew skips them.
  • The PyPI long description opens with a one-line note marking the package experimental, naming GitHub Releases, Homebrew and cargo as the main install channels.
  • The release skill (.claude/skills/release/SKILL.md) now lists AUR and PyPI (experimental) among the channels release.yaml publishes to.
  • .github/AGENTS.md now lists PyPI among the release environment's OIDC uses.

Platform tags: the Linux archives are static musl builds, so they get both manylinux_2_17 and musllinux_1_1 tags. macOS uses Rust's default floors (macosx_10_12_x86_64, macosx_11_0_arm64), and Windows uses win_amd64.

Verification

I ran the job's steps locally against the v0.82.0 release assets: all five checksums matched, all five wheels passed twine check --strict, and the x86_64 Linux wheel installed with pip, uv pip and uvx --from worktrunk wt --version. All three printed wt v0.82.0, and the installed wt is byte-identical to the one in the archive. I haven't installed the macOS or Windows wheels on those platforms. The publish step itself can only run on a release tag.

Left for later

  • Install docs (README and the install page). Adding them before a version is actually on PyPI would point users at a package that doesn't exist yet. When they're added, they should label PyPI experimental too.
  • On Windows the wheel installs wt.exe next to git-wt.exe, so a script that runs wt gets whichever wt comes first on PATH. In an activated venv or under uvx that's the venv's copy.

Closes #4822

Repackage the GitHub Release archives into platform wheels carrying wt and
git-wt, and publish them with PyPI Trusted Publishing from the release
environment. Reusing the archives keeps PyPI on the same bytes as every
other channel, including the signed Windows binary.

The wheel build runs on PRs against the latest release; publishing needs a
trusted publisher configured on PyPI and is kept out of announce's needs.

Refs #4822

Co-Authored-By: Claude <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PyPI project page will show a broken logo. The README opens with <img src="docs/public/logo.png" ...>, and this text becomes the long description unchanged. crates.io resolves relative image paths against the repository, but PyPI doesn't, so the image 404s on every release page. I'll push a fix that rewrites relative src/href targets to the release tag's raw GitHub URLs.

Comment thread .github/build-wheels.py Resolved
PyPI renders the long description without a base URL, so the README's
relative logo src would show as a broken image. Point relative src/href
targets at the release tag's raw GitHub content.
@max-sixty

Copy link
Copy Markdown
Owner

@worktrunk-bot Max wants to try this, labelled experimental. Please:

  • Mark the PyPI channel experimental where users meet it: a one-line note at the top of the long description PyPI renders (for example "Experimental: the PyPI package is new; GitHub Releases, Homebrew and cargo are the main install channels"), and the same word when the install docs add PyPI later.
  • Add PyPI (experimental) and AUR to the channel list in .claude/skills/release/SKILL.md, which still reads "publishes to crates.io, Homebrew, and winget".

This merges once CI is green on the new head. The pending trusted publisher on PyPI is Max's to register; until it exists, publish-pypi fails without blocking the rest of the release.

This was written by Claude Code on behalf of max-sixty

@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Done in 0c78523. CI went green on that head, including build-pypi-wheels and codecov/patch.

  • The PyPI long description now starts with: "> Experimental: the PyPI package is new; GitHub Releases, Homebrew and cargo are the main install channels."
  • .claude/skills/release/SKILL.md now says release.yaml publishes to "crates.io, Homebrew, winget, AUR, and PyPI (experimental)".
  • The PR description's "Left for later" section now says the install docs should call PyPI experimental when they add it.

Merge mode here is restricted, so I'll leave the merge to you.

@max-sixty
max-sixty merged commit 5a38af8 into main Nov 21, 2026
38 checks passed
@max-sixty
max-sixty deleted the ci/publish-pypi branch November 21, 2026 01:34
max-sixty added a commit that referenced this pull request Nov 21, 2026
#4789 added a `workflow_dispatch` trigger with a `release_tag` input, so
a run started from a trusted non-version tag could publish an existing
version tag, plus plumbing that pinned every job to that tag's commit.
The 0.82.0 recovery used it. Its keyless signing certificate names the
run's own ref, `release.yaml@refs/tags/release-recovery-nov14`, instead
of `refs/tags/v0.82.0`, so aqua, and mise's `aqua:` backend, refuse to
install 0.82.0 (#4829). The trigger also lets anyone with write access
start a run that reaches the `release` environment (#4797).

This removes the trigger and its plumbing. `release.yaml` now matches
its pre-#4789 form apart from #4805's packslip bump, #4823's PyPI jobs,
and two `persist-credentials: false` lines (below). The macOS runner
pins in `dist-workspace.toml` stay. A release whose workflow breaks now
ships as the next patch version, and the release skill says so at the
step that watches the run.

To weigh:

- The `release-recovery-nov14` tag is the only ref whose `release.yaml`
still has the trigger, so a dispatch against it reaches `release` until
an admin deletes the tag. `tend check` reads only the default branch, so
it passes once this merges.
- The `persist-credentials: false` lines #4789 added to the crates.io
and AUR checkouts stay. They don't depend on the dispatch path, and both
jobs passed with them in the recovery run.
- #4823's `build-pypi-wheels` checked out
`needs.plan.outputs.source-sha`. It now takes the default checkout,
which is the version tag on a tag push and the PR ref on a PR, as it was
for every job before #4789.

Max chose this on a review page. Checks: `dist plan` (0.30.2) still puts
the macOS targets on `macos-26` and `macos-26-intel`; actionlint reports
the same 7 shellcheck findings as `main`; pre-commit passes.

Closes #4797

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 21, 2026
0.83.0 is the first release on PyPI (#4823), so the install docs can now
list it. This adds a **PyPI (experimental)** entry under "Windows &
other", after Conda / Pixi. It shows `uv tool install worktrunk@latest
&& wt config shell install`, then one line for the two uses #4822 asked
for: listing `worktrunk` as a dependency, and `uvx --from worktrunk wt
list` without installing.

`@latest` makes a rerun of the line upgrade, as `brew install` and
`cargo install` do for their entries. Without it, `uv tool install
worktrunk` answers "`worktrunk` is already installed" and keeps the old
version. I checked this with ruff in a scratch tool directory, because
worktrunk has only one version on PyPI so far. `-U` behaves the same,
but `@latest` is how Ruff's README writes its install line. The `uvx`
line needs neither: an unpinned `uvx --from` resolved the newest version
even with an older one cached.

"Experimental" matches the note at the top of the package's PyPI
description. #4823 deferred this until a version was actually on PyPI.

I ran both commands against the published package in a scratch tool
directory. Each printed `wt v0.83.0`, and `uv tool install` put `wt` and
`git-wt` on the bin path. The README and both skill reference copies are
regenerated from `docs/src/content/docs/worktrunk.md`, and
`test_docs_are_in_sync` passes.

> _This was written by Claude Code on behalf of max-sixty_
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 this pull request may close these issues.

Publish worktrunk to PyPI

2 participants