Skip to content

Commit 607dbea

Browse files
committed
Include editable locations in JSON output of list
This matches the JSON format with the default columns format.
1 parent 35181cd commit 607dbea

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

news/7764.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Include ``location`` field for editable distribution entries in
2+
``pip list --json``, so the fields outputted match the default "columns"
3+
format.

src/pip/_internal/commands/list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,9 @@ def format_for_json(packages, options):
303303
'name': dist.project_name,
304304
'version': six.text_type(dist.version),
305305
}
306-
if options.verbose >= 1:
306+
if options.verbose >= 1 or dist_is_editable(dist):
307307
info['location'] = dist.location
308+
if options.verbose >= 1:
308309
info['installer'] = get_installer(dist)
309310
if options.outdated:
310311
info['latest_version'] = six.text_type(dist.latest_version)

0 commit comments

Comments
 (0)