Repository navigation
fix(release): publish every package version missing from PyPI - #35
Kevin-Liu-01 wants to merge 2 commits into
Conversation
Every release-PR merge from 2026-03-09 to 03-19 failed in the publish job's tag step, which stopped the run before the build and publish steps. The 0.1.1 to 0.3.0 tags exist, but PyPI still serves gt-i18n 0.1.0 and generaltranslation 0.0.4. On a version-bump run on main, or a manual run, the publish job now builds every package version that PyPI does not have, even when tagging or the release notes failed. It asks PyPI first: a 404 builds the version, a 200 skips it, and any other status fails the run. It refuses to build a version whose package code changed since that version's tag. It publishes only when every build succeeded, and only from main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| version=$(grep '^version = ' "$pkg/pyproject.toml" | head -1 | sed 's/.*"\(.*\)".*/\1/') | ||
| status=$(curl -sS -o /dev/null -w '%{http_code}' --retry 3 --retry-all-errors "https://pypi.org/pypi/$name/$version/json" || true) | ||
| case "$status" in | ||
| 200) echo "$name $version is already on PyPI"; continue ;; |
There was a problem hiding this comment.
Retries leave release files missing
If an upload stops after only one file reaches PyPI, the 200 branch skips that version on every later run. uv build creates a wheel and a source archive, so a manual retry can leave either file missing. Check the files returned by PyPI, then build incomplete releases and skip files that were already uploaded.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/release.yml
Line: 112
Comment:
**Retries leave release files missing**
If an upload stops after only one file reaches PyPI, the `200` branch skips that version on every later run. `uv build` creates a wheel and a source archive, so a manual retry can leave either file missing. Check the files returned by PyPI, then build incomplete releases and skip files that were already uploaded.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in a6abdea. The build step now reads the version's file list from PyPI's JSON: a version with both its sdist and its wheel is skipped, a version with only one of them builds just the missing file with uv build --sdist or --wheel, and a 404 still builds both. A dry run of the step with stubbed uv calls and fixture responses for an sdist-only and a wheel-only version built only the missing file in each case.
uv build makes a wheel and an sdist for each package, and uv publish uploads them one at a time. If an upload stopped after the first file, PyPI answered 200 for that version, every later run skipped it, and the other file was never published. The build step now reads the version's file list from PyPI's JSON. A version with both files is skipped. A version with only one of them builds the missing one with uv build --sdist or --wheel. A version that is not on PyPI builds both, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
PyPI still serves gt-i18n, gt-flask and gt-fastapi 0.1.0, generaltranslation 0.0.4, and generaltranslation-intl-messageformat and generaltranslation-supported-locales 0.0.4. Every release-PR merge from 2026-03-09 to 2026-03-19 failed in the publish job's tag step, and that failure stopped the run before the build and publish steps. The tags for 0.1.1 to 0.3.0 exist on GitHub, but no GitHub release or PyPI upload was made from them.
This PR changes
.github/workflows/release.yml:workflow_dispatch). The sampo release job runs only on a push, and the publish job runs only from main.!cancelled()).README.mdandCHANGELOG.md, and the whole run stops with an error that names the package.fetch-depth: 0, so the tags and the diff against them are available.Size: 1 file, +48/-8.
Decisions
pyproject.tomlversion changed in the pushed commit, or on a manual run.Test plan
After review, on a6abdea (origin/main is still c3fe22b on 2026-10-16):
bash -npasses on the build step's script.uv buildreplaced by an echo and real PyPI lookups: the same six versions build, and generaltranslation-icu-messageformat-parser 0.0.3 is skipped.--wheel, a version with only its wheel builds--sdist, a 200 with no files builds both, a 503 stops the run with exit code 1, and a 200 whose body is not JSON stops it at jq.Before review, on this branch (
k/publish-missing-versionsat 6eaeb03, on origin/main c3fe22b, still the latest main on 2026-10-11):pushandworkflow_dispatch, and the job and step conditions are the ones listed above.uv buildreplaced by an echo and real PyPI lookups: it would build generaltranslation-intl-messageformat 0.0.5, generaltranslation-supported-locales 0.0.6, generaltranslation 0.1.0, gt-fastapi 0.3.0, gt-flask 0.3.0 and gt-i18n 0.3.0. It skipped generaltranslation-icu-messageformat-parser 0.0.3, which is already on PyPI.k/gt-i18n-cache-expiry), which changes gt-i18n without a version bump, stopped with "gt-i18n changed since [email protected]; bump its version before publishing" and exit code 1.uv sync --all-packages --locked,ruff check .,ruff format --check .,mypy .(163 files) andpytest(1,399 passed): clean. This PR does not change Python code.Not run: the workflow on GitHub Actions itself, and actionlint, which is not installed on this machine.
Merge order
pip install gt-flask==0.3.1would then fail because generaltranslation 0.1.0 is not on PyPI.k/gt-i18n-cache-expiry)), then fix(gt-flask,gt-fastapi): load translations for every configured locale (fix(gt-flask,gt-fastapi): load translations for every configured locale #37 (k/flask-fastapi-configured-locales)).k/python-quickstart-loads-translations)), after 0.3.1 is on PyPI.Ernest McCarter wrote most of gt-python. He, or whoever holds the PyPI token, should review this PR and merge the release PR.
🤖 Generated with Claude Code
The PR appears safe to merge, with a non-blocking improvement needed to recover incomplete uploads.
Fix with agent prompt
Summary
Updates
.github/workflows/release.ymlto recover current package versions missing from PyPI.Kevin-Liu-01 explicitly limits recovery to current versions, permits publishing after tagging fails, and requires changed package code to receive a version bump before any upload.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Push to main or manual run] --> B{Version changed or manual run?} B -->|No| C[Skip build and upload] B -->|Yes| D[Check each current version on PyPI] D -->|200| E[Skip version] D -->|404| F{Package differs from its existing tag?} D -->|Other status| G[Stop without uploading] F -->|Yes| G F -->|No| H[Build package] E --> I{All packages checked and builds succeeded?} H --> I I -->|Yes| J[Upload built files, if any] I -->|No| GReviews (1) · Last reviewed commit: "fix(release): publish every package vers..." · Reviewed by Greptile