{
  "id": "python/setuptools-package-discovery-flat-layout",
  "signature": "error: Multiple top-level packages discovered in a flat-layout: ['src', 'tests', 'docs'].",
  "signature_zh": "错误：在扁平布局中发现多个顶级包：['src', 'tests', 'docs']。",
  "regex": "error:\\ Multiple\\ top\\-level\\ packages\\ discovered\\ in\\ a\\ flat\\-layout:\\ \\['src',\\ 'tests',\\ 'docs'\\]\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "setuptools auto-discovery refuses to guess which top-level directory is the real package when several sibling directories look like packages; explicit configuration is required.",
  "root_cause_type": "generic",
  "root_cause_zh": "当多个同级目录看起来像包时，setuptools 自动发现拒绝猜测哪个顶级目录是真正的包；需要显式配置。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Works around the symptom but breaks conventional tooling and CI that expect those names.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Makes the ambiguity worse; setuptools now sees even more candidate packages.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "[tool.setuptools.packages.find]\nwhere = [\"src\"]\ninclude = [\"mypkg*\"]\n# or list them\n[tool.setuptools]\npackages = [\"mypkg\"]",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.94,
      "how": "mkdir -p src/mypkg\nmv mypkg/* src/mypkg/\ntouch src/mypkg/__init__.py\n# then configure\n[tool.setuptools.packages.find]\nwhere = [\"src\"]",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-27",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}