Skip to content

✨ feat(cli): surface debug paths when a backend build fails#1087

Merged
gaborbernat merged 4 commits into
pypa:mainfrom
gaborbernat:966-keep-backend-logs
Jun 14, 2026
Merged

✨ feat(cli): surface debug paths when a backend build fails#1087
gaborbernat merged 4 commits into
pypa:mainfrom
gaborbernat:966-keep-backend-logs

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

A plain python -m build that hits a backend failure deletes its temporary working directories before anyone can look inside them, so the first failure leaves nothing to debug from. This is what #966 ran into with meson-python: the error was visible but the meson log lived in a directory that was already gone. 🔍

On any backend failure build now prints a TIP line. When no working directory is pinned it tells you to re-run with --env-dir and --sdist-extract-dir so the environment and the extracted sources survive the next run; when they are already pinned it reports where they were kept. The line links to a new Debug a failed build how-to that walks through streaming backend output with -vv, keeping both working directories, and reaching the backend's own log files. That last part stays the backend's job: PEP 517 gives the frontend no way to discover where a backend writes its logs, so the guide shows the meson-python builddir setting as the worked example rather than pretending build can capture them. ✨

The behavior change is limited to the failure path, where build now emits one extra hint before exiting; successful builds are untouched.

Stacked on #1083 (--env-dir) and #1085 (--sdist-extract-dir) — the hint reuses both flags and should merge after them. Depends on #1083 and #1085.

Closes #966

@gaborbernat gaborbernat added the enhancement New feature or request label Jun 4, 2026
@gaborbernat gaborbernat force-pushed the 966-keep-backend-logs branch 6 times, most recently from dccf3c1 to 664cb4f Compare June 9, 2026 16:23
@gaborbernat gaborbernat force-pushed the 966-keep-backend-logs branch from 664cb4f to 3db5e62 Compare June 12, 2026 19:16
When a build backend fails, build cleans up its temporary working
directories before the user can inspect them, leaving nothing to debug
from. Print a TIP on backend failure that points at --env-dir and
--sdist-extract-dir (to keep the build environment and extracted
sources) and links to a new "Debug a failed build" how-to. When those
locations are already pinned, report where they were kept instead.

The how-to also covers streaming backend output with -vv and where
backends such as meson-python write their own log files, which build
cannot capture itself since PEP 517 exposes no way to find them.

Closes pypa#966
@gaborbernat gaborbernat force-pushed the 966-keep-backend-logs branch from 3db5e62 to b5a7c5c Compare June 12, 2026 23:43
@gaborbernat gaborbernat marked this pull request as ready for review June 12, 2026 23:57
Comment thread docs/how-to/troubleshooting.rst Outdated
Comment thread docs/how-to/troubleshooting.rst Outdated
Comment thread docs/how-to/troubleshooting.rst Outdated
Comment thread docs/how-to/troubleshooting.rst Outdated
Backend stdout/stderr is forwarded to the terminal regardless of
verbosity; -vv only adds build's own diagnostics and live environment
setup output. Drop the claim that -vv is needed to see compiler
invocations and tracebacks. Use the meson-python/scikit-build build-dir
config setting and generalise the log-path note across backends.
@gaborbernat gaborbernat requested a review from henryiii June 13, 2026 08:29
Comment thread docs/how-to/troubleshooting.rst Outdated
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
@henryiii henryiii added the pre-commit.ci autofix Autofix this PR label Jun 13, 2026
@pre-commit-ci pre-commit-ci Bot removed the pre-commit.ci autofix Autofix this PR label Jun 13, 2026
@gaborbernat gaborbernat enabled auto-merge (squash) June 13, 2026 15:26
@gaborbernat gaborbernat requested a review from henryiii June 13, 2026 15:31
@gaborbernat gaborbernat merged commit e7cb092 into pypa:main Jun 14, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keep backend logs?

2 participants