Skip to content

Commit 62bd944

Browse files
committed
Add deprecation warning for project.license as a table in pyproject.toml
1 parent 6f0aee2 commit 62bd944

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

setuptools/config/_apply_pyprojecttoml.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ def _license(dist: Distribution, val: str | dict, root_dir: StrPath | None):
203203
if isinstance(val, str):
204204
_set_config(dist, "license_expression", _static.Str(val))
205205
else:
206+
pypa_guides = "guides/writing-pyproject-toml/#license"
207+
SetuptoolsDeprecationWarning.emit(
208+
"`project.license` as a TOML table is deprecated",
209+
"Please use a simple string containing a SPDX expression for "
210+
"`project.license`. You can also use `project.license-files`.",
211+
see_url=f"https://packaging.python.org/en/latest/{pypa_guides}",
212+
due_date=(2026, 2, 18), # Introduced on 2025-02-18
213+
)
206214
if "file" in val:
207215
# XXX: Is it completely safe to assume static?
208216
value = expand.read_files([val["file"]], root_dir)

0 commit comments

Comments
 (0)