Overview
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().
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
Changelog
1.3.0 (2019-03-13)
Documented support for Python 3.8’s breakpoint().
Added support for setting the socket listening host/port through the REMOTE_PDB_HOST/REMOTE_PDB_PORT environment variables. Contributed by Matthew Wilkes in #14.
Removed use of rw file wrappers around sockets (turns out socket’s makefile is very buggy in Python 3.6 and later - output is discarded). Contributed in #13.
1.2.0 (2015-09-26)
Always print/log listening address.
1.1.3 (2015-07-06)
Corrected the default frame tracing starts from.
1.1.2 (2015-07-06)
Small readme update.
1.1.1 (2015-07-06)
Remove bogus remote_pdb console script.
1.1.0 (2015-06-21)
Fixed buffering issues when running on Python 3 and Windows.
1.0.0 (2015-06-15)
Added support for PDB++.
0.2.1 (2014-03-07)
First release on PyPI.
Metadata
Release files for coinstac-remote-pdb 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| coinstac-remote-pdb-1.3.1.tar.gz | 18.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| coinstac_remote_pdb-1.3.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / coinstac-remote-pdb-1.3.1.tar.gz
| Download URL | coinstac-remote-pdb-1.3.1.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccadac638de5883ed3234396d398830c3b92af5330caa7b20aba56e227a67784
|
|
BLAKE2b-256 checksum How to use checksums |
6f424a0f8622ff9e1ec3d09792bfc5b1fd5aa3a750d01f6def8ba85474edd50d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0
|
Release files / coinstac_remote_pdb-1.3.1-py2.py3-none-any.whl
| Download URL | coinstac_remote_pdb-1.3.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5df79ea6ac3b689ac8983ac94473def64cc25637bc8c198cede2ffe4ebb4e4c9
|
|
BLAKE2b-256 checksum How to use checksums |
330c1159d0c820db378303801723227d7ae66e96248b72e35ababc77996fc4d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0
|
Security for coinstac-remote-pdb 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.