fix: remove _warn_on_old_setuptools() that warns incorrectly with custom build-backends#1341
Merged
RonnyPfannschmidt merged 1 commit intoMar 27, 2026
Conversation
…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>
Contributor
There was a problem hiding this comment.
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.
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.
Summary
_warn_on_old_setuptools()which checkedsetuptools.__version__at import time and emitted aRuntimeWarningwhen the major version was < 61setuptools.__version__can return the project version rather than setuptools' actual version, causing a spurious warningsetuptools>=77.0.3), making this runtime check redundantFixes #1192
Test plan
uv run pytest setuptools-scm/testing_scm/test_integration.py -n12— 49 passed)testwarn_on_broken_setuptoolstestMade with Cursor