MCPcopy
hub / github.com/python-poetry/poetry / Application

Class Application

src/poetry/console/application.py:124–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123
124class Application(BaseApplication):
125 def __init__(self) -> None:
126 super().__init__("poetry", __version__)
127
128 self._poetry: Poetry | None = None
129 self._io: IO | None = None
130 self._disable_plugins = False
131 self._disable_cache = False
132 self._plugins_loaded = False
133 self._working_directory = Path.cwd()
134 self._project_directory: Path | None = None
135
136 dispatcher = EventDispatcher()
137 dispatcher.add_listener(COMMAND, self.register_command_loggers)
138 dispatcher.add_listener(COMMAND, self.configure_env)
139 dispatcher.add_listener(COMMAND, self.configure_installer_for_event)
140 self.set_event_dispatcher(dispatcher)
141
142 command_loader = CommandLoader({name: load_command(name) for name in COMMANDS})
143 self.set_command_loader(command_loader)
144
145 @property
146 def _default_definition(self) -> Definition:
147 from cleo.io.inputs.option import Option
148
149 definition = super()._default_definition
150
151 definition.add_option(
152 Option("--no-plugins", flag=True, description="Disables plugins.")
153 )
154
155 definition.add_option(
156 Option(
157 "--no-cache", flag=True, description="Disables Poetry source caches."
158 )
159 )
160
161 definition.add_option(
162 Option(
163 "--project",
164 "-P",
165 flag=False,
166 description=(
167 "Specify another path as the project root."
168 " All command-line arguments will be resolved relative to the current working directory."
169 ),
170 )
171 )
172
173 definition.add_option(
174 Option(
175 "--directory",
176 "-C",
177 flag=False,
178 description=(
179 "The working directory for the Poetry command (defaults to the"
180 " current working directory). All command-line arguments will be"
181 " resolved relative to the given directory."

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…