Compare commits

...

9 Commits

Author SHA1 Message Date
Shantanu db8bb13979
Merge af706bce36 into a15dd75d98 2023-11-29 21:40:19 +08:00
Tzu-ping Chung a15dd75d98
Merge pull request #12417 from xqm32/fix-outdated-pip-install 2023-11-28 16:08:29 +09:00
Tzu-ping Chung d8ab6dc6c1 Clarify news fragment 2023-11-28 15:06:25 +08:00
Qiming Xu fe10d368f6
Add end line 2023-11-28 14:25:56 +08:00
Qiming Xu 28250baffb
Fix line wrap length and add news entry 2023-11-28 14:17:51 +08:00
Qiming Xu 88ac529219
Fix outdated pip install argument description 2023-11-28 13:15:31 +08:00
hauntsaninja af706bce36 Merge remote-tracking branch 'upstream/main' into legacy-resol 2023-09-25 12:01:06 -07:00
hauntsaninja e261330e65 old comment 2023-09-25 12:00:51 -07:00
hauntsaninja 170b2c18ae Use strict optional checking in legacy resolver
The assert in _set_req_to_reinstall is definitely correct, the three
call sites have guards

The assert in _populate_link is a little trickier. It's not obvious to
me how to prove it will never trigger. Note that if link were ever None,
it could potentially cause AttributeError in Cache._get_cache_path_parts
and direct_url_from_link

The assert in _resolve_one is safe, if req_to_install.name was None it
would raise TypeError in canonicalize_name

I can't prove that req.name is not None in get_installation_order
and the code would work fine if that were the case (since it's a
defaultdict), so I opted to just ignore
2023-09-23 18:05:44 -07:00
4 changed files with 8 additions and 6 deletions

View File

@ -45,8 +45,8 @@ When looking at the items to be installed, pip checks what type of item
each is, in the following order:
1. Project or archive URL.
2. Local directory (which must contain a ``setup.py``, or pip will report
an error).
2. Local directory (which must contain a ``pyproject.toml`` or ``setup.py``,
otherwise pip will report an error).
3. Local file (a sdist or wheel format archive, following the naming
conventions for those formats).
4. A requirement, as specified in :pep:`440`.

1
news/12417.doc.rst Normal file
View File

@ -0,0 +1 @@
Fix outdated pip install argument description in documentation.

View File

@ -10,9 +10,6 @@ for sub-dependencies
a. "first found, wins" (where the order is breadth first)
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import logging
import sys
from collections import defaultdict
@ -323,6 +320,7 @@ class Resolver(BaseResolver):
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
assert req.satisfied_by is not None
if not self.use_user_site or req.satisfied_by.in_usersite:
req.should_reinstall = True
req.satisfied_by = None
@ -421,6 +419,8 @@ class Resolver(BaseResolver):
if self.wheel_cache is None or self.preparer.require_hashes:
return
assert req.link is not None, "_find_requirement_link unexpectedly returned None"
cache_entry = self.wheel_cache.get_cache_entry(
link=req.link,
package_name=req.name,
@ -534,6 +534,7 @@ class Resolver(BaseResolver):
with indent_log():
# We add req_to_install before its dependencies, so that we
# can refer to it when adding dependencies.
assert req_to_install.name is not None
if not requirement_set.has_requirement(req_to_install.name):
# 'unnamed' requirements will get added here
# 'unnamed' requirements can only come from being directly
@ -589,7 +590,7 @@ class Resolver(BaseResolver):
if req.constraint:
return
ordered_reqs.add(req)
for dep in self._discovered_dependencies[req.name]:
for dep in self._discovered_dependencies[req.name]: # type: ignore[index]
schedule(dep)
order.append(req)