listen#

debugpy.listen(
__endpoint: Tuple[str, int] | int,
*,
in_process_debug_adapter: bool = False,
) Tuple[str, int]#

Starts a debug adapter debugging this process, that listens for incoming socket connections from clients on the specified address.

`__endpoint` must be either a (host, port) tuple as defined by the standard `socket` module for the `AF_INET` address family, or a port number. If only the port is specified, host is “127.0.0.1”.

`in_process_debug_adapter`: by default a separate python process is spawned and used to communicate with the client as the debug adapter. By setting the value of `in_process_debug_adapter` to True a new python process is not spawned. Note: the con of setting `in_process_debug_adapter` to True is that subprocesses won’t be automatically debugged.

Returns the interface and the port on which the debug adapter is actually listening, in the same format as `__endpoint`. This may be different from address if port was 0 in the latter, in which case the adapter will pick some unused ephemeral port to listen on.

This function does’t wait for a client to connect to the debug adapter that it starts. Use `wait_for_client` to block execution until the client connects.