Skip to content
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

Deprecate tools.setuptools.license-files #4837

Merged

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Feb 18, 2025

Deprecate tools.setuptools.license-files in favor of project.license-files.

Ref #4829

/CC @abravalheri

Verified

This commit was signed with the committer’s verified signature.
@cdce8p cdce8p force-pushed the 639-deprecated-setuptools.license-files branch from 6dee35f to ab277d3 Compare February 18, 2025 12:08
Copy link
Contributor

@abravalheri abravalheri left a comment

Choose a reason for hiding this comment

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

Thank you very much @cdce8p!

Verified

This commit was signed with the committer’s verified signature.
@@ -99,7 +99,7 @@ Key Value Type (TOML) Notes
See :doc:`/userguide/datafiles`.
``exclude-package-data`` table/inline-table Empty by default. See :doc:`/userguide/datafiles`.
------------------------- --------------------------- -------------------------
``license-files`` array of glob patterns **Provisional** - likely to change with :pep:`639`
``license-files`` array of glob patterns **Deprecated** - use ``project.license-files`` instead. See :doc:`PyPUG:guides/writing-pyproject-toml/#license-files`
Copy link
Contributor

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:

/home/runner/work/setuptools/setuptools/docs/userguide/pyproject_config.rst:103: WARNING: unknown document: 'PyPUG:guides/writing-pyproject-toml/#license-files' [ref.doc]

Copy link
Contributor Author

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.

@abravalheri abravalheri merged commit 6f0aee2 into pypa:feature/pep639 Feb 18, 2025
20 of 24 checks passed
@cdce8p cdce8p deleted the 639-deprecated-setuptools.license-files branch February 18, 2025 14:38
@abravalheri abravalheri mentioned this pull request Feb 18, 2025
6 tasks
@@ -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(
Copy link

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

@abravalheri abravalheri Mar 20, 2025

Choose a reason for hiding this comment

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

This configuration has been documented as provisional since its introduction, so it was never stable to require a deprecation period.

The breaking change is documented in the changelogs for the major version bump to inform users adaptation may be required.

Copy link
Contributor

Choose a reason for hiding this comment

The 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 pylint as a typical example: pylint-dev/pylint#10289

They did not had project.license-files defined but ratter in setup.cfg.

@cdce8p, was the intention just to double definition inside pyproject.toml or more general to avoid license-files being defined in multiple places?

If it was the first, should we change the condition it to:

if `license-files` in config.get("project", {}):

(Untested)

Copy link
Contributor

Choose a reason for hiding this comment

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

See #4899.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 pylint as a typical example: pylint-dev/pylint#10289

Seems for pylint in particular, I was actually the one who introduce the issue almost three years ago 😅
pylint-dev/pylint#7076

The config as I had written it was problematic though. metadata.license-files (from setup.cfg) would always be overwritten by tool.setuptools.license-files. So in a sense, raising an error here was kind of a good thing as it's fixed now.

They did not had project.license-files defined but ratter in setup.cfg.

@cdce8p, was the intention just to double definition inside pyproject.toml or more general to avoid license-files being defined in multiple places?

Left a comment on the PR already (see #4899 (review)) but in a sense the intention was to prohibit using project.license-files and tool.setuptools.license-files together.

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.

None yet

3 participants