Repository navigation
Conversation
Each wheel is almost entirely the bundled CLI binary, and with the bundled CLI 2.1.280 the Windows wheel is 106,572,002 bytes, over PyPI's
104,857,600-byte (100 MiB) per-file limit. "wheel tags" writes the
final wheel at zlib's default level, and neither it nor hatchling has
a setting for that.
Add --recompress {zlib,zopfli} to scripts/build_wheel.py. After the
wheel is retagged, it is rewritten with every deflated member
compressed again: with zlib level 9, or with zopfli, which produces
ordinary deflate about 3.5% smaller. On the Windows wheel with 2.1.280
that is 3.55 MiB, to 102,853,707 bytes, and it took 18 to 31 minutes
on one core in local runs. GitHub's runners were not measured.
Nothing else changes. Member names, order, contents, dates and file
modes stay as they were, so RECORD stays valid and pip installs the
wheel as before. The script reads the rewritten wheel back and stops
the build if any of that differs.
Both wheel-building workflows now pass --recompress zopfli. That adds
the zopfli package (fonttools/py-zopfli, a compiled extension) to the
release build. It is pinned to version 0.4.3 and to the sha256 of the
four wheels the runners use, in scripts/requirements-recompress.txt,
and installed with --require-hashes. If the flag is given and the
package is missing, the build fails. It does not fall back. Without
the flag, build_wheel.py behaves as before and needs no new package.
This delays the limit by a release or two. It does not remove it.
The pre-flight check's 49.5 GiB threshold was set when the project was close to it, and with the bundled CLI 2.1.280 a full release adds about 0.46 GiB. Raise the threshold to 49.9 GiB, which keeps 0.1 GiB between it and PyPI's 50 GiB limit. A release that would take the project past 49.9 GiB is still refused before anything is uploaded. Also make the step fail when it cannot fetch the project's metadata from PyPI. Until now it printed a warning and let the upload go ahead, and close to the quota an upload could run into PyPI's limit part-way and leave only some of the release's files public. A failed fetch now stops the job before anything is uploaded, and the job can be re-run once pypi.org responds. QUOTA_BYTES is unchanged, so scripts/check_pypi_quota.py needs no change.
PyPI rejects a file over its per-file limit, which is 100 MiB (104,857,600 bytes) by default. The pre-flight step checks only the project's total size, and the upload step sends the sdist and then the wheels one at a time. So an oversized wheel stops the release part-way, with the sdist and the wheels before it already public. Check every file in dist/ and sdist/ in the pre-flight step, and fail before the upload step runs. The check comes before the PyPI metadata fetch, so it still runs when that fetch fails. A file of exactly 104,857,600 bytes passes, and one byte more fails. The step also prints the largest file's size on every run. With the bundled CLI 2.1.280 the Windows wheel is about 98 MiB after recompression and about 101.6 MiB without it. A run that this check stops uploads nothing. If PyPI raises this project's per-file limit, update FILE_LIMIT_BYTES here and PYPI_FILE_LIMIT_BYTES in scripts/check_pypi_quota.py together. Otherwise the check would stop a release that PyPI would accept.
…2.158 PyPI has five of 0.2.157's six files: its Windows wheel was over the per-file limit, so that release stopped after the other files were up, and no release commit or tag was made. The version files therefore still say 0.2.156, and each automatic release computes 0.2.157 again. It can only add a Windows wheel to 0.2.157, and PyPI does not accept a filename twice, so 0.2.157 cannot be published again as a whole. Set the version files to 0.2.157, which is what the release would have committed. The next automatic release then computes 0.2.158 and publishes all six of its files.
The pre-flight check reads the project's current size from PyPI before uploading, and fails closed when it cannot. That lookup was a single request, so a brief PyPI error failed the release after all five wheels had been built. Retry it up to four times with a doubling delay (5, 10 and 20 seconds) and still fail without uploading anything if every attempt fails.
This branch has not been deployed
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.
Stacked on #1283 (base is that branch; GitHub will retarget or I will rebase onto
mainonce it merges).What
The release's "Pre-flight PyPI quota check" reads the project's current size from PyPI with a single request. After #1283 that step fails closed when the request fails. This retries the request up to four times with a doubling delay (5, 10, 20 seconds), and still exits 1 without uploading anything if all four attempts fail. The per-file size check stays above the fetch, so it still runs and names the file when PyPI is unreachable.
Why
The step runs after all five wheels are built (about half an hour), so one transient error from pypi.org would otherwise throw that build away and need a full re-run. Retries cover network errors, timeouts, HTTP 5xx and a truncated response body.
Verification
Extracted the step from the workflow and ran it with a stubbed
urlopenandtime.sleep:::error::lineWorst case the step now waits about 35 seconds plus four 30-second request timeouts.