# SetuptoolsDeprecationWarning：将 `license` 作为 TOML 表已弃用。请改用简单字符串或 `license` 文件路径。

- **ID:** `python/setuptools-license-file-deprecation`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

PEP 639 将 pyproject.toml 中的 `license` 字段从表（含 `file`/`text` 键）改为纯 SPDX 字符串。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |
| 3.13 | active | — | — |

## 解决方案

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

## 无效尝试

- **** — Temporarily hides the warning but breaks compatibility with other packages that require modern setuptools metadata. (70% 失败率)
- **** — Only mutes the warning; the deprecated table form will stop being parsed in a future release. (75% 失败率)
