Pin build-system setuptools to >=77 for PEP-639 SPDX license#1448
Open
dparikh79 wants to merge 1 commit into
Open
Pin build-system setuptools to >=77 for PEP-639 SPDX license#1448dparikh79 wants to merge 1 commit into
dparikh79 wants to merge 1 commit into
Conversation
`pyproject.toml` declares the license as a plain SPDX expression
(`license = "Apache-2.0"`) per PEP-639. Setuptools added native
PEP-639 support in 77.0.0. Older setuptools releases validate
against pre-PEP-639 PEP-621, which required the license field to be
a table (`{ file = ... }` or `{ text = ... }`) and rejects the plain
string with:
ValueError: invalid pyproject.toml config: `project.license`
... must be valid exactly by one definition (2 matches found)
This caused the FreeBSD Poudriere build to fail because the build
environment was using a pre-77 setuptools without the explicit
constraint to pull a newer one. Pinning `setuptools>=77` in the
build-system requires forces PEP-517-isolated build environments to
install a setuptools that understands the SPDX form, fixing the
reported build failure without giving up the modern license format.
Refs simonw#1444
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.
Refs #1444.
pyproject.tomldeclares the license as a plain SPDX expression (license = "Apache-2.0"), which is the modern PEP-639 form. Setuptools added native PEP-639 support in 77.0.0; pre-77 setuptools validates against pre-PEP-639 PEP-621 and requires the license field to be a table:The reporter hit this on FreeBSD Poudriere because the build environment was using a pre-77 setuptools and
[build-system].requireswas just["setuptools"]with no version constraint, so no newer setuptools got pulled in for the build.Pinning
setuptools>=77in[build-system].requiresforces PEP-517-isolated build environments to install a setuptools that understands the SPDX form, which fixes the reported build failure without giving up the modern license format that PEP-639 explicitly recommends.Alternative I considered and didn't take: switch the project field to the legacy table form (
license = { text = "Apache-2.0" }). That also works on old setuptools, but PEP-639 deprecates the table form and modern setuptools (77+) emits a warning for it; the build-system pin keeps the file aligned with current packaging standards.Validation
python -c "import tomllib; tomllib.loads(open('pyproject.toml','rb').read().decode())"parses clean.license = "Apache-2.0"validates without warning when the new build constraint is honored.AI Assistance Disclosure
This PR was drafted with AI assistance (Claude Code). I read the issue, traced the PEP-639 vs pre-PEP-639 setuptools history, considered the legacy-table-form alternative the reporter proposed, and chose the build-system pin because it keeps the project on the modern license format. The change is a single character on one line and the tradeoff is captured above for your call.