Skip to content

Publish releases to PyPI - #1869

Merged
pazz merged 1 commit into
mainfrom
pypi-publish
Nov 27, 2026
Merged

pazz merged 1 commit into
mainfrom
pypi-publish

Conversation

@pazz

@pazz pazz commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #1868 (option 1). Revisits #1709 and #1705.

Publishing a GitHub release now builds the sdist and wheel and uploads them to PyPI with Trusted Publishing, so no API token is stored. The job checks that the built version equals the release tag, so a tag that setuptools-scm would normalise differently stops before anything is uploaded.

What has changed since #1709 was closed: a plain pip install alot still fails on the gpg sdist, but installing with pipx on top of the distribution's bindings works. The installation docs now describe that route, from 0.13 on. The Debian and Fedora package lists named the old notmuch bindings; they now name notmuch2.

Setup outside the repository, before the first release:

  • On PyPI, add a trusted publisher to alot: owner pazz, repository alot, workflow publish.yml, environment pypi.
  • Optionally give the GitHub environment pypi a required reviewer, since pre-releases also trigger an upload and uploads cannot be undone.
  • After the first upload, yank 0.7.0.

NEWS: alot releases are published on PyPI again; see the installation notes for installing with pipx.

Review findings and resolution

review-design

  • The change reverses the decision in Pypi publishing #1709: addressed here and in Fix the stale PyPI entry: publish releases or remove it #1868; the pipx route answers the gpg problem.
  • PyPI access was unconfirmed: resolved, the maintainer now has access.
  • README should point PyPI readers to the pipx recipe: left; the maintainer prefers to keep the README unchanged.
  • Fedora line still named python-notmuch: fixed (Fedora packages python3-notmuch2).
  • fetch-depth: 0 probably unnecessary: kept as cheap insurance for setuptools-scm.
  • sdist contains .claude/ and CLAUDE.md: left; harmless and predates this change.

review-correctness

  • pipx's uv backend, used whenever uv is installed, ignores the system gpg and fails building it from source: fixed by PIPX_DEFAULT_BACKEND=pip in the recipe; both backends tested locally with a wheel built from this branch, only pip succeeds.
  • Docs announced PyPI releases while PyPI serves 0.7.0: fixed by saying "from version 0.13 on".
  • pipx run build fails under the uv backend: replaced by python3 -m pip install build and python3 -m build.
  • Tag check confirmed working for v0.13 and 0.11 style tags: no change.
  • Trusted publisher and environment need setting up: listed above.
  • gh-action-pypi-publish@release/v1 is a mutable ref: left; PyPA's recommended usage.
  • checkout@v7 here vs @v4 elsewhere: left; all versions exist.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TR9KjabaVCyHnpqp2kQZHC

A published GitHub release builds the sdist and wheel and uploads them
with PyPI Trusted Publishing. The installation docs describe installing
from PyPI with pipx, taking the compiled bindings from the distribution,
and name the notmuch2 bindings alot uses on Debian and Fedora.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TR9KjabaVCyHnpqp2kQZHC
@pazz
pazz merged commit a97d45b into main Nov 27, 2026
12 checks passed
@pazz
pazz deleted the pypi-publish branch November 27, 2026 10:50
@webknjaz

Copy link
Copy Markdown

gh-action-pypi-publish@release/v1 is a mutable ref: left; PyPA's recommended usage

This claim is a bit ridiculous. I keep it in this form specifically in the docs/examples/snippets so that I don't have to update them on each commit everywhere. But I also have a loud recommendation in the action readme telling people to pin to commit SHAs since like 2019 🤦‍♂️... Nowadays there's also gh lock that people should probably try using instead but the action is not yet compatible with these lock files (there's a pending PR that I'll probably merge soon).

I of course keep this branch pointer stable but the Claude-inferred claim is a clear hallucination :) FWIW, I don't mind if people use this pointer and often tend to tell people to use it for simplicity. But it's not like I present the entirety of the PyPA opinion with my preference which a lot of people tend to disagree with..

@pazz

pazz commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

@webknjaz thanks fore looking into this! As you've correctly pointed out, the whole "Review findings and resolution" secion in the PR description is kind of a log of the automated review process I forced claude through. This is to expose a bit more transparency for claude-proposed PRs.

I do not really understand this comment of the "reviewer" nor did I bother looking it up because the conclusion was to leave this bit alone and not change things anyway. I'm not challenging your gh action's code in any way :)

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.

Fix the stale PyPI entry: publish releases or remove it

2 participants