📜 ⬆️ ⬇️

Convenient debugger for Python / Django projects


Pudb is a full-screen, graphical console debugger. The big plus is that it has syntax highlighting, additional information output panels, hotkeys and integration with IPython.

pdb, in comparison with Pubd, seemed creepy not convenient and limited. Search for errors began to take a lot less time and bring more fun. At first glance, I recalled Assembler and Turbo Pascal in college years in college.

If who became interested in examples of installation and use under a cat.

')
The installation is terribly banal and familiar, easily installed from PyPI:
pip install pudb 

Or you can put on a straight line from the source:
 git clone git://github.com/inducer/pudb.git cd pudb && setup.py install 


If you wish, you can run the debugger from Bash:
 $ python >>> import pudb >>> pudb.set_trace() 


When you first start pubd, a window will appear to configure it. Or it will not appear, as it was with me, in this case, call the customizer with the Ctrl + p combination.
When you first see the debager, it’s likely that everything will be immediately clear to you, the interface is surprisingly concise and friendly.
In the customizer, you can choose a shell (classic or ipython), a theme (midnight, vim, dark, classic, vim, or create a theme yourself), the order of the stack output, the way the values ​​of context variables are displayed.

The debugger can be invoked for both individual Python scripts and the Django framework.
To integrate with Django, just in the right place we insert the following lines:
 from pudb import set_trace; set_trace() 


To debug a separate script, do this:
 python -m pudb.run my-script.py 


For those using Python 2.6 and higher, you can call:
 python -m pudb my-script.py 


If something is not clear in the interface, you can always click "?" and you will see a complete list of commands.
There are a lot of possibilities for the debugger, for example, you can output treysbek, the path to the current file and the line number on which we are located, there is a search, convenient work with breakpoints and much, much more.
In general, everything you need for convenient debugging and quick search for errors pubd contains in itself.
As they say, living with him has become easier.

Github Link
Wiki link

Source: https://habr.com/ru/post/158139/


All Articles