Skip to content

Commit 2c84a1c

Browse files
committed
Add requested_extras to installation report
1 parent d6685d0 commit 2c84a1c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/pip/_internal/models/installation_report.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def _install_req_to_dict(cls, ireq: InstallRequirement) -> Dict[str, Any]:
3030
# https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata
3131
"metadata": ireq.get_dist().metadata_dict,
3232
}
33+
if ireq.user_supplied and ireq.extras:
34+
# For top level requirements, the list of requested extras, if any.
35+
res["requested_extras"] = list(sorted(ireq.extras))
3336
return res
3437

3538
def to_dict(self) -> Dict[str, Any]:

tests/functional/test_install_report.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_install_report_index(script: PipTestEnvironment, tmp_path: Path) -> Non
8585
paste_report["download_info"]["archive_info"]["hash"]
8686
== "sha256=11645842ba8ec986ae8cfbe4c6cacff5c35f0f4527abf4f5581ae8b4ad49c0b6"
8787
)
88+
assert paste_report["requested_extras"] == ["openid"]
8889
assert "requires_dist" in paste_report["metadata"]
8990

9091

0 commit comments

Comments
 (0)