python config_error ai_generated true

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2025-01-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —
3.13 active — — —

Root Cause

PEP 639 changed the `license` field in pyproject.toml from a table (with `file`/`text` keys) to a plain SPDX string.

generic

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 70% fail

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

  2. 75% fail

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