# 错误：在扁平布局中发现多个顶级包：['src', 'tests', 'docs']。

- **ID:** `python/setuptools-discovery-multiple-top-level`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Setuptools 在扁平布局中的自动发现找到多个候选包目录，拒绝猜测哪一个是真正的包。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (97% 成功率)
   ```
   [tool.setuptools]
packages = ["mypkg"]
# or
[tool.setuptools.packages.find]
where = ["src"]
include = ["mypkg*"]
   ```
2. **** (95% 成功率)
   ```
   # move mypkg/ to src/mypkg/
[tool.setuptools.packages.find]
where = ["src"]
   ```

## 无效尝试

- **** — MANIFEST.in controls sdist contents, not setuptools package discovery. (85% 失败率)
- **** — The discovery error occurs during build regardless of isolation. (90% 失败率)
- **** — Discovery still finds src/ and _tests/ as candidates. (70% 失败率)
