fix: fall back to setuptools when declared sdist build backend is unavailable#1106
Draft
xangcastle wants to merge 1 commit into
Draft
fix: fall back to setuptools when declared sdist build backend is unavailable#1106xangcastle wants to merge 1 commit into
xangcastle wants to merge 1 commit into
Conversation
✨ Aspect Workflows Tasks📅 Thu Jun 11 15:54:11 UTC 2026 ❌ 6 failed tasks
✅ 1 successful task
🛠️ Fix❌ buildifier (buildifier)❌ gazelle (gazelle)Install 🔁 Reproduce❌ buildifier (buildifier)❌ gazelle (gazelle)❌ test (test-e2e-bazel-8 · test-e2e-bazel-9)❌ test (test-root-bazel-8 · test-root-bazel-9)Install ⏱ Last updated Thu Jun 11 16:25:18 UTC 2026 · 📊 GitHub API quota 823/15,000 (5% used, resets in 45m, throttle 3×) |
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.
When building a wheel from an sdist, the build venv only contains the packages listed in default_build_dependencies (typically build, setuptools, and wheel). If a package declares a different build backend in its pyproject.toml (hatchling, flit, poetry-core, etc.) the python -m build --no-isolation invocation fails immediately because the backend module is not importable.
This adds ensure_build_backend() to a new build_backend.py module (imported by build_helper.py) that detects this situation before the build starts: if the declared backend is not importable it rewrites the [build-system] table to use setuptools.build_meta, and for environments running setuptools < 61.0 (which predates PEP 621 [project] table support) it also generates a setup.cfg from the parsed project metadata so the build can proceed without a modern setuptools.
Changes are visible to end-users: no
Test plan