• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ci/H03-May-2022-304254

docs/H03-May-2022-11283

src/H24-Jul-2020-339247

tests/H24-Jul-2020-179153

.appveyor.ymlH A D24-Jul-20208.2 KiB255253

.bumpversion.cfgH A D24-Jul-2020499 2216

.cookiecutterrcH A D24-Jul-20201.9 KiB5755

.coveragercH A D24-Jul-2020149 1512

.editorconfigH A D24-Jul-2020249 1713

.gitignoreH A D24-Jul-2020641 7261

.pre-commit-config.yamlH A D24-Jul-2020522 2019

.readthedocs.ymlH A D24-Jul-2020231 1110

.travis.ymlH A D24-Jul-20202.8 KiB124123

AUTHORS.rstH A D24-Jul-2020222 96

CHANGELOG.rstH A D24-Jul-20201.7 KiB6442

CONTRIBUTING.rstH A D24-Jul-20202.7 KiB9157

LICENSEH A D24-Jul-20201.3 KiB2115

MANIFEST.inH A D24-Jul-2020374 2015

PKG-INFOH A D24-Jul-20207.9 KiB206139

README.rstH A D24-Jul-20205.6 KiB171113

setup.cfgH A D24-Jul-2020631 4539

setup.pyH A D24-Jul-20202.8 KiB8166

tox.iniH A D24-Jul-20202 KiB10394

README.rst

1========
2Overview
3========
4
5.. start-badges
6
7.. list-table::
8    :stub-columns: 1
9
10    * - docs
11      - |docs|
12    * - tests
13      - | |travis| |appveyor| |requires|
14        | |coveralls| |codecov|
15    * - package
16      - | |version| |wheel| |supported-versions| |supported-implementations|
17        | |commits-since|
18.. |docs| image:: https://readthedocs.org/projects/python-remote-pdb/badge/?style=flat
19    :target: https://readthedocs.org/projects/python-remote-pdb
20    :alt: Documentation Status
21
22.. |travis| image:: https://api.travis-ci.org/ionelmc/python-remote-pdb.svg?branch=master
23    :alt: Travis-CI Build Status
24    :target: https://travis-ci.org/ionelmc/python-remote-pdb
25
26.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/python-remote-pdb?branch=master&svg=true
27    :alt: AppVeyor Build Status
28    :target: https://ci.appveyor.com/project/ionelmc/python-remote-pdb
29
30.. |requires| image:: https://requires.io/github/ionelmc/python-remote-pdb/requirements.svg?branch=master
31    :alt: Requirements Status
32    :target: https://requires.io/github/ionelmc/python-remote-pdb/requirements/?branch=master
33
34.. |coveralls| image:: https://coveralls.io/repos/ionelmc/python-remote-pdb/badge.svg?branch=master&service=github
35    :alt: Coverage Status
36    :target: https://coveralls.io/r/ionelmc/python-remote-pdb
37
38.. |codecov| image:: https://codecov.io/gh/ionelmc/python-remote-pdb/branch/master/graphs/badge.svg?branch=master
39    :alt: Coverage Status
40    :target: https://codecov.io/github/ionelmc/python-remote-pdb
41
42.. |version| image:: https://img.shields.io/pypi/v/remote-pdb.svg
43    :alt: PyPI Package latest release
44    :target: https://pypi.org/project/remote-pdb
45
46.. |wheel| image:: https://img.shields.io/pypi/wheel/remote-pdb.svg
47    :alt: PyPI Wheel
48    :target: https://pypi.org/project/remote-pdb
49
50.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/remote-pdb.svg
51    :alt: Supported versions
52    :target: https://pypi.org/project/remote-pdb
53
54.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/remote-pdb.svg
55    :alt: Supported implementations
56    :target: https://pypi.org/project/remote-pdb
57
58.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-remote-pdb/v2.1.0.svg
59    :alt: Commits since latest release
60    :target: https://github.com/ionelmc/python-remote-pdb/compare/v2.1.0...master
61
62
63
64.. end-badges
65
66Remote vanilla PDB (over TCP sockets) *done right*: no extras, proper handling around connection failures and CI. Based
67on `pdbx <https://pypi.python.org/pypi/pdbx>`_.
68
69* Free software: BSD 2-Clause License
70
71Installation
72============
73
74::
75
76    pip install remote-pdb
77
78Usage
79=====
80
81To open a remote PDB on first available port:
82
83.. code:: python
84
85    from remote_pdb import set_trace
86    set_trace() # you'll see the port number in the logs
87
88To use some specific host/port:
89
90.. code:: python
91
92    from remote_pdb import RemotePdb
93    RemotePdb('127.0.0.1', 4444).set_trace()
94
95To connect just run ``telnet 127.0.0.1 4444``.  When you are finished
96debugging, either exit the debugger, or press Control-], then Control-d.
97
98Alternately, one can connect with NetCat: ``nc -C 127.0.0.1 4444`` or Socat: ``socat readline
99tcp:127.0.0.1:4444`` (for line editing and history support).  When finished debugging, either exit
100the debugger, or press Control-c.
101
102Note that newer Ubuntu disabled readline support in socat, so if you get
103``unknown device/address "readline"`` try using rlwrap like this::
104
105    rlwrap socat - tcp:127.0.0.1:4444
106
107Using in containers
108===================
109
110If you want to connect from the host to remote-pdb running inside the container you should make sure that:
111
112* The port you will use is mapped (eg: ``-p 4444:4444``).
113* The host is set to ``0.0.0.0`` (``localhost` or ``127.0.0.1`` will not work because
114  Docker doesn't map the port on the local interface).
115
116Integration with breakpoint() in Python 3.7+
117============================================
118
119If you are using Python 3.7 one can use the new ``breakpoint()`` built in to invoke
120remote PDB. In this case the following environment variable must be set:
121
122.. code:: bash
123
124    PYTHONBREAKPOINT=remote_pdb.set_trace
125
126The debugger can then be invoked as follows, without any imports:
127
128.. code:: python
129
130    breakpoint()
131
132As the ``breakpoint()`` function does not take any arguments, environment variables can be used to
133specify the host and port that the server should listen to. For example, to run ``script.py`` in such a
134way as to make ``telnet 127.0.0.1 4444`` the correct way of connecting, one would run:
135
136.. code:: bash
137
138    PYTHONBREAKPOINT=remote_pdb.set_trace REMOTE_PDB_HOST=127.0.0.1 REMOTE_PDB_PORT=4444 python script.py
139
140If ``REMOTE_PDB_HOST`` is omitted then a default value of 127.0.0.1 will be used. If ``REMOTE_PDB_PORT`` is
141omitted then the first available port will be used. The connection information will be logged to the console,
142as with calls to ``remote_pdb.set_trace()``.
143
144To quiet the output, set ``REMOTE_PDB_QUIET=1``, this will prevent
145``RemotePdb`` from producing any output -- you'll probably want to specify
146``REMOTE_PDB_PORT`` as well since the randomized port won't be printed.
147
148
149Note about OS X
150===============
151
152In certain scenarios (backgrounded processes) OS X will prevent readline to be imported (and readline is a dependency of pdb).
153A workaround (run this early):
154
155.. code:: python
156
157    import signal
158    signal.signal(signal.SIGTTOU, signal.SIG_IGN)
159
160See `#9 <https://github.com/ionelmc/python-remote-pdb/issues/9>`_ and `cpython#14892 <http://bugs.python.org/issue14892>`_.
161
162Requirements
163============
164
165Python 2.6, 2.7, 3.2, 3.3 and PyPy are supported.
166
167Similar projects
168================
169
170* `qdb <https://pypi.python.org/pypi/qdb>`_
171