diff --git a/news/7764.feature b/news/7764.feature new file mode 100644 index 00000000000..d98f0c529fc --- /dev/null +++ b/news/7764.feature @@ -0,0 +1,2 @@ +Always include fields ``installer`` and ``location`` in ``pip list --json`` +output regardless of verbosity. diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py index cce470a6051..16a34451001 100644 --- a/src/pip/_internal/commands/list.py +++ b/src/pip/_internal/commands/list.py @@ -301,11 +301,10 @@ def format_for_json(packages, options): for dist in packages: info = { 'name': dist.project_name, + 'installer': get_installer(dist), + 'location': dist.location, 'version': six.text_type(dist.version), } - if options.verbose >= 1: - info['location'] = dist.location - info['installer'] = get_installer(dist) if options.outdated: info['latest_version'] = six.text_type(dist.latest_version) info['latest_filetype'] = dist.latest_filetype