python config_error ai_generated true

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

ID: python/setuptools-invalid-classifier

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-05-16First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

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

中文

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

Workarounds

  1. 98% success
    # 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% success
    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

Dead Ends

Common approaches that don't work:

  1. 85% fail

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

  2. 60% fail

    Loses PyPI metadata used for search and compatibility filtering.