ci: pre-flight size+twine check before PyPI upload; drop redundant lint-version#14
Closed
r-barnes wants to merge 4 commits into
Closed
ci: pre-flight size+twine check before PyPI upload; drop redundant lint-version#14r-barnes wants to merge 4 commits into
r-barnes wants to merge 4 commits into
Conversation
Pre-flight (before pypa/gh-action-pypi-publish): - Fails the job if any file in pypi_dist/ exceeds PyPI's 100 MB per-file limit, aborting before any file is uploaded. - Runs twine check --strict to catch metadata/RECORD issues early. This keeps the index clean: a rejection mid-upload leaves a partial release that blocks future retries via the version-already-exists check. Remove lint-version.py from validate: lint-version.py checks TestPyPI and hard-fails if the version is already there. After a partial upload (some files succeeded before a rejection), this blocked all subsequent retries even though skip-existing: true would have handled the re-upload correctly. lint-version.py is already a required CI gate via lint-version.yml in REQUIRED_WORKFLOWS, so running it again here is redundant and actively harmful on retry.
A partial upload (some files succeeded before a rejection) is now treated as unrecoverable rather than retryable. skip-existing: true is removed so a re-run after a partial upload fails explicitly instead of silently completing a mismatched set. The pre-flight step queries the TestPyPI JSON API and aborts before touching the index if any files for this version are already there, with a message directing the operator to bump the version or yank the partial release.
The release workflow can be triggered manually via workflow_dispatch independently of regular CI, so lint-version.py's format/monotonicity/ tag checks are still needed. The index (PyPI/TestPyPI already-published) check is skipped here because the pre-flight step in publish owns it with a clearer error message — and the index check would permanently block retries after a partial upload.
db65f66 to
ab75ae0
Compare
|
@r-barnes has imported this pull request. If you are a Meta employee, you can view this in D108520140. |
|
@r-barnes merged this pull request in facebookincubator/rebalancer@cbf40858652e584de5a466080dec9739fcbf7566. |
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.
Summary
Two changes to
release.ymlto make PyPI uploads more robust:1. Pre-flight validation before upload
Adds a step between artifact download and
pypa/gh-action-pypi-publishthat validates every file inpypi_dist/before any upload begins:twine check --strict: validates wheel metadata, RECORD integrity, and sdist structurePyPI has no atomic upload API — files land one at a time with no rollback. A rejection mid-upload (e.g. an oversized Linux wheel) leaves a partial release on the index, which then blocks future retries via the "version already exists" check. Failing before touching PyPI keeps the index clean.
2. Remove
lint-version.pyfromvalidatelint-version.pychecks both PyPI and TestPyPI and hard-fails if the version is already present. After the partial v1.0.0 upload (macOS wheels + sdist succeeded before Linux wheels hit 100 MB), this check permanently blocked retries — even thoughskip-existing: truewould have handled the re-upload correctly.lint-version.pyis already a required CI gate vialint-version.ymlinREQUIRED_WORKFLOWS. By the time the release runs, the version has already been validated. Running it again here is redundant and actively harmful on retry.Test plan
twine checkon a good set of distributions