Skip to content

fix: fall back to setuptools when declared sdist build backend is unavailable#1106

Draft
xangcastle wants to merge 1 commit into
1.xfrom
fix/uv-sdist-build-backend-fallback
Draft

fix: fall back to setuptools when declared sdist build backend is unavailable#1106
xangcastle wants to merge 1 commit into
1.xfrom
fix/uv-sdist-build-backend-fallback

Conversation

@xangcastle

Copy link
Copy Markdown
Member

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

  • New test cases added

@aspect-workflows

aspect-workflows Bot commented Jun 11, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Thu Jun 11 15:54:11 UTC 2026

❌ 6 failed tasks

  • ❌ buildifier · ⏱ 19.9s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in diff · Format failed (1 file needs format)
  • ❌ gazelle · ⏱ 26.5s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in diff · Gazelle failed (1 out of date)
  • ❌ test (test-e2e-bazel-8) · ⏱ 31m 3s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed
  • ❌ test (test-e2e-bazel-9) · ⏱ 18m 10s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed
  • ❌ test (test-root-bazel-8) · ⏱ 24m 9s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed
  • ❌ test (test-root-bazel-9) · ⏱ 30m 9s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed

✅ 1 successful task

  • ✅ test (test-examples-uv_pip_compile-bazel-8) · ⏱ 27.6s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)

🛠️ Fix

❌ buildifier (buildifier)

aspect buildifier --severity=info -- uv/private/pep517_whl/BUILD.bazel
# without Aspect CLI
bazel run --run_in_cwd @buildifier_prebuilt//buildifier -- uv/private/pep517_whl/BUILD.bazel

❌ gazelle (gazelle)

aspect gazelle --severity=info --check-only=false -- uv/private/pep517_whl
# without Aspect CLI
bazel run //tools/gazelle:gazelle

Install aspect: docs.aspect.build/cli/install

🔁 Reproduce

❌ buildifier (buildifier)

aspect buildifier --severity=fail --base-ref=origin/1.x

❌ gazelle (gazelle)

aspect gazelle --severity=fail --check-only=true

❌ test (test-e2e-bazel-8 · test-e2e-bazel-9)

aspect test -- \
  @@aspect_rules_py++uv+sdist_build__googlemaps_test__googlemaps__4_10_0//:whl \
  //cases/uv-legacy-deps-750:googlemaps
# without Aspect CLI
bazel test -- \
  @@aspect_rules_py++uv+sdist_build__googlemaps_test__googlemaps__4_10_0//:whl \
  //cases/uv-legacy-deps-750:googlemaps

❌ test (test-root-bazel-8 · test-root-bazel-9)

aspect test -- \
  @@+uv+sdist_build__aspect_rules_py__bravado_core__6_1_1//:whl \
  //examples/pytest:coverage_lcov_shape_test
# without Aspect CLI
bazel test -- \
  @@+uv+sdist_build__aspect_rules_py__bravado_core__6_1_1//:whl \
  //examples/pytest:coverage_lcov_shape_test

Install aspect: docs.aspect.build/cli/install


⏱ Last updated Thu Jun 11 16:25:18 UTC 2026 · 📊 GitHub API quota 823/15,000 (5% used, resets in 45m, throttle 3×)
🚀 Powered by Aspect CLI (v2026.22.44)  |  Aspect Build · X · LinkedIn · YouTube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant