Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
InspectCommand Class Reference
Inheritance diagram for InspectCommand:
Collaboration diagram for InspectCommand:

Public Member Functions

None add_options (self)
 
int run (self, Values options, List[str] args)
 
- Public Member Functions inherited from Command
None __init__ (self, str name, str summary, bool isolated=False)
 
None handle_pip_version_check (self, Values options)
 
Tuple[Values, List[str]] parse_args (self, List[str] args)
 
int main (self, List[str] args)
 
- Public Member Functions inherited from CommandContextMixIn
Generator[None, None, Nonemain_context (self)
 
_T enter_context (self, ContextManager[_T] context_provider)
 

Data Fields

 cmd_opts
 
- Data Fields inherited from Command
 name
 
 summary
 
 parser
 
 cmd_opts
 
 tempdir_registry
 
 verbosity
 

Static Public Attributes

bool ignore_require_venv = True
 
str usage
 
- Static Public Attributes inherited from Command
str usage = ""
 
bool ignore_require_venv = False
 

Protected Member Functions

Dict[str, Any] _dist_to_dict (self, BaseDistribution dist)
 
- Protected Member Functions inherited from Command
int _main (self, List[str] args)
 

Additional Inherited Members

- Protected Attributes inherited from CommandContextMixIn
 _in_main_context
 
 _main_context
 

Detailed Description

Inspect the content of a Python environment and produce a report in JSON format.

Definition at line 19 of file inspect.py.

Member Function Documentation

◆ _dist_to_dict()

Dict[str, Any] _dist_to_dict (   self,
BaseDistribution  dist 
)
protected

Definition at line 65 of file inspect.py.

65 def _dist_to_dict(self, dist: BaseDistribution) -> Dict[str, Any]:
66 res: Dict[str, Any] = {
67 "metadata": dist.metadata_dict,
68 "metadata_location": dist.info_location,
69 }
70 # direct_url. Note that we don't have download_info (as in the installation
71 # report) since it is not recorded in installed metadata.
72 direct_url = dist.direct_url
73 if direct_url is not None:
74 res["direct_url"] = direct_url.to_dict()
75 else:
76 # Emulate direct_url for legacy editable installs.
77 editable_project_location = dist.editable_project_location
78 if editable_project_location is not None:
79 res["direct_url"] = {
80 "url": path_to_url(editable_project_location),
81 "dir_info": {
82 "editable": True,
83 },
84 }
85 # installer
86 installer = dist.installer
88 res["installer"] = installer
89 # requested
91 res["requested"] = dist.requested
92 return res
for i

References i.

Referenced by InspectCommand.run().

Here is the caller graph for this function:

◆ add_options()

None add_options (   self)

Reimplemented from Command.

Definition at line 28 of file inspect.py.

28 def add_options(self) -> None:
29 self.cmd_opts.add_option(
30 "--local",
31 action="store_true",
32 default=False,
33 help=(
34 "If in a virtualenv that has global access, do not list "
35 "globally-installed packages."
36 ),
37 )
38 self.cmd_opts.add_option(
39 "--user",
40 dest="user",
41 action="store_true",
42 default=False,
43 help="Only output packages installed in user-site.",
44 )
45 self.cmd_opts.add_option(cmdoptions.list_path())
46 self.parser.insert_option_group(0, self.cmd_opts)
47

References Command.cmd_opts, CacheCommand.cmd_opts, CompletionCommand.cmd_opts, ConfigurationCommand.cmd_opts, DebugCommand.cmd_opts, DownloadCommand.cmd_opts, FreezeCommand.cmd_opts, HashCommand.cmd_opts, IndexCommand.cmd_opts, InspectCommand.cmd_opts, InstallCommand.cmd_opts, ListCommand.cmd_opts, SearchCommand.cmd_opts, ShowCommand.cmd_opts, UninstallCommand.cmd_opts, WheelCommand.cmd_opts, and i.

◆ run()

int run (   self,
Values  options,
List[str]  args 
)

Reimplemented from Command.

Definition at line 48 of file inspect.py.

48 def run(self, options: Values, args: List[str]) -> int:
50 dists = get_environment(options.path).iter_installed_distributions(
51 local_only=options.local,
52 user_only=options.user,
53 skip=set(stdlib_pkgs),
54 )
55 output = {
56 "version": "1",
57 "pip_version": __version__,
58 "installed": [self._dist_to_dict(dist) for dist in dists],
59 "environment": default_environment(),
60 # TODO tags? scheme?
61 }
62 print_json(data=output)
63 return SUCCESS
64

References InspectCommand._dist_to_dict(), and i.

Here is the call graph for this function:

Field Documentation

◆ cmd_opts

◆ ignore_require_venv

bool ignore_require_venv = True
static

Definition at line 24 of file inspect.py.

◆ usage

str usage
static
Initial value:
= """
%prog [options]"""

Definition at line 25 of file inspect.py.


The documentation for this class was generated from the following file: