build: declare the setuptools build backend floor (F-5426) - #138
Merged
ejohnstown merged 1 commit intoAug 3, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Pins the setuptools PEP 517 build requirement in pyproject.toml to reduce exposure to unvetted upstream changes during isolated builds.
Changes:
- Add an explicit version range for
setuptoolsin[build-system].requires
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MarkAtwood
marked this pull request as draft
July 10, 2026 16:47
MarkAtwood
force-pushed
the
fix/pin-setuptools-build-backend
branch
from
July 23, 2026 16:48
f31964d to
5ad0d0a
Compare
MarkAtwood
marked this pull request as ready for review
July 23, 2026 16:48
[build-system] declared bare `setuptools`, so isolated builds resolved
whatever version the index served at build time. This repo has no uv.lock,
so CI's `uv build --wheel` re-resolves the backend on every run.
Declare `setuptools>=77`. Nothing was broken before this: an unpinned
resolver always fetched a recent backend, so the build worked. The floor is
measured, not chosen. The PEP 639 `license` expression and `license-files`
key already in this file each require setuptools >= 77 independently (76 and
older reject either one alone, while the older `license = {file = ...}`
table form passes), so the project had an undeclared >= 77 requirement that
stayed invisible precisely because the version floated. Declaring it keeps a
build environment pinned below 77 from failing mid-build on an opaque
`project.license` config error with no hint that the fix is an upgrade.
No upper bound, matching the floor-only convention of every other bound in
this file (`cffi>=1.17`, `typing-extensions>=4.4.0`). A ceiling would not
address the reported risk anyway -- a malicious point release satisfies any
range, so only hash-pinned build requirements help there -- and setuptools
ships majors often enough (7 since 2025-03, with 81 and 82 two days apart)
that a stale ceiling silently excludes working versions instead of
protecting anything.
Verified: builds at 77.0.3 and 83.0.0, 76.1.0 refused at resolve time,
License-Expression intact in wheel METADATA, ruff clean, 196 passed.
MarkAtwood
force-pushed
the
fix/pin-setuptools-build-backend
branch
from
July 31, 2026 22:05
5ad0d0a to
ef980e4
Compare
ejohnstown
approved these changes
Aug 3, 2026
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.
Problem
pyproject.tomldeclaressetuptoolsas a PEP 517 build requirement with no version bound:In an isolated build (the PEP 517 default), the frontend resolves whatever
setuptoolsthe index currently serves before running the backend. This repo has nouv.lock, so CI'suv build --wheelre-resolves the backend on every run.Nothing is broken today: an unpinned resolver always picks a recent backend, so the build works. This is about declaring what the project actually requires.
Fix
The floor is measured, not chosen. The PEP 639
license = "GPL-3.0-or-later OR LicenseRef-WolfSSL"expression and thelicense-fileskey already in this file each requiresetuptools >= 77independently — 76.1.0 rejects either one on its own, while the olderlicense = {file = ...}table form passes. So the project already had an undeclared>= 77requirement that stayed invisible precisely because the version floated. Without this, a build environment that pins below 77 for unrelated reasons fails mid-build on an opaqueproject.license must be valid exactly by one definitionerror, with no hint that the fix is asetuptoolsupgrade.No upper bound, which is a change from the first version of this PR. Reasons:
setuptoolshas shipped 7 majors since 2025-03 (81 and 82 two days apart). A ceiling needs bumping several times a year, and a stale one silently excludes working versions instead of protecting anything — this PR's original<81already excluded the current 83.cffi>=1.17,typing-extensions>=4.4.0).Hash-pinning the build environment for release builds is the real mitigation for index compromise; that is out of scope here and tracked separately.
Verification
No solution found when resolving: setuptools>=77License-Expression: GPL-3.0-or-later OR LicenseRef-WolfSSLintact in wheelMETADATAruff checkclean;pytest tests196 passed, 7 skippedReported by static analysis (Fenrir finding F-5426).
[fenrir-sweep:released]