Skip to content

Commit

Permalink
Add editable project location to pip list output
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Aug 1, 2021
1 parent 0d75fe8 commit 4cd1455
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pip/_internal/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,12 @@ def format_for_columns(
header = ["Package", "Version"]

data = []
if options.verbose >= 1 or any(x.editable for x in pkgs):
if options.verbose >= 1:
header.append("Location")
if options.verbose >= 1:
header.append("Installer")
if any(x.editable for x in pkgs):
header.append("Editable project location")

for proj in pkgs:
# if we're working on the 'outdated' list, separate out the
Expand All @@ -310,10 +312,11 @@ def format_for_columns(
row.append(str(proj.latest_version))
row.append(proj.latest_filetype)

if options.verbose >= 1 or proj.editable:
if options.verbose >= 1:
row.append(proj.location or "")
if options.verbose >= 1:
row.append(proj.installer)
row.append(proj.editable_project_location or "")

data.append(row)

Expand All @@ -333,5 +336,8 @@ def format_for_json(packages: "_ProcessedDists", options: Values) -> str:
if options.outdated:
info['latest_version'] = str(dist.latest_version)
info['latest_filetype'] = dist.latest_filetype
editable_project_location = dist.editable_project_location
if editable_project_location:
info['editable_project_location'] = editable_project_location
data.append(info)
return json.dumps(data)

0 comments on commit 4cd1455

Please sign in to comment.