Release script-module-web-pdb: a web-based remote Python debugger for addon developers
#1
Not long ago I created a topic about a remote console-based debugger that I made from third-party remote-pdb package.

I'm old enough to remember green terminals of ES mainframes - Soviet-made clones of IBM 370, so a console environment does not scare me.Smile But I wanted something slightly better than a plain console. So I created Web-PDB package that is a web-UI for Python's built-in PDB debugger with several improvements. And now I want to present you script-module.web-pdb -- a port of Web-PDB specially made for Kodi.

Image

script-module.web-pdb allows you to debug your Python addons remotely in a web-browser, so you don't need to install any terminal clients or specific IDEs. Since script-module.web-pdb is basically a web-UI for PDB debugger, you can use all available documentation and tutorials to learn how to debug Python scripts with PDB. You can find more info about how to use script-module.web-pdb in Readme on GitHub.

Main features:

- Responsive design based on Bootstrap.

- Python syntax highlighting with Prism ("Okaida" theme).

- Supports all PDB features.

- Current file box tracks current position in a file being executed. Red line numbers indicate breakpoints, if any.

- Globals and Locals boxes show local and global variables in the current scope. Special variables that start and end with double underscores __ are excluded (you can always view them using PDB commands).

- Human-readable Unicode literals for Python 2.

- Command history that stores up to 10 last unique PDB commands (accessed by arrow UP/DOWN keys).

License: MIT

Links:

script-module.web-pdb sources on GitHub: https://github.com/romanvm/kodi.web-pdb
Installable addon .zip: https://github.com/romanvm/kodi.web-pdb/releases/latest
Web-PDB Changelog: https://github.com/romanvm/python-web-pd...ngelog.rst
Introductory video (courtesy of Michele Lombardo): https://www.youtube.com/watch?v=6gMmeA7UY18

My video tutorial: https://www.youtube.com/watch?v=OukjNpafNZU

Reply
#2
I've never used pdb before but this looks mightily impressive so I'm keen to try it out.

Thanks for all your work.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#3
looks interesting. Thx!
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#4
great stuff
Reply
#5
Roman,

Can this be used with service addons? I'm happy to accept that it may just be my lack of familiarity with pdb but, if I set a break point within a function that should be called every 5 seconds and type "continue", it never seems to stop at the breakpoint.

Is this a lack of my understanding how this works!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#6
(2016-09-28, 20:56)el_Paraguayo Wrote: Roman,

Can this be used with service addons? I'm happy to accept that it may just be my lack of familiarity with pdb but, if I set a break point within a function that should be called every 5 seconds and type "continue", it never seems to stop at the breakpoint.

Is this a lack of my understanding how this works!

This should work with any Python addons. The only problematic part is multi-threaded programs. You cannot set a breakpoint with "b" in another thread because each thread maintains its own execution frame stack.

If you are not using threads, then could you share your code so that I could investigate where the problem is?
Reply
#7
I do have multiple threads but I've kept the trace to the main thread.

I've been getting unexpected behaviour elsewhere with my code so this all makes me feel like I've done something wrong somewhere!

I'll test some more first and then, if I still have an issue, I'll post the code.

ps this is a very cool addon indeed, so thank you for taking the time to make it.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#8
OK. Got it to work. I had to set breakpoint using the name of the method, not the line number. Not sure why that made a difference.

Working very nicely now.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#9
(2016-09-30, 08:52)el_Paraguayo Wrote: OK. Got it to work. I had to set breakpoint using the name of the method, not the line number. Not sure why that made a difference.

Working very nicely now.

I'm not sure about it either, but breakpoints work at BDB level, which is even lower than PDB, so I haven't looked into it. But I'm glad it has worked out.

BTW, currently I'm working on the next version that will have some improvements in terms of user experience (for example, a quick commands toolbar) and functionality. I'll also remove the limitation for multiple set_trace() calls in Kodi version so you can have hardcoded breakpoints too.

The only limitation that still remain is multi-threaded programs. I need to fined a convenient way to monitor multiple frame stacks within one UI.
Reply
#10
(2016-09-30, 09:49)Roman_V_M Wrote: BTW, currently I'm working on the next version that will have some improvements in terms of user experience (for example, a quick commands toolbar) and functionality. I'll also remove the limitation for multiple set_trace() calls in Kodi version so you can have hardcoded breakpoints too.

The only limitation that still remain is multi-threaded programs. I need to fined a convenient way to monitor multiple frame stacks within one UI.
I tried the multiple set_trace idea but hit the limitation you mentioned.

If you somehow manage to do multi-threaded debugging, you'd be a genius!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#11
(2016-09-30, 11:03)el_Paraguayo Wrote:
(2016-09-30, 09:49)Roman_V_M Wrote: BTW, currently I'm working on the next version that will have some improvements in terms of user experience (for example, a quick commands toolbar) and functionality. I'll also remove the limitation for multiple set_trace() calls in Kodi version so you can have hardcoded breakpoints too.

The only limitation that still remain is multi-threaded programs. I need to fined a convenient way to monitor multiple frame stacks within one UI.
I tried the multiple set_trace idea but hit the limitation you mentioned.

If you somehow manage to do multi-threaded debugging, you'd be a genius!

I have some ideas but I need to test them first, so now I'm doing easier things. There are 2 problems with multiple threads: 1) I need to maintain a set of debuggers (one for each thread being traced) that access one web-UI, and 2) I need to present this to a user in convenient way.

PDB can trace only one thread at a time, so currently if you want to debug multiple threads you need to do it one by one.
Reply
#12
I have released version 1.2.0 for both Web-PDB and script-module.web-pdb. Important changes are listed in the Changelog. Also in Kodi version the limitation for multiple set_trace() calls has been removed.
Reply
#13
Great work! I am tempted Smile to try
Reply
#14
Does anybody actually uses it except for el_Paraguayo and myself?Big Grin
Reply
#15
I'm trying it out. Thank you for making this!
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply



Logout Mark Read Team Forum Stats Members Help
script-module-web-pdb: a web-based remote Python debugger for addon developers0
This forum uses Lukasz Tkacz MyBB addons.