Skip to content

Commit

Permalink
install report: add version field
Browse files Browse the repository at this point in the history
Also, affirm the experimental status of the feature.
  • Loading branch information
sbidoul committed Jul 5, 2022
1 parent 264548d commit 6520d93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions docs/html/reference/installation-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ 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` in pip 22.3 or 23.0 when the feature is deemed
stable after gathering user feedback. 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
Expand Down Expand Up @@ -52,6 +60,7 @@ will produce an output similar to this (metadata abriged for brevity):

```json
{
"version": "0",
"pip_version": "22.2",
"install": {
"pydantic": {
Expand Down
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
Expand Up @@ -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(
Expand Down

0 comments on commit 6520d93

Please sign in to comment.