-
-
Notifications
You must be signed in to change notification settings - Fork 228
Fix 1216 explicitly deprecate setuptools dynamic version when active #1219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
RonnyPfannschmidt
merged 9 commits into
pypa:main
from
RonnyPfannschmidt:fix-1216-explicitly-deprecate-setuptools-dynamic-version-when-active
Oct 12, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6a9de12
ignore dynamic version in setup.cfg
RonnyPfannschmidt e922ebe
test instrumentation: add dependency injected toml content to read_py…
RonnyPfannschmidt 34b72e1
add a warning when setuptools dynamic version in pyproject is used in…
RonnyPfannschmidt ec99afe
use a actually user friendly deprecation for the setuptools dynamic a…
RonnyPfannschmidt 343f791
Improve read_pyproject docstring with reStructuredText format
RonnyPfannschmidt 3969982
Fix typos and grammar in deprecation warnings
RonnyPfannschmidt 536fe21
Fix duplicate v9.2.0 changelog entry and improve consistency
RonnyPfannschmidt 8c5cec9
Fix API stability check workflow to install griffe and improve reporting
RonnyPfannschmidt 14d85c0
Install Mercurial on Windows runners via Chocolatey
RonnyPfannschmidt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import warnings | ||
|
|
||
| from pathlib import Path | ||
|
|
||
|
|
||
| def warn_dynamic_version(path: Path, section: str, expression: str) -> None: | ||
| warnings.warn( | ||
| f"{path}: at [{section}]\n" | ||
| f"{expression} is forcing setuptools to override the version setuptools-scm did already set\n" | ||
| "When using setuptools-scm it's invalid to use setuptools dynamic version as well, please remove it.\n" | ||
| "Setuptools-scm is responsible for setting the version, forcing setuptools to override creates errors." | ||
| ) | ||
|
|
||
|
|
||
| def warn_pyproject_setuptools_dynamic_version(path: Path) -> None: | ||
| warn_dynamic_version(path, "tool.setuptools.dynamic", "version = {attr = ...}") | ||
|
|
||
|
|
||
| def warn_setup_cfg_dynamic_version(path: Path) -> None: | ||
| warn_dynamic_version(path, "metadata", "version = attr: ...") |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| """Test deprecation warnings and their exact text.""" | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from setuptools_scm._integration.deprecation import warn_dynamic_version | ||
|
|
||
|
|
||
| def test_warn_dynamic_version_full_text() -> None: | ||
| """Test the complete warning text for warn_dynamic_version function.""" | ||
| test_path = Path("test_file.toml") | ||
| expected_warning = ( | ||
| f"{test_path}: at [test.section]\n" | ||
| "test_expression is forcing setuptools to override the version setuptools-scm did already set\n" | ||
| "When using setuptools-scm it's invalid to use setuptools dynamic version as well, please remove it.\n" | ||
| "Setuptools-scm is responsible for setting the version, forcing setuptools to override creates errors." | ||
| ) | ||
|
|
||
| with pytest.warns(UserWarning) as warning_info: # noqa: PT030 | ||
| warn_dynamic_version(test_path, "test.section", "test_expression") | ||
|
|
||
| assert len(warning_info) == 1 | ||
| assert str(warning_info[0].message) == expected_warning |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.