Skip to content

Commit 16029fb

Browse files
committed
install report: use rich to print json to stdout
1 parent e41b134 commit 16029fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pip/_internal/commands/install.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import os
55
import shutil
66
import site
7-
import sys
87
from optparse import SUPPRESS_HELP, Values
98
from typing import Iterable, List, Optional
109

1110
from pip._vendor.packaging.utils import canonicalize_name
11+
from pip._vendor.rich import print_json
1212

1313
from pip._internal.cache import WheelCache
1414
from pip._internal.cli import cmdoptions
@@ -373,7 +373,7 @@ def run(self, options: Values, args: List[str]) -> int:
373373
if options.json_report_file:
374374
report = InstallationReport(requirement_set.requirements_to_install)
375375
if options.json_report_file == "-":
376-
json.dump(report.to_dict(), sys.stdout, indent=2, ensure_ascii=True)
376+
print_json(data=report.to_dict())
377377
else:
378378
with open(options.json_report_file, "w", encoding="utf-8") as f:
379379
json.dump(report.to_dict(), f, indent=2, ensure_ascii=False)

0 commit comments

Comments
 (0)