-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Deprecate tools.setuptools.license-files #4837
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Deprecated ``tools.setuptools.license-files`` in favor of ``project.license-files`` | ||
| and added exception if ``project.license-files`` and ``tools.setuptools.license-files`` | ||
| are used together. -- by :user:`cdce8p` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,9 +22,9 @@ | |
|
|
||
| from .. import _static | ||
| from .._path import StrPath | ||
| from ..errors import RemovedConfigError | ||
| from ..errors import InvalidConfigError, RemovedConfigError | ||
| from ..extension import Extension | ||
| from ..warnings import SetuptoolsWarning | ||
| from ..warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing_extensions import TypeAlias | ||
|
|
@@ -89,6 +89,21 @@ def _apply_tool_table(dist: Distribution, config: dict, filename: StrPath): | |
| if not tool_table: | ||
| return # short-circuit | ||
|
|
||
| if "license-files" in tool_table: | ||
| if dist.metadata.license_files: | ||
| raise InvalidConfigError( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you throwing an exception when the intention is to deprecate something? Emitting a DeprecationWarning should be surely sufficient? This exception breaks tons of workloads on our side.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This configuration has been documented as The breaking change is documented in the changelogs for the major version bump to inform users adaptation may be required.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That said, I had a look on how this exception is being triggered in the wild and I can see They did not had @cdce8p, was the intention just to double definition inside If it was the first, should we change the condition it to: if `license-files` in config.get("project", {}):(Untested)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #4899.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Seems for pylint in particular, I was actually the one who introduce the issue almost three years ago 😅 The config as I had written it was problematic though.
Left a comment on the PR already (see #4899 (review)) but in a sense the intention was to prohibit using |
||
| "'project.license-files' is defined already. " | ||
| "Remove 'tool.setuptools.license-files'." | ||
| ) | ||
|
|
||
| pypa_guides = "guides/writing-pyproject-toml/#license-files" | ||
| SetuptoolsDeprecationWarning.emit( | ||
| "'tool.setuptools.license-files' is deprecated in favor of " | ||
| "'project.license-files'", | ||
| see_url=f"https://packaging.python.org/en/latest/{pypa_guides}", | ||
| due_date=(2026, 2, 18), # Warning introduced on 2025-02-18 | ||
| ) | ||
|
|
||
| for field, value in tool_table.items(): | ||
| norm_key = json_compatible_key(field) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice that sphinx is issuing the following warning:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the anchor link doesn't exist. Opened pypa/packaging.python.org#1816 upstream and used the generic link here so it doesn't block the PR.