Skip to content

Commit f4c8812

Browse files
refactor much of RequirementPreparer and add lengthy docs
1 parent 5a329fe commit f4c8812

File tree

2 files changed

+180
-153
lines changed

2 files changed

+180
-153
lines changed

src/pip/_internal/distributions/__init__.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
def make_distribution_for_install_requirement(
99
install_req: InstallRequirement,
1010
) -> AbstractDistribution:
11-
"""Returns a Distribution for the given InstallRequirement"""
11+
"""Returns an AbstractDistribution for the given InstallRequirement.
12+
13+
As AbstractDistribution only covers installable artifacts, this method may only be
14+
invoked at the conclusion of a resolve, when the RequirementPreparer has downloaded
15+
the file corresponding to the resolved dist. Commands which intend to consume
16+
metadata-only resolves without downloading should not call this method or
17+
consume AbstractDistribution objects.
18+
"""
1219
# Only pre-installed requirements will have a .satisfied_by dist.
1320
if install_req.satisfied_by:
1421
return InstalledDistribution(install_req)

0 commit comments

Comments
 (0)