Skip to content

feat: add safety checks to the PyPI publish workflow - #201

Open
chrisgong52 wants to merge 2 commits into
mainfrom
feat/94645-publish-safety
Open

chrisgong52 wants to merge 2 commits into
mainfrom
feat/94645-publish-safety

Conversation

@chrisgong52

Copy link
Copy Markdown
Contributor

Summary

Makes publish.yml safe to run and re-run:

  • Smoke-tests the built wheel (scripts/smoke-wheel.sh) before any upload.
  • Adds a dry-run input: every check runs, the upload and post-publish install are skipped.
  • Compares with PyPI: files already there aren't uploaded again; the run fails if the rebuilt wheel's SHA-256 differs.
  • Reproducible wheel: SOURCE_DATE_EPOCH from the tag commit, pinned build deps, Python 3.11, uv 0.13.5.
  • New verify job: uv tool install from PyPI with retries, fails unless arize-harness --version prints the version.
  • CONTRIBUTING.md covers dry-run, re-running and yanking.

Wheel only. The sdist isn't reproducible (tar/gzip headers carry build time), so only the wheel hash is compared.

0.1.0rc1 can't match. It was built before this change with run-time zip timestamps. A re-run of it always fails the hash check; contents are identical, timestamps aren't.

resolves Arize-ai/arize#94645

Type of change

  • New feature
  • Documentation

How tested

Locally, with no workflow runs:

  • Built v0.1.0rc1 twice with the workflow's settings. Wheel 4ceedc5a… both times; sdist differs each build. PyPI: wheel 741ffaac…, sdist a0f64872….
  • Compare logic against PyPI's real JSON: skips on PyPI's own files, fails on a one-byte-modified wheel, queues both files for an unpublished version.
  • smoke-wheel.sh on a wheel from this branch: OK.
  • Install loop: passes for 0.1.0rc1, fails after retries for a missing version.
  • actionlint clean.

To do after merge, from main (links to follow):

  • dry-run on a new valid tag
  • dry-run with a forced smoke failure
  • real release of a new rc, then a re-run of it (match → skip)

Checklist

  • Tests pass (uv run pytest tests/ -m "not slow")
  • Pre-commit clean (uv run pre-commit run --all-files)
  • Ran the code-review skill and addressed findings
  • Docs updated if needed

🤖 Generated with Claude Code

Smoke-test the wheel before upload, add a dry-run input, skip files
already on PyPI and fail on a wheel hash mismatch, build reproducibly,
and check the version installs from PyPI after upload.

Refs Arize-ai/arize#94645

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/publish.yml Outdated
env:
TAG: ${{ inputs.tag }}
shell: uv run --no-project python {0}
run: |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@chrisgong52 can we put this in a separate python file instead of in "inline" yaml?

publish.yml checks the script out from the workflow's own commit, since
release tags cut before it was added don't contain it. Adds one offline
test for the wheel hash mismatch case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants