Skip to content

fix: remove _warn_on_old_setuptools() that warns incorrectly with custom build-backends#1341

Merged
RonnyPfannschmidt merged 1 commit into
pypa:mainfrom
RonnyPfannschmidt:fix/1192-remove-old-setuptools-warning
Mar 27, 2026
Merged

fix: remove _warn_on_old_setuptools() that warns incorrectly with custom build-backends#1341
RonnyPfannschmidt merged 1 commit into
pypa:mainfrom
RonnyPfannschmidt:fix/1192-remove-old-setuptools-warning

Conversation

@RonnyPfannschmidt
Copy link
Copy Markdown
Contributor

Summary

  • Remove _warn_on_old_setuptools() which checked setuptools.__version__ at import time and emitted a RuntimeWarning when the major version was < 61
  • With custom build-backends (e.g. qtile's), setuptools.__version__ can return the project version rather than setuptools' actual version, causing a spurious warning
  • The minimum setuptools version is already enforced via build-system requires (setuptools>=77.0.3), making this runtime check redundant

Fixes #1192

Test plan

  • Existing integration tests pass (uv run pytest setuptools-scm/testing_scm/test_integration.py -n12 — 49 passed)
  • Pre-commit hooks pass (ruff, mypy, codespell, etc.)
  • Removed the now-unnecessary testwarn_on_broken_setuptools test

Made with Cursor

…tom build-backends

The warning checked setuptools.__version__ at import time, but custom
build-backends (e.g. qtile) can cause that attribute to return the
project version instead of setuptools' version. Since the build-system
already requires setuptools>=77.0.3, the runtime check is redundant.

Fixes pypa#1192

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Anthropic Claude <claude@anthropic.com>
Copilot AI review requested due to automatic review settings March 27, 2026 21:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes an import-time setuptools version warning that can be triggered incorrectly when custom build backends cause setuptools.__version__ to report a project’s version, and updates tests/changelog accordingly.

Changes:

  • Delete _warn_on_old_setuptools() and the import-time call from the setuptools integration module.
  • Remove the integration test that asserted the old warning behavior.
  • Add a changelog fragment describing the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
setuptools-scm/src/setuptools_scm/_integration/setuptools.py Removes the import-time version warning logic from the setuptools integration path.
setuptools-scm/testing_scm/test_integration.py Drops the now-obsolete warning test and related import.
setuptools-scm/changelog.d/1192.bugfix.md Documents the warning removal and the custom build-backend false-positive scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread setuptools-scm/changelog.d/1192.bugfix.md
Comment thread setuptools-scm/src/setuptools_scm/_integration/setuptools.py
@RonnyPfannschmidt RonnyPfannschmidt merged commit ee357f1 into pypa:main Mar 27, 2026
31 checks passed
@RonnyPfannschmidt RonnyPfannschmidt deleted the fix/1192-remove-old-setuptools-warning branch March 27, 2026 21:35
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.

_warn_on_old_setuptools() warns incorrectly when using a custom build-backend

2 participants