Hacker News new | ask | show | jobs
by jessewmc 3804 days ago
What do you use for Python debugging? I'm working on a large Python project coming from rails work and my biggest frustration is no equivalent to pry. I find Python debugging incredibly painful by comparison.
4 comments

In terms of web debugging instead of general code debugging tools mentioned by others, the common Python frameworks have toolbars based on Armin's Werkzeug one:

http://werkzeug.pocoo.org/docs/dev/debug/

eg...

For Pyramid: http://docs.pylonsproject.org/projects/pyramid-debugtoolbar/...

For Flask: http://flask-debugtoolbar.readthedocs.org/en/latest/

For Django: https://github.com/django-debug-toolbar/django-debug-toolbar

I have no idea how well they compare to equivalent Rails tools though.

PyCharm's debug tools are top notch. It's based on PyDev, which is an alternative that can be used independently in other IDE, but it's really the integration with the IDE that makes it a much better alternative than using, say, PyDev in Eclipse or vim.

Here's a brief overview of PyCharm debugging functionality:

http://pedrokroger.net/python-debugger/

I really like the ease of use for remote debugging. It's essential in helping to maintain a Linux development environment that closely resembles production while actually coding on a work laptop that runs Windows. Beyond that, I often use the remote functionality to run one-off scripts to retrieve and process data from a production Django system (though, generally this is restricted to 'read' operations unless it's been tested in dev).

Not a ruby dev so don't know how they compare to pry but I've been a happy heavy user of ipdb [1] and pdbpp [2].

[1] https://pypi.python.org/pypi/ipdb [2] https://pypi.python.org/pypi/pdbpp

pdb and pudb seem to be reasonably popular. I use pdb myself. I haven't used pry, so I'm not sure about equivalences.