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

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)
 
- Public Member Functions inherited from SessionCommandMixin
None __init__ (self)
 
PipSession get_default_session (self, Values options)
 

Data Fields

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

Static Public Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from Command
int _main (self, List[str] args)
 
- Protected Member Functions inherited from SessionCommandMixin
Optional[List[str]] _get_index_urls (cls, Values options)
 
PipSession _build_session (self, Values options, Optional[int] retries=None, Optional[int] timeout=None, bool fallback_to_certifi=False)
 
- Protected Attributes inherited from CommandContextMixIn
 _in_main_context
 
 _main_context
 
- Protected Attributes inherited from SessionCommandMixin
 _session
 

Detailed Description

Uninstall packages.

pip is able to uninstall most installed packages. Known exceptions are:

- Pure distutils packages installed with ``python setup.py install``, which
  leave behind no metadata to determine what files were installed.
- Script wrappers installed by ``python setup.py develop``.

Definition at line 25 of file uninstall.py.

Member Function Documentation

◆ add_options()

None add_options (   self)

Reimplemented from Command.

Definition at line 40 of file uninstall.py.

40 def add_options(self) -> None:
41 self.cmd_opts.add_option(
42 "-r",
43 "--requirement",
44 dest="requirements",
45 action="append",
46 default=[],
47 metavar="file",
48 help=(
49 "Uninstall all the packages listed in the given requirements "
50 "file. This option can be used multiple times."
51 ),
52 )
53 self.cmd_opts.add_option(
54 "-y",
55 "--yes",
56 dest="yes",
57 action="store_true",
58 help="Don't ask for confirmation of uninstall deletions.",
59 )
62 self.parser.insert_option_group(0, self.cmd_opts)
63
for i

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 64 of file uninstall.py.

64 def run(self, options: Values, args: List[str]) -> int:
65 session = self.get_default_session(options)
66
67 reqs_to_uninstall = {}
68 for name in args:
69 req = install_req_from_line(
70 name,
71 isolated=options.isolated_mode,
72 )
73 if req.name:
74 reqs_to_uninstall[canonicalize_name(req.name)] = req
75 else:
77 "Invalid requirement: %r ignored -"
78 " the uninstall command expects named"
79 " requirements.",
80 name,
81 )
82 for filename in options.requirements:
83 for parsed_req in parse_requirements(
84 filename, options=options, session=session
85 ):
86 req = install_req_from_parsed_requirement(
87 parsed_req, isolated=options.isolated_mode
88 )
89 if req.name:
90 reqs_to_uninstall[canonicalize_name(req.name)] = req
91 if not reqs_to_uninstall:
92 raise InstallationError(
93 f"You must give at least one requirement to {self.name} (see "
94 f'"pip help {self.name}")'
95 )
96
98 check_externally_managed()
99
100 protect_pip_from_modification_on_windows(
101 modifying_pip="pip" in reqs_to_uninstall
102 )
103
104 for req in reqs_to_uninstall.values():
105 uninstall_pathset = req.uninstall(
106 auto_confirm=options.yes,
107 verbose=self.verbosity > 0,
108 )
109 if uninstall_pathset:
111 if options.root_user_action == "warn":
112 warn_if_run_as_root()
113 return SUCCESS

References SessionCommandMixin.get_default_session(), i, Command.verbosity, and RequirementPreparer.verbosity.

Here is the call graph for this function:

Field Documentation

◆ cmd_opts

◆ usage

str usage
static
Initial value:
= """
%prog [options] <package> ...
%prog [options] -r <requirements file> ..."""

Definition at line 36 of file uninstall.py.


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