python config_error ai_generated true

mypkg setup 命令出错:'classifiers' 必须是字符串列表,得到:'Programming Language :: Python :: 3.11'

error in mypkg setup command: 'classifiers' must be a list of strings, got: 'Programming Language :: Python :: 3.11'

ID: python/setuptools-invalid-classifier

其他格式: JSON · Markdown 中文 · English
80%修复率
86%置信度
0证据数
2024-05-16首次发现

版本兼容性

版本状态引入弃用备注
3.x active

根因分析

将单个分类器字符串赋值给 classifiers,而不是列表;或在 setup.cfg/pyproject.toml 中使用了逗号分隔的字符串。

English

A single classifier string was assigned to classifiers instead of a list, or a comma-separated string was used in setup.cfg/pyproject.toml.

generic

解决方案

  1. 98% 成功率
    # setup.cfg
    [metadata]
    classifiers =
        Programming Language :: Python :: 3
        Programming Language :: Python :: 3.11
    
    # pyproject.toml
    classifiers = [
      "Programming Language :: Python :: 3",
      "Programming Language :: Python :: 3.11",
    ]
  2. 92% 成功率
    python -m pip install trove-classifiers
    python - <<'PY'
    from trove_classifiers import classifiers
    for c in ["Programming Language :: Python :: 3.11"]:
        assert c in classifiers, c
    print('ok')
    PY

无效尝试

常见但无效的做法:

  1. 85% 失败

    Produces one bogus classifier containing commas instead of three valid ones.

  2. 60% 失败

    Loses PyPI metadata used for search and compatibility filtering.