Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._internal.commands.debug Namespace Reference

Data Structures

class  DebugCommand
 

Functions

None show_value (str name, Any value)
 
None show_sys_implementation ()
 
Dict[str, str] create_vendor_txt_map ()
 
ModuleType get_module_from_module_name (str module_name)
 
Optional[str] get_vendor_version_from_module (str module_name)
 
None show_actual_vendor_versions (Dict[str, str] vendor_txt_versions)
 
None show_vendor_versions ()
 
None show_tags (Values options)
 
str ca_bundle_info (Configuration config)
 

Variables

 logger = logging.getLogger(__name__)
 

Function Documentation

◆ ca_bundle_info()

str ca_bundle_info ( Configuration  config)

Definition at line 136 of file debug.py.

136def ca_bundle_info(config: Configuration) -> str:
137 levels = set()
138 for key, _ in config.items():
139 levels.add(key.split(".")[0])
140
141 if not levels:
142 return "Not specified"
143
144 levels_that_override_global = ["install", "wheel", "download"]
145 global_overriding_level = [
146 level for level in levels if level in levels_that_override_global
147 ]
148 if not global_overriding_level:
149 return "global"
150
151 if "global" in levels:
152 levels.remove("global")
153 return ", ".join(levels)
154
155
for i

References i.

Referenced by DebugCommand.run().

Here is the caller graph for this function:

◆ create_vendor_txt_map()

Dict[str, str] create_vendor_txt_map ( )

Definition at line 37 of file debug.py.

37def create_vendor_txt_map() -> Dict[str, str]:
38 with importlib.resources.open_text("pip._vendor", "vendor.txt") as f:
39 # Purge non version specifying lines.
40 # Also, remove any space prefix or suffixes (including comments).
41 lines = [
42 line.strip().split(" ", 1)[0] for line in f.readlines() if "==" in line
43 ]
44
45 # Transform into "module" -> version dict.
46 return dict(line.split("==", 1) for line in lines)
47
48

References i.

Referenced by pip._internal.commands.debug.show_vendor_versions().

Here is the caller graph for this function:

◆ get_module_from_module_name()

ModuleType get_module_from_module_name ( str  module_name)

Definition at line 49 of file debug.py.

49def get_module_from_module_name(module_name: str) -> ModuleType:
50 # Module name can be uppercase in vendor.txt for some reason...
51 module_name = module_name.lower().replace("-", "_")
52 # PATCH: setuptools is actually only pkg_resources.
53 if module_name == "setuptools":
54 module_name = "pkg_resources"
55
56 __import__(f"pip._vendor.{module_name}", globals(), locals(), level=0)
57 return getattr(pip._vendor, module_name)
58
59

References i.

Referenced by pip._internal.commands.debug.get_vendor_version_from_module().

Here is the caller graph for this function:

◆ get_vendor_version_from_module()

Optional[str] get_vendor_version_from_module ( str  module_name)

Definition at line 60 of file debug.py.

60def get_vendor_version_from_module(module_name: str) -> Optional[str]:
61 module = get_module_from_module_name(module_name)
62 version = getattr(module, "__version__", None)
63
64 if not version:
65 # Try to find version in debundled module info.
66 assert module.__file__ is not None
67 env = get_environment([os.path.dirname(module.__file__)])
68 dist = env.get_distribution(module_name)
69 if dist:
70 version = str(dist.version)
71
72 return version
73
74

References pip._internal.commands.debug.get_module_from_module_name(), and i.

Referenced by pip._internal.commands.debug.show_actual_vendor_versions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show_actual_vendor_versions()

None show_actual_vendor_versions ( Dict[str, str]  vendor_txt_versions)
Log the actual version and print extra info if there is
a conflict or if the actual version could not be imported.

Definition at line 75 of file debug.py.

75def show_actual_vendor_versions(vendor_txt_versions: Dict[str, str]) -> None:
76 """Log the actual version and print extra info if there is
77 a conflict or if the actual version could not be imported.
78 """
79 for module_name, expected_version in vendor_txt_versions.items():
80 extra_message = ""
81 actual_version = get_vendor_version_from_module(module_name)
82 if not actual_version:
83 extra_message = (
84 " (Unable to locate actual module version, using"
85 " vendor.txt specified version)"
86 )
87 actual_version = expected_version
88 elif parse_version(actual_version) != parse_version(expected_version):
89 extra_message = (
90 " (CONFLICT: vendor.txt suggests version should"
91 " be {})".format(expected_version)
92 )
93 logger.info("%s==%s%s", module_name, actual_version, extra_message)
94
95

References pip._internal.commands.debug.get_vendor_version_from_module(), and i.

Referenced by pip._internal.commands.debug.show_vendor_versions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show_sys_implementation()

None show_sys_implementation ( )

Definition at line 30 of file debug.py.

30def show_sys_implementation() -> None:
31 logger.info("sys.implementation:")
32 implementation_name = sys.implementation.name
33 with indent_log():
34 show_value("name", implementation_name)
35
36

References i, and pip._internal.commands.debug.show_value().

Referenced by DebugCommand.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show_tags()

None show_tags ( Values  options)

Definition at line 104 of file debug.py.

104def show_tags(options: Values) -> None:
105 tag_limit = 10
106
107 target_python = make_target_python(options)
109
110 # Display the target options that were explicitly provided.
111 formatted_target = target_python.format_given()
112 suffix = ""
113 if formatted_target:
114 suffix = f" (target: {formatted_target})"
115
116 msg = "Compatible tags: {}{}".format(len(tags), suffix)
117 logger.info(msg)
118
119 if options.verbose < 1 and len(tags) > tag_limit:
120 tags_limited = True
121 tags = tags[:tag_limit]
122 else:
123 tags_limited = False
124
125 with indent_log():
126 for tag in tags:
127 logger.info(str(tag))
128
129 if tags_limited:
130 msg = (
131 "...\n[First {tag_limit} tags shown. Pass --verbose to show all.]"
132 ).format(tag_limit=tag_limit)
133 logger.info(msg)
134
135

References i.

Referenced by DebugCommand.run().

Here is the caller graph for this function:

◆ show_value()

None show_value ( str  name,
Any  value 
)

Definition at line 26 of file debug.py.

26def show_value(name: str, value: Any) -> None:
27 logger.info("%s: %s", name, value)
28
29

References i.

Referenced by DebugCommand.run(), and pip._internal.commands.debug.show_sys_implementation().

Here is the caller graph for this function:

◆ show_vendor_versions()

None show_vendor_versions ( )

Definition at line 96 of file debug.py.

96def show_vendor_versions() -> None:
97 logger.info("vendored library versions:")
98
99 vendor_txt_versions = create_vendor_txt_map()
100 with indent_log():
101 show_actual_vendor_versions(vendor_txt_versions)
102
103

References pip._internal.commands.debug.create_vendor_txt_map(), i, and pip._internal.commands.debug.show_actual_vendor_versions().

Referenced by DebugCommand.run().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ logger

logger = logging.getLogger(__name__)

Definition at line 23 of file debug.py.