jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.67k stars 608 forks source link

pip-sync re-installs the typing-extensions every time #2035

Closed rgg-fjaite closed 8 months ago

rgg-fjaite commented 8 months ago

When typing-extensions is present as a requirement, pip-sync can't match the distribution and the install requirement and that triggers a re-install of the lib.

Not sure this was the right way to address the mismatch, but canonicalizing the returned key here makes is work:

from pip._vendor.packaging.utils import canonicalize_name
...
def diff_key_from_req(req: Distribution) -> str: 
    ...
    return canonicalize_name(key)

Environment Versions

  1. OS Type
  2. Python version: 3.11.4 (CPython)
  3. pip version: 23.3.2
  4. pip-tools version: pip-compile, version 7.0.0

Steps to replicate

requirements.txt:

typing-extensions==4.8.0
  1. pip uninstall typing-extensions
  2. pip-sync requirements.txt
  3. Verify it would uninstall and install the same package with pip-sync -nv requirements.txt

Expected result

Everything up-to-date

Actual result

Would uninstall:
  typing_extensions
Would install:
  typing-extensions==4.8.0
rgg-fjaite commented 8 months ago

Upgraded pip-tools to 7.3.0 and the issue is no longer there, apologies for the noise.