python config_error ai_generated true

警告:mypkg 1.0 未提供额外项 'dev'

WARNING: mypkg 1.0 does not provide the extra 'dev'

ID: python/setuptools-missing-extras-requires

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

版本兼容性

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

根因分析

包元数据未在 extras_require 或 [project.optional-dependencies] 中声明所请求的额外项,因此 pip 仅安装基础包。

English

The package metadata does not declare the requested extra in extras_require or [project.optional-dependencies], so pip installs only the base package.

generic

解决方案

  1. 90% 成功率
    pip install mypkg pytest ruff mypy
  2. 85% 成功率
    # in pyproject.toml
    [project.optional-dependencies]
    dev = ["pytest", "ruff"]
    pip install -e '.[dev]'

无效尝试

常见但无效的做法:

  1. 90% 失败

    --pre enables pre-releases but does not create extras that are not declared.

  2. 85% 失败

    Upgrading does not add extras to the metadata; the warning persists.

  3. 70% 失败

    If 'all' is not declared either, the same warning appears for 'all'.