python data_error ai_generated true

警告:在目录 '*' 下未找到匹配 '*.pyc' 的先前排除文件 警告:在目录 'data' 下未找到匹配 '*.json' 的文件

warning: no previously-included files matching '*.pyc' found under directory '*' warning: no files found matching '*.json' under directory 'data'

ID: python/setuptools-manifest-in-missing-files

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

版本兼容性

版本状态引入弃用备注
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

根因分析

MANIFEST.in 引用了源码树中不存在的文件或通配符,导致 sdist 静默遗漏包运行时需要的数据文件。

English

MANIFEST.in references files or globs that do not exist in the source tree, so the sdist silently omits data files the package needs at runtime.

generic

解决方案

  1. 90% 成功率
    Verify paths exist relative to the project root and correct MANIFEST.in, e.g. `recursive-include src/pkg/data *.json`. Rebuild with `python -m build`.
  2. 85% 成功率
    Prefer `[tool.setuptools.package-data]` in pyproject.toml to declare data files instead of relying on MANIFEST.in.

无效尝试

常见但无效的做法:

  1. 70% 失败

    The resulting sdist lacks data files, causing runtime FileNotFoundError for users.

  2. 65% 失败

    If the paths are wrong, additional globs produce more warnings without including files.