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

- **ID:** `python/pip-egg-info-directory-shadow`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在扁平项目布局中，setuptools 自动发现找到多个候选的顶级包，拒绝猜测哪个是分发包。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   cat > pyproject.toml <<'TOML'
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"

[project]
name = "mypkg"
version = "0.1.0"

[tool.setuptools.packages.find]
where = ["src"]
TOML
pip install .
   ```
2. **** (90% 成功率)
   ```
   mkdir -p src/mypkg
mv mypkg/* src/mypkg/
# ensure pyproject.toml uses [tool.setuptools.packages.find] where=["src"]
pip install .
   ```

## 无效尝试

- **** — The error is from setuptools discovery, not isolation; the same 'Multiple top-level packages' error occurs. (85% 失败率)
- **** — Hides one symptom but src/ and docs/ still trigger the error; brittle workaround. (70% 失败率)
