Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ The following command will ignore subprocesses started by the debugged process.

For full details, see the [API reference](https://github.com/microsoft/debugpy/wiki/API-Reference).

### Embedded Python hosts
`debugpy.listen()` uses `sys.executable` to start the debug adapter by default. If Python is embedded in another application, set the path to a Python interpreter before starting the listener:
```python
import debugpy
debugpy.configure(python="/path/to/python")
debugpy.listen(("localhost", 5678))
```

### Enabling debugging
At the beginning of your script, import debugpy, and call `debugpy.listen()` to start the debug adapter, passing a `(host, port)` tuple as the first argument.
```python
Expand Down
8 changes: 8 additions & 0 deletions src/debugpy/public_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ def configure(__properties: dict[str, typing.Any] | None = None, **kwargs) -> No
"attach" request, because they must be applied as early as possible
in the process being debugged.

When Python is embedded in another application, ``sys.executable``
may point to the host executable instead of a Python interpreter. Set
the ``python`` property to the interpreter that debugpy should use to
start its adapter process, before calling ``listen``::

debugpy.configure(python="/path/to/python")
debugpy.listen(...)

For example, a "launch" configuration with subprocess debugging
disabled can be defined entirely in JSON::

Expand Down