Skip to content

Commit 4ed8a48

Browse files
committed
show: add editable location if package is editable (pypa#11638)
1 parent 5f3f592 commit 4ed8a48

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

news/11638.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make ``pip show`` show the editable location if package is editable

src/pip/_internal/commands/show.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class _PackageInfo(NamedTuple):
5353
name: str
5454
version: str
5555
location: str
56+
editable_project_location: Optional[str]
5657
requires: List[str]
5758
required_by: List[str]
5859
installer: str
@@ -120,6 +121,7 @@ def _get_requiring_packages(current_dist: BaseDistribution) -> Iterator[str]:
120121
name=dist.raw_name,
121122
version=str(dist.version),
122123
location=dist.location or "",
124+
editable_project_location=dist.editable_project_location,
123125
requires=requires,
124126
required_by=required_by,
125127
installer=dist.installer,
@@ -158,6 +160,8 @@ def print_results(
158160
write_output("Author-email: %s", dist.author_email)
159161
write_output("License: %s", dist.license)
160162
write_output("Location: %s", dist.location)
163+
if dist.editable_project_location is not None:
164+
write_output("Editable project location: %s", dist.editable_project_location)
161165
write_output("Requires: %s", ", ".join(dist.requires))
162166
write_output("Required-by: %s", ", ".join(dist.required_by))
163167

tests/functional/test_show.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ def test_basic_show(script: PipTestEnvironment) -> None:
2424
assert "Requires: " in lines
2525

2626

27+
def test_show_with_editable_project_location(script: PipTestEnvironment) -> None:
28+
"""
29+
Test for show command with an editable project installation
30+
"""
31+
script.pip(
32+
"install",
33+
"-e",
34+
"git+https://github.com/pypa/pip-test-package.git#egg=pip-test-package",
35+
)
36+
result = script.pip(
37+
"show",
38+
"pip_test_package",
39+
)
40+
assert "Editable project location:" in result.stdout
41+
42+
2743
def test_show_with_files_not_found(script: PipTestEnvironment, data: TestData) -> None:
2844
"""
2945
Test for show command with installed files listing enabled and

0 commit comments

Comments
 (0)