Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
installation_report.py
Go to the documentation of this file.
1
from
typing
import
Any, Dict, Sequence
2
3
from
pip._vendor.packaging.markers
import
default_environment
4
5
from
pip
import
__version__
6
from
pip._internal.req.req_install
import
InstallRequirement
7
8
9
class
InstallationReport
:
10
def
__init__
(self, install_requirements: Sequence[InstallRequirement]):
11
self.
_install_requirements
= install_requirements
12
13
@classmethod
14
def
_install_req_to_dict
(cls, ireq: InstallRequirement) -> Dict[str, Any]:
15
assert
ireq.download_info
, f
"No download_info for {ireq}"
16
res = {
17
# PEP 610 json for the download URL. download_info.archive_info.hashes may
18
# be absent when the requirement was installed from the wheel cache
19
# and the cache entry was populated by an older pip version that did not
20
# record origin.json.
21
"download_info"
:
ireq.download_info.to_dict
(),
22
# is_direct is true if the requirement was a direct URL reference (which
23
# includes editable requirements), and false if the requirement was
24
# downloaded from a PEP 503 index or --find-links.
25
"is_direct"
:
ireq.is_direct
,
26
# requested is true if the requirement was specified by the user (aka
27
# top level requirement), and false if it was installed as a dependency of a
28
# requirement. https://peps.python.org/pep-0376/#requested
29
"requested"
:
ireq.user_supplied
,
30
# PEP 566 json encoding for metadata
31
# https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata
32
"metadata"
:
ireq.get_dist
().metadata_dict,
33
}
34
if
ireq.user_supplied
and
ireq.extras
:
35
# For top level requirements, the list of requested extras, if any.
36
res[
"requested_extras"
] = list(sorted(
ireq.extras
))
37
return
res
38
39
def
to_dict
(self) -> Dict[str, Any]:
40
return
{
41
"version"
:
"1"
,
42
"pip_version"
: __version__,
43
"install"
: [
44
self.
_install_req_to_dict
(ireq)
for
ireq
in
self.
_install_requirements
45
],
46
# https://peps.python.org/pep-0508/#environment-markers
47
# TODO: currently, the resolver uses the default environment to evaluate
48
# environment markers, so that is what we report here. In the future, it
49
# should also take into account options such as --python-version or
50
# --platform, perhaps under the form of an environment_override field?
51
# https://github.com/pypa/pip/issues/11198
52
"environment"
: default_environment(),
53
}
pip._internal.models.installation_report.InstallationReport
Definition
installation_report.py:9
pip._internal.models.installation_report.InstallationReport._install_requirements
_install_requirements
Definition
installation_report.py:11
pip._internal.models.installation_report.InstallationReport._install_req_to_dict
Dict[str, Any] _install_req_to_dict(cls, InstallRequirement ireq)
Definition
installation_report.py:14
pip._internal.models.installation_report.InstallationReport.__init__
__init__(self, Sequence[InstallRequirement] install_requirements)
Definition
installation_report.py:10
pip._internal.models.installation_report.InstallationReport.to_dict
Dict[str, Any] to_dict(self)
Definition
installation_report.py:39
pip._internal.req.req_install
Definition
req_install.py:1
pip._vendor.packaging.markers
Definition
markers.py:1
i
for i
Definition
prime_search.m:10
venv
lib
python3.12
site-packages
pip
_internal
models
installation_report.py
Generated by
1.9.8