{
  "schemaVersion": "ebb.rule.v1",
  "id": "python.module.distutils.removed",
  "ecosystem": "python",
  "purl": "pkg:generic/python",
  "affectedVersions": "vers:pypi/>=3.12",
  "event": "removed",
  "severity": "high",
  "title": "The distutils module was removed in Python 3.12",
  "summary": "Python 3.12 removed distutils (PEP 632), so importing it raises ModuleNotFoundError; use setuptools or another build backend.",
  "replacement": "setuptools",
  "sources": [
    {
      "title": "PEP 632 — Deprecate distutils module",
      "url": "https://peps.python.org/pep-0632/",
      "accessedAt": "2026-10-30"
    },
    {
      "title": "What's New in Python 3.12",
      "url": "https://docs.python.org/3/whatsnew/3.12.html",
      "accessedAt": "2026-10-30"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-30",
    "reviewedAt": "2026-10-30",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Keep the behavior of the code unchanged; check the replacement's argument and return-value differences."
    ],
    "steps": [
      {
        "id": "replace-import",
        "title": "Replace the distutils import",
        "instructions": "Replace each reported import of distutils with setuptools.",
        "targets": "usages"
      }
    ],
    "verification": [
      {
        "command": "python -W error::DeprecationWarning -m pytest",
        "purpose": "Run the tests with deprecation warnings treated as errors when pytest is used."
      }
    ]
  }
}
