Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation/resolution report (aka pip install --dry-run --report) #10771

Merged
merged 14 commits into from
Jul 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
install report: add version field
Also, affirm the experimental status of the feature.
sbidoul committed Jul 12, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
sbidoul Stéphane Bidoul
commit 1fbfdc44233486299db4d4364cf8cc8ef98ceacb
11 changes: 11 additions & 0 deletions docs/html/reference/installation-report.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,16 @@ it did install (or what it would have installed, if used with the `--dry-run` op

The report is a JSON object with the following properties:

- `version`: the string `0`, denoting that the installation report is an experimental
feature. This value will change to `1`, when the feature is deemed stable after
gathering user feedback (likely in pip 22.3 or 23.0). Backward incompatible changes
may be introduced in version `1` without notice. After that, it will change only if
and when backward incompatible changes are introduced, such as removing mandatory
fields or changing the semantics or data type of existing fields. The introduction of
backward incompatible changes will follow the usual pip processes such as the
deprecation cycle or feature flags. Tools must check this field to ensure they support
the corresponding version.

- `pip_version`: a string with the version of pip used to produce the report.
- `install`: an object where the properties are the canonicalized names of the
distribution packages (to be) installed and the values are of type
@@ -55,6 +65,7 @@ will produce an output similar to this (metadata abriged for brevity):

```json
{
"version": "0",
"pip_version": "22.2",
"install": {
"pydantic": {
6 changes: 3 additions & 3 deletions news/53.feature.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Add ``--report`` to the install command to generate a json report of what was installed.
In combination with ``--dry-run`` and ``--ignore-installed`` it can be used to resolve
the requirements.
Add an experimental ``--report`` option to the install command to generate a JSON report
of what was installed. In combination with ``--dry-run`` and ``--ignore-installed`` it
can be used to resolve the requirements.
1 change: 1 addition & 0 deletions src/pip/_internal/models/installation_report.py
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ def _install_req_to_dict(cls, ireq: InstallRequirement) -> Dict[str, Any]:

def to_dict(self) -> Dict[str, Any]:
return {
"version": "0",
"pip_version": __version__,
"install": {
canonicalize_name(ireq.metadata["Name"]): self._install_req_to_dict(