Skip to content

Fix integration test for pip's flit_core build backend - #5293

Merged
jaraco merged 1 commit into
mainfrom
bugfix/integration-pip-flit-backend
Aug 8, 2026
Merged

Fix integration test for pip's flit_core build backend#5293
jaraco merged 1 commit into
mainfrom
bugfix/integration-pip-flit-backend

Conversation

@jaraco

@jaraco jaraco commented Aug 8, 2026

Copy link
Copy Markdown
Member

Problem

The tests workflow for the v84.0.0 tagged release failed in the integration-test job: test_install_sdist[pip-v.LATEST] errored with

pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'flit_core.buildapi'

This 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

  • pip 26.2.1 builds with flit_core (build-backend = "flit_core.buildapi", requires = ["flit-core >=3.11,<4"]).
  • pip 26.2.1's sdist now ships two files named pyproject.toml:
    • pip-26.2.1/build-project/pyproject.toml — appears first in the archive, and has no [build-system] table
    • pip-26.2.1/pyproject.toml — the real one, with the flit-core requirement
  • _read_pyproject returned the first basename match (next(contents, "")), i.e. the build-project/ helper. So build_deps("pip", …) found no build requirements and returned [].
  • Because the integration test installs sdists with --no-build-isolation, it must install build deps itself. With an empty dep list, flit-core was never installed, and building pip failed with BackendUnavailable.

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.toml sdist, so the other examples are unaffected.

Test-only change; no newsfragment.

🤖 Generated with Claude Code

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>
@mergify

mergify Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@jaraco
jaraco merged commit 72e919a into main Aug 8, 2026
43 of 45 checks passed
@jaraco
jaraco deleted the bugfix/integration-pip-flit-backend branch August 8, 2026 18:05
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