A socket-based remote debugger for Python
Project description
Sdb
===
A socket-based remote debugger for Python. Based on `celery.contrib.rdb`.
Usage
-----
Use the `sdb` library to set remote breakpoints in any non-interactive or
background Python code and debug interactively over a telnet session::
# some/python/code.py
class SomeCode(object):
def run(self, **kwargs):
# This will set a breakpoint and open an interactive Python
# debugger exposed on a random port between 6899-6999. The chosen
# port will be reported as a warning
#
# Remote Debugger:6900: Please telnet into 0.0.0.0 6900.
#
# You can access it from your host machine using telnet:
#
# $ telnet <hostname> <port>
import sdb
sdb.set_trace()
Keep in mind that when you interactively debug in this way, any process
that encounters a breakpoint will wait until an active client is established
and concludes the debugging session with a `continue` command.
Automatically Connecting to Breakpoints
---------------------------------------
To simplify remote debugging session management, you can use `sdb-listen`
to automatically discover open remote debugging sessions and connect to them::
$ sdb-listen
This will open a Python process that listens for new debugger sessions and
automatically connects to them for you. If your breakpoint is run on
an _entirely different host_, you can optionally specify the hostname where
`rbd-listen` is running::
import sdb
sdb.set_trace(notify_host='docker.for.mac.localhost')
===
A socket-based remote debugger for Python. Based on `celery.contrib.rdb`.
Usage
-----
Use the `sdb` library to set remote breakpoints in any non-interactive or
background Python code and debug interactively over a telnet session::
# some/python/code.py
class SomeCode(object):
def run(self, **kwargs):
# This will set a breakpoint and open an interactive Python
# debugger exposed on a random port between 6899-6999. The chosen
# port will be reported as a warning
#
# Remote Debugger:6900: Please telnet into 0.0.0.0 6900.
#
# You can access it from your host machine using telnet:
#
# $ telnet <hostname> <port>
import sdb
sdb.set_trace()
Keep in mind that when you interactively debug in this way, any process
that encounters a breakpoint will wait until an active client is established
and concludes the debugging session with a `continue` command.
Automatically Connecting to Breakpoints
---------------------------------------
To simplify remote debugging session management, you can use `sdb-listen`
to automatically discover open remote debugging sessions and connect to them::
$ sdb-listen
This will open a Python process that listens for new debugger sessions and
automatically connects to them for you. If your breakpoint is run on
an _entirely different host_, you can optionally specify the hostname where
`rbd-listen` is running::
import sdb
sdb.set_trace(notify_host='docker.for.mac.localhost')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sdb-1.3.tar.gz
(5.2 kB
view details)
File details
Details for the file sdb-1.3.tar.gz
.
File metadata
- Download URL: sdb-1.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcd6498e4a63804da5238f223c4b0a7be7619f94ba3c4ef7d9c0db364be08161 |
|
MD5 | cf850e5f1e76f56a1adef40f21a5385e |
|
BLAKE2b-256 | 90bd5c1143316f582bf295288046a77808e6095504bc545b5b87cdba0f093614 |