PyDev Client
This project is still in beta, so it may require some extra actions to get it running. Your mileage may vary.
PyDev (https://github.com/fabioz/PyDev.Debugger) is the Python debugger used in PyCharm and Eclipse’s PyDev-plugin. It supports debugging multi-threaded applications such as Django or CherryPy -based projects.
This repository contains a command-line client for PyDev, and realgud-bindings for using it inside Emacs.
Features:
Implemented commands:
Parameters and outputs are similar to those of trepan3k-debugger.
command | short | description |
---|---|---|
start | start the debugger | |
step | s | step into |
next | n | step over |
return | r | step out |
break | b | add breakpoint |
delete | remove breakopint | |
continue | c | continue execution after break |
eval | e | evaluate an expression |
exit/quit | ^D | exit the debugger (server will be killed with SIGTERM) |
list | l | list file contents around current position |
Features to be implemented:
- Enabling/disabling breakpoints
- Moving up/down frames
- Restarting the debugger
- Breakpoint conditional expressions
- Better input handling, arrow keys not working since we are using readline for now. Reason for using readline instead of raw_input is that readline can be used with select.
- Tests
- Better handling for multiple threads, currently the client selects one thread as an active one. A thread that stops at a breakpoint is always selected as active
- Supporting multiple simultaneous sessions inside emacs, requires some way to get a free port number for the server and the client to become aware of it.
Python client
Installation:
python setup.py install
This will install the client, and PyDev debugger daemon as a dependency.
Usage:
Start the daemon:
pydevd --port port --server --file filename [arguments ...]
or
pydevd --port port --server --module --file filename [arguments ...]
Start the client:
pydevc --server 127.0.0.1 --port port
The client has connected to the remote debugger when you see prompt (pydev).
Realgud extension
Installation:
Add following to your init file (requires use-package to be installed):
(use-package realgud-pydev
:load-path "/path/to/pydev-client")
Usage:
M-x realgud:pydev-current-file
or
M-x realgud:pydev-module
Virtual environments work as expected at least with pyvenv, if the python modules have been installed to the specific virtual environment.
The pydevd-server will be opened in a separate process, and it’s output will be shown in a separate emacs buffer. This makes it easier to use the command-line interface when the output of the debugged program does not mess up the interface.
Compiling PyDev debugger
To get much more performance from the debugger server, you can compile it with Cython:
- Clone the PyDev repository from https://github.com/fabioz/PyDev.Debugger
- Ensure you have cython installed
pip install cython
- Compile the library
python setup_cython.py build_ext --inplace
- Install the library
pip install .