Skip to content
Remote vanilla PDB (over TCP sockets).
Python PowerShell Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci
docs Bump version: 1.3.0 → 2.0.0 Jul 30, 2019
src Bump version: 1.3.0 → 2.0.0 Jul 30, 2019
tests Add tests for quiet feature. Jul 20, 2019
.bumpversion.cfg
.cookiecutterrc Update skel. Mar 12, 2019
.coveragerc Update skel. Mar 12, 2019
.editorconfig Update skel. Mar 12, 2019
.gitignore
.travis.yml Fix a bunch of skel issues. Disable coveralls. Jul 20, 2019
AUTHORS.rst make quit behaviour consistent with pdb Jul 13, 2019
CHANGELOG.rst
CONTRIBUTING.rst Update skel. Mar 12, 2019
LICENSE Update skel. Mar 12, 2019
MANIFEST.in Update skel. Mar 12, 2019
README.rst Bump version: 1.3.0 → 2.0.0 Jul 30, 2019
appveyor.yml Fix a bunch of skel issues. Disable coveralls. Jul 20, 2019
setup.cfg Fix a bunch of skel issues. Disable coveralls. Jul 20, 2019
setup.py Bump version: 1.3.0 → 2.0.0 Jul 30, 2019
tox.ini Add tests for quiet feature. Jul 20, 2019

README.rst

Overview

docs Documentation Status
tests
Travis-CI Build Status AppVeyor Build Status Requirements Status
Coverage Status
package

Remote vanilla PDB (over TCP sockets) done right: no extras, proper handling around connection failures and CI. Based on pdbx.

  • Free software: BSD 2-Clause License

Installation

pip install remote-pdb

Usage

To open a remote PDB on first available port:

from remote_pdb import set_trace
set_trace() # you'll see the port number in the logs

To use some specific host/port:

from remote_pdb import RemotePdb
RemotePdb('127.0.0.1', 4444).set_trace()

To connect just run telnet 127.0.0.1 4444. When you are finished debugging, either exit the debugger, or press Control-], then Control-d.

Alternately, one can connect with NetCat: nc -C 127.0.0.1 4444 or Socat: socat readline tcp:127.0.0.1:4444 (for line editing and history support). When finished debugging, either exit the debugger, or press Control-c.

Integration with breakpoint() in Python 3.7+

If you are using Python 3.7 one can use the new breakpoint() built in to invoke remote PDB. In this case the following environment variable must be set:

PYTHONBREAKPOINT=remote_pdb.set_trace

The debugger can then be invoked as follows, without any imports:

breakpoint()

As the breakpoint() function does not take any arguments, environment variables can be used to specify the host and port that the server should listen to. For example, to run script.py in such a way as to make telnet 127.0.0.1 4444 the correct way of connecting, one would run:

PYTHONBREAKPOINT=remote_pdb.set_trace REMOTE_PDB_HOST=127.0.0.1 REMOTE_PDB_PORT=4444 python script.py

If REMOTE_PDB_HOST is omitted then a default value of 127.0.0.1 will be used. If REMOTE_PDB_PORT is omitted then the first available port will be used. The connection information will be logged to the console, as with calls to remote_pdb.set_trace().

To quiet the output, set REMOTE_PDB_QUIET=1, this will prevent RemotePdb from producing any output -- you'll probably want to specify REMOTE_PDB_PORT as well since the randomized port won't be printed.

Note about OS X

In certain scenarios (backgrounded processes) OS X will prevent readline to be imported (and readline is a dependency of pdb). A workaround (run this early):

import signal
signal.signal(signal.SIGTTOU, signal.SIG_IGN)

See #9 and cpython#14892.

Requirements

Python 2.6, 2.7, 3.2, 3.3 and PyPy are supported.

Similar projects

You can’t perform that action at this time.