Skip to content

fix: keep build-backend metadata stdout off Hatch stdout - #2350

Open
takerukondo wants to merge 1 commit into
pypa:masterfrom
takerukondo:fix-backend-stdout-pollution-2069
Open

fix: keep build-backend metadata stdout off Hatch stdout#2350
takerukondo wants to merge 1 commit into
pypa:masterfrom
takerukondo:fix-backend-stdout-pollution-2069

Conversation

@takerukondo

Copy link
Copy Markdown

Summary

  • Forward the PEP 517 frontend child process stdout to stderr when preparing metadata, so noisy non-Hatchling backends (setuptools / setuptools-scm) cannot pollute Hatch command stdout.
  • Add a regression test with a deliberately noisy backend.
  • Document the fix under Unreleased.

Fixes #2069.

Motivation

hatch version on a setuptools-scm project currently prints running dist_info / egg-info progress on stdout before the version string, which breaks scripting. After this change, stdout is only the version (build noise remains on stderr).

Test plan

  • pytest tests/project/test_frontend.py::TestPrepareMetadata::test_backend_stdout_is_forwarded_to_stderr
  • Manual: hatch version in glyph/automat → stdout is only the version line; egg_info noise on stderr

Made with Cursor

Non-Hatchling backends such as setuptools print build progress to stdout
while preparing metadata, which breaks scripting `hatch version`. Forward
the backend child's stdout to stderr so Hatch's own stdout stays clean.

Fixes pypa#2069.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

hatch version doesn't work on a setuptools-scm project unless hatch-vcs is installed

1 participant