python
config_error
ai_generated
true
SetuptoolsDeprecationWarning:将 `license` 作为 TOML 表已弃用。请改用简单字符串或 `license` 文件路径。
SetuptoolsDeprecationWarning: `license` as a TOML table is deprecated. Please use a simple string or a `license` file path instead.
ID: python/setuptools-license-file-deprecation
80%修复率
86%置信度
0证据数
2025-01-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
| 3.13 | active | — | — | — |
根因分析
PEP 639 将 pyproject.toml 中的 `license` 字段从表(含 `file`/`text` 键)改为纯 SPDX 字符串。
English
PEP 639 changed the `license` field in pyproject.toml from a table (with `file`/`text` keys) to a plain SPDX string.
解决方案
-
93% 成功率
Migrate to PEP 639: replace `license = {file = 'LICENSE'}` with `license = 'MIT'` and add `license-files = ['LICENSE']`. -
80% 成功率
If you must keep the old form for a transition, pin `setuptools<77` in build-system.requires and add a TODO to migrate.
无效尝试
常见但无效的做法:
-
70% 失败
Temporarily hides the warning but breaks compatibility with other packages that require modern setuptools metadata.
-
75% 失败
Only mutes the warning; the deprecated table form will stop being parsed in a future release.