|
| 1 | +# Installation Report |
| 2 | + |
| 3 | +The `--report` option of the pip install command produces a detailed JSON report of what |
| 4 | +it did install (or what it would have installed, if used with the `--dry-run` option). |
| 5 | + |
| 6 | +## Specification |
| 7 | + |
| 8 | +The report is a JSON object with the following properties: |
| 9 | + |
| 10 | +- `version`: the string `0`, denoting that the installation report is an experimental |
| 11 | + feature. This value will change to `1`, when the feature is deemed stable after |
| 12 | + gathering user feedback (likely in pip 22.3 or 23.0). Backward incompatible changes |
| 13 | + may be introduced in version `1` without notice. After that, it will change only if |
| 14 | + and when backward incompatible changes are introduced, such as removing mandatory |
| 15 | + fields or changing the semantics or data type of existing fields. The introduction of |
| 16 | + backward incompatible changes will follow the usual pip processes such as the |
| 17 | + deprecation cycle or feature flags. Tools must check this field to ensure they support |
| 18 | + the corresponding version. |
| 19 | + |
| 20 | +- `pip_version`: a string with the version of pip used to produce the report. |
| 21 | + |
| 22 | +- `install`: an array of [InstallationReportItem](InstallationReportItem) representing |
| 23 | + the distribution packages (to be) installed. |
| 24 | + |
| 25 | +- `environment`: an object describing the environment where the installation report was |
| 26 | + generated. See [PEP 508 environment |
| 27 | + markers](https://peps.python.org/pep-0508/#environment-markers) for more information. |
| 28 | + Values have a string type. |
| 29 | + |
| 30 | +(InstallationReportItem)= |
| 31 | + |
| 32 | +An `InstallationReportItem` is an object describing a (to be) installed distribution |
| 33 | +package with the following properties: |
| 34 | + |
| 35 | +- `metadata`: the metadata of the distribution, converted to a JSON object according to |
| 36 | + the [PEP 566 |
| 37 | + transformation](https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata). |
| 38 | + |
| 39 | +- `is_direct`: `true` if the requirement was provided as, or constrained to, a direct |
| 40 | + URL reference. `false` if the requirements was provided as a name and version |
| 41 | + specifier. |
| 42 | + |
| 43 | +- `download_info`: Information about the artifact (to be) downloaded for installation, |
| 44 | + using the [direct |
| 45 | + URL](https://packaging.python.org/en/latest/specifications/direct-url/) data |
| 46 | + structure. When `is_direct` is `true`, this field is the same as the `direct_url.json` |
| 47 | + metadata, otherwise it represents the URL of the artifact obtained from the index or |
| 48 | + `--find-links`. |
| 49 | + |
| 50 | + ```{note} |
| 51 | + For source archives, `download_info.archive_info.hash` may |
| 52 | + be absent when the requirement was installed from the wheel cache |
| 53 | + and the cache entry was populated by an older pip version that did not |
| 54 | + record the origin URL of the downloaded artifact. |
| 55 | + ``` |
| 56 | + |
| 57 | +- `requested`: `true` if the requirement was explicitly provided by the user, either |
| 58 | + directely via a command line argument or indirectly via a requirements file. `false` |
| 59 | + if the requirement was installed as a dependency of another requirement. |
| 60 | + |
| 61 | +- `requested_extras`: extras requested by the user. This field is only present when the |
| 62 | + `requested` field is true. |
| 63 | + |
| 64 | +## Example |
| 65 | + |
| 66 | +The following command: |
| 67 | + |
| 68 | +```console |
| 69 | +pip install \ |
| 70 | + --ignore-installed --dry-run --quiet \ |
| 71 | + --report - \ |
| 72 | + "pydantic>=1.9" git+https://github.com/pypa/packaging@main |
| 73 | +``` |
| 74 | + |
| 75 | +will produce an output similar to this (metadata abriged for brevity): |
| 76 | + |
| 77 | +```json |
| 78 | +{ |
| 79 | + "version": "0", |
| 80 | + "pip_version": "22.2", |
| 81 | + "install": [ |
| 82 | + { |
| 83 | + "download_info": { |
| 84 | + "url": "https://files.pythonhosted.org/packages/a4/0c/fbaa7319dcb5eecd3484686eb5a5c5702a6445adb566f01aee6de3369bc4/pydantic-1.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", |
| 85 | + "archive_info": { |
| 86 | + "hash": "sha256=18f3e912f9ad1bdec27fb06b8198a2ccc32f201e24174cec1b3424dda605a310" |
| 87 | + } |
| 88 | + }, |
| 89 | + "is_direct": false, |
| 90 | + "requested": true, |
| 91 | + "metadata": { |
| 92 | + "name": "pydantic", |
| 93 | + "version": "1.9.1", |
| 94 | + "requires_dist": [ |
| 95 | + "typing-extensions (>=3.7.4.3)", |
| 96 | + "dataclasses (>=0.6) ; python_version < \"3.7\"", |
| 97 | + "python-dotenv (>=0.10.4) ; extra == 'dotenv'", |
| 98 | + "email-validator (>=1.0.3) ; extra == 'email'" |
| 99 | + ], |
| 100 | + "requires_python": ">=3.6.1", |
| 101 | + "provides_extra": [ |
| 102 | + "dotenv", |
| 103 | + "email" |
| 104 | + ] |
| 105 | + } |
| 106 | + }, |
| 107 | + { |
| 108 | + "download_info": { |
| 109 | + "url": "https://github.com/pypa/packaging", |
| 110 | + "vcs_info": { |
| 111 | + "vcs": "git", |
| 112 | + "requested_revision": "main", |
| 113 | + "commit_id": "4f42225e91a0be634625c09e84dd29ea82b85e27" |
| 114 | + } |
| 115 | + }, |
| 116 | + "is_direct": true, |
| 117 | + "requested": true, |
| 118 | + "metadata": { |
| 119 | + "name": "packaging", |
| 120 | + "version": "21.4.dev0", |
| 121 | + "requires_dist": [ |
| 122 | + "pyparsing (!=3.0.5,>=2.0.2)" |
| 123 | + ], |
| 124 | + "requires_python": ">=3.7" |
| 125 | + } |
| 126 | + }, |
| 127 | + { |
| 128 | + "download_info": { |
| 129 | + "url": "https://files.pythonhosted.org/packages/6c/10/a7d0fa5baea8fe7b50f448ab742f26f52b80bfca85ac2be9d35cdd9a3246/pyparsing-3.0.9-py3-none-any.whl", |
| 130 | + "archive_info": { |
| 131 | + "hash": "sha256=5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc" |
| 132 | + } |
| 133 | + }, |
| 134 | + "is_direct": false, |
| 135 | + "requested": false, |
| 136 | + "metadata": { |
| 137 | + "name": "pyparsing", |
| 138 | + "version": "3.0.9", |
| 139 | + "requires_dist": [ |
| 140 | + "railroad-diagrams ; extra == \"diagrams\"", |
| 141 | + "jinja2 ; extra == \"diagrams\"" |
| 142 | + ], |
| 143 | + "requires_python": ">=3.6.8" |
| 144 | + } |
| 145 | + }, |
| 146 | + { |
| 147 | + "download_info": { |
| 148 | + "url": "https://files.pythonhosted.org/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl", |
| 149 | + "archive_info": { |
| 150 | + "hash": "sha256=6657594ee297170d19f67d55c05852a874e7eb634f4f753dbd667855e07c1708" |
| 151 | + } |
| 152 | + }, |
| 153 | + "is_direct": false, |
| 154 | + "requested": false, |
| 155 | + "metadata": { |
| 156 | + "name": "typing_extensions", |
| 157 | + "version": "4.2.0", |
| 158 | + "requires_python": ">=3.7" |
| 159 | + } |
| 160 | + } |
| 161 | + ], |
| 162 | + "environment": { |
| 163 | + "implementation_name": "cpython", |
| 164 | + "implementation_version": "3.10.5", |
| 165 | + "os_name": "posix", |
| 166 | + "platform_machine": "x86_64", |
| 167 | + "platform_release": "5.13-generic", |
| 168 | + "platform_system": "Linux", |
| 169 | + "platform_version": "...", |
| 170 | + "python_full_version": "3.10.5", |
| 171 | + "platform_python_implementation": "CPython", |
| 172 | + "python_version": "3.10", |
| 173 | + "sys_platform": "linux" |
| 174 | + } |
| 175 | +} |
| 176 | +``` |
0 commit comments