Skip to content

Commit

Permalink
show: add editable location if package is editable (pypa#11638)
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Dec 11, 2022
1 parent 5f3f592 commit 4ed8a48
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/11638.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make ``pip show`` show the editable location if package is editable
4 changes: 4 additions & 0 deletions src/pip/_internal/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class _PackageInfo(NamedTuple):
name: str
version: str
location: str
editable_project_location: Optional[str]
requires: List[str]
required_by: List[str]
installer: str
Expand Down Expand Up @@ -120,6 +121,7 @@ def _get_requiring_packages(current_dist: BaseDistribution) -> Iterator[str]:
name=dist.raw_name,
version=str(dist.version),
location=dist.location or "",
editable_project_location=dist.editable_project_location,
requires=requires,
required_by=required_by,
installer=dist.installer,
Expand Down Expand Up @@ -158,6 +160,8 @@ def print_results(
write_output("Author-email: %s", dist.author_email)
write_output("License: %s", dist.license)
write_output("Location: %s", dist.location)
if dist.editable_project_location is not None:
write_output("Editable project location: %s", dist.editable_project_location)
write_output("Requires: %s", ", ".join(dist.requires))
write_output("Required-by: %s", ", ".join(dist.required_by))

Expand Down
16 changes: 16 additions & 0 deletions tests/functional/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ def test_basic_show(script: PipTestEnvironment) -> None:
assert "Requires: " in lines


def test_show_with_editable_project_location(script: PipTestEnvironment) -> None:
"""
Test for show command with an editable project installation
"""
script.pip(
"install",
"-e",
"git+https:/pypa/pip-test-package.git#egg=pip-test-package",
)
result = script.pip(
"show",
"pip_test_package",
)
assert "Editable project location:" in result.stdout


def test_show_with_files_not_found(script: PipTestEnvironment, data: TestData) -> None:
"""
Test for show command with installed files listing enabled and
Expand Down

0 comments on commit 4ed8a48

Please sign in to comment.