Fix integration test for pip's flit_core build backend - #5293
Merged
Conversation
pip 26.2.1 builds with flit_core and its sdist now ships a second
pyproject.toml under build-project/ that has no [build-system] table.
_read_pyproject grabbed the first basename match (the build-project one),
so build_deps found no build requirements, flit-core was never installed,
and the --no-build-isolation build failed with
"BackendUnavailable: Cannot import 'flit_core.buildapi'".
Select the shallowest match instead, i.e. the project's own
{name}-{version}/pyproject.toml.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
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
The
testsworkflow for the v84.0.0 tagged release failed in theintegration-testjob:test_install_sdist[pip-v.LATEST]errored withThis is not a regression from anything in the release — the failure is at pip's metadata-generation step, before any build/compile, and it would fail identically on 83.0.0. It's an integration-test bug newly triggered by an upstream change in pip.
Root cause
build-backend = "flit_core.buildapi",requires = ["flit-core >=3.11,<4"]).pyproject.toml:pip-26.2.1/build-project/pyproject.toml— appears first in the archive, and has no[build-system]tablepip-26.2.1/pyproject.toml— the real one, with the flit-core requirement_read_pyprojectreturned the first basename match (next(contents, "")), i.e. thebuild-project/helper. Sobuild_deps("pip", …)found no build requirements and returned[].--no-build-isolation, it must install build deps itself. With an empty dep list, flit-core was never installed, and building pip failed withBackendUnavailable.Fix
Select the shallowest
pyproject.toml(the project's own top-level{name}-{version}/pyproject.toml) instead of the first one encountered. Verified against the real pip 26.2.1 sdist:build_deps("pip", …)now returns['flit-core >=3.11,<4']. The change is inert for the common single-pyproject.tomlsdist, so the other examples are unaffected.Test-only change; no newsfragment.
🤖 Generated with Claude Code