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 4231cc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 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
7 changes: 5 additions & 2 deletions src/pip/_internal/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
from optparse import Values
from typing import Generator, Iterable, Iterator, List, NamedTuple, Optional

from pip._vendor.packaging.utils import canonicalize_name

from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.metadata import BaseDistribution, get_default_environment
from pip._internal.utils.misc import write_output
from pip._vendor.packaging.utils import canonicalize_name

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -53,6 +52,7 @@ class _PackageInfo(NamedTuple):
name: str
version: str
location: str
editable_location: Optional[str]
requires: List[str]
required_by: List[str]
installer: str
Expand Down Expand Up @@ -120,6 +120,7 @@ def _get_requiring_packages(current_dist: BaseDistribution) -> Iterator[str]:
name=dist.raw_name,
version=str(dist.version),
location=dist.location or "",
editable_location=dist.editable_project_location,
requires=requires,
required_by=required_by,
installer=dist.installer,
Expand Down Expand Up @@ -158,6 +159,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_location:
write_output("Editable project location: %s", dist.editable_location)
write_output("Requires: %s", ", ".join(dist.requires))
write_output("Required-by: %s", ", ".join(dist.required_by))

Expand Down

0 comments on commit 4231cc1

Please sign in to comment.