Repository navigation
ci(release): refuse PyPI publication without storage headroom (#1756) - #1787
Merged
Merged
Conversation
PyPI enforces the 10 GB project storage limit mid-upload: it accepts the first files of a release, then rejects the remainder with '400 Project size too large'. v2.5.46 stranded that way at 1 of 5 wheels, so PyPI advertised a version only Intel macOS could install. ci/publish.py gains a storage preflight (pypi_project_bytes, estimate_upload_storage for the prepare stage, measured_upload_storage for the real wheel sizes) plus a narrow 'python -m ci.publish' CLI. prepare refuses a dispatch the estimate says cannot fit; build-pypi repeats the check with the built wheels before publish-pypi runs. Refs #1756.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Why
PyPI caps a project's total stored bytes at 10 GB and enforces the cap mid-upload: it accepts the
first files of a release and then rejects the rest with
400 Project size too large. That is exactlywhat happened to v2.5.46 (#1756) — 1 of 5 wheels uploaded, so PyPI advertised a version only Intel
macOS could install. Nothing in the release pipeline noticed the quota until files were already
committed to an immutable version number.
What changed
ci/publish.pygains a storage preflight, and both release stages now consult it before anyupload:
prepareestimate_upload_storage()— no wheels are built yet, so per-wheel weight is estimated from this version's already-stored files (the stranded-release case), else the largest wheel of any older release. Refuses the dispatch while nothing has been uploaded.build-pypimeasured_upload_storage()— real wheel sizes, fetched against live PyPI JSON, immediately beforepublish-pypiruns.publish-pypiVerify all wheels visible on PyPI(existing) still catches a genuine partial upload.The module gains one narrow CLI,
python -m ci.publish --pypi-json <saved json> [--version V --expected-wheels N | --wheel dist/wheels/*.whl],which prints the verdict and exits non-zero when the batch would not fit. No upload code, no auth, no
secrets — OIDC trusted publishing is untouched.
Refusal message is actionable and names the doc URL:
Verification (real output)
Against live
https://pypi.org/pypi/fbuild/json(fetched during this run):So the guard passes an already-complete version and refuses the next release, which is the live
situation: 92 versions / 9.870 GB, ~130 MB free, one release ≈ 204 MB.
Gates (all run locally, real output):
uv run --no-project python -m unittest ci.test_publish_quota→ 15 tests, OK (project-sizesummation, malformed/missing
sizefields, stranded-version estimate, fresh-release fallback,exact-headroom boundary, one-byte-over boundary, measured mode, CLI exit codes)
--with pyyaml python -m unittest ci.test_fractional_workflows ci.test_local_gate ci.test_local_dylint_gate ci.test_publish_quota→ 47 tests, OK
ci/render_workflows.py --check→ rc=0;ci/check_workflow_concurrency.py→ OKruff check ci/publish.py ci/test_publish_quota.py ci/local_gate.py→ all checks passedci/check_python_complexity.py→ all checks passedNot run: the Rust workspace suite (
bash test) — this diff touches no Rust, and the full run is ~1 h.Notes
ci/test_publish_quota.pyis registered inci-workflow-drift.ymlandci/local_gate.pyso itruns in CI rather than only by hand.
skip-existingwould skip, i.e. it is deliberatelyconservative.
docs/RELEASING.mddocuments both guards and the maintainer recovery path (increase limit orprune old releases, then re-dispatch the same candidate SHA with
publish=true).Refs #1756 (recovery of 2.5.46 itself remains a maintainer action in the PyPI web UI).