{
  "id": "python/setuptools-pkg-resources-deprecation",
  "signature": "DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html",
  "signature_zh": "弃用警告：pkg_resources 作为 API 已弃用。请参阅 https://setuptools.pypa.io/en/latest/pkg_resources.html",
  "regex": "DeprecationWarning:\\ pkg_resources\\ is\\ deprecated\\ as\\ an\\ API\\.\\ See\\ https://setuptools\\.pypa\\.io/en/latest/pkg_resources\\.html",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Code imports pkg_resources, which setuptools deprecated in favor of importlib.metadata and importlib.resources. It still works but emits warnings and will be removed.",
  "root_cause_type": "generic",
  "root_cause_zh": "代码导入了 pkg_resources，setuptools 已弃用该模块，推荐使用 importlib.metadata 和 importlib.resources。它仍然可用但会发出警告，且将被移除。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Hides the warning but does not fix the underlying deprecated usage; future removal will break the code.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Avoids the warning temporarily but locks you out of security fixes and new features.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from importlib.metadata import version; __version__ = version('your-package')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "from importlib.resources import files; data = files('your_package').joinpath('data.txt').read_text()",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}