)]}'
{
  "commit": "dae610b9cad8e355eec388025807bbedc244c5de",
  "tree": "0997bfec7b049f4b6ca65dd2d536ec6bea7ea9d6",
  "parents": [
    "c98bc8f232ee12aa7b732473de5f6f5508125d1a"
  ],
  "author": {
    "name": "Matt Oberle",
    "email": "matt.r.oberle@gmail.com",
    "time": "Tue Jun 21 19:29:38 2022 -0400"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Jun 21 16:29:38 2022 -0700"
  },
  "message": "Use PEP 508 rules when setting deps from extras (#724)\n\n* Use PEP 426 rules when setting deps from extras\r\n\r\nThis commit addresses issue #720.\r\n\r\n[PEP 426](https://peps.python.org/pep-0426/#name) states that distribution\r\nnames are case-insensitive and \"-\" is interchangeable with \"_\".\r\n\r\nThe `pip-compile` command creates a lockfile where all package names are lowercase.\r\nThe tool may also modify interchangeable characters.\r\n\r\nThe following examples are all valid `requirements.txt` or `requirements_lock.txt` entries:\r\n\r\n```\r\nSQLAlchemy[postgresql_psycopg2binary]\u003d\u003d1.4.36\r\nsqlalchemy[postgresql_psycopg2binary]\u003d\u003d1.4.36\r\nsentry_sdk[flask]\u003d\u003d1.5.8\r\nsentry-sdk[flask]\u003d\u003d1.5.8\r\n```\r\n\r\nA distribution\u0027s `METADATA` file contains the stylization chosen by the publisher.\r\nBy applying a \"sanitise\" function when building the `extras` dict and when performing lookups\r\nwe can eliminate this difference as a concern.\r\n\r\n* Use PEP 503 rules when sanitising extras\r\n\r\n* Normalize distribution name with pkg_resources\r\n\r\n`pypa/installer` is used to parse Wheel metadata, but does not currently\r\nprovide a method for normalizing distribution names:\r\n\r\n- https://github.com/pypa/installer/issues/97\r\n\r\n`pypa/pkg_resources` provides `Requirement.parse` which returns an instance\r\nof `Requirement` where `.key` is the canonical distribution name per PEP 503.\r\n\r\nThe `Requirement` class can also parse `extras`, but it returns a normalized\r\nform that I believe could break the installation of the extras.\r\n\r\n* Use Requirement.parse to populate extra reqs\r\n\r\n* Revert \"Use Requirement.parse to populate extra reqs\"\r\n\r\nThis reverts commit f0faa9795a219d865d579da430806598b8779753.\r\n\r\n* Test for distribution name normalization in extras\r\n\r\n* Replace pkg_resources with packaging.utils\r\n\r\nThis replaces `pkg_resources.Requirement.parse` with\r\n`packaging.utils.canonicalize_name`. Doing this pulls in a vendored\r\nrequirement from `pip`, which may be undesirable.\r\n\r\nThe code we want is just:\r\n\r\n```\r\nre.sub(r\"[-_.]+\", \"-\", name).lower()\r\n```\r\n\r\nThis commit also leaves a reference to `pkg_resources` in `wheel.py` which\r\ndoes not canonicalize the name.\r\n\r\nCo-authored-by: Jonathon Belotti \u003cjonathon@canva.com\u003e\r\nCo-authored-by: Alex Eagle \u003calex@aspect.dev\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "cfab33967352f0e036f9289ee3f51491a511c6c1",
      "old_mode": 33188,
      "old_path": "python/pip_install/extract_wheels/lib/requirements.py",
      "new_id": "caf20d0f79b59e8412204f62c97b73772828ca8c",
      "new_mode": 33188,
      "new_path": "python/pip_install/extract_wheels/lib/requirements.py"
    },
    {
      "type": "modify",
      "old_id": "0ee425571f8a57698d169b3c9f5d6715b2b1c975",
      "old_mode": 33188,
      "old_path": "python/pip_install/extract_wheels/lib/requirements_test.py",
      "new_id": "4fe4d92e3260dd40e3968bacac796c6e9dd8c52a",
      "new_mode": 33188,
      "new_path": "python/pip_install/extract_wheels/lib/requirements_test.py"
    },
    {
      "type": "modify",
      "old_id": "74a963f382bce1338be53742d0e65adfa0f4c08b",
      "old_mode": 33188,
      "old_path": "python/pip_install/extract_wheels/lib/wheel.py",
      "new_id": "6dab31163790281905710ff4a140a733c88f34a7",
      "new_mode": 33188,
      "new_path": "python/pip_install/extract_wheels/lib/wheel.py"
    }
  ]
}
