diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py index 828889f49e6..11bfad579ee 100644 --- a/src/pip/_internal/commands/list.py +++ b/src/pip/_internal/commands/list.py @@ -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 @@ -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) @@ -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)