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

其他格式: JSON · Markdown 中文 · English
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.

generic

解决方案

  1. 93% 成功率
    Migrate to PEP 639: replace `license = {file = 'LICENSE'}` with `license = 'MIT'` and add `license-files = ['LICENSE']`.
  2. 80% 成功率
    If you must keep the old form for a transition, pin `setuptools<77` in build-system.requires and add a TODO to migrate.

无效尝试

常见但无效的做法:

  1. 70% 失败

    Temporarily hides the warning but breaks compatibility with other packages that require modern setuptools metadata.

  2. 75% 失败

    Only mutes the warning; the deprecated table form will stop being parsed in a future release.