Thread: Debugging
View Single Post
Old 12-20-2023, 02:18 PM   #1
tomsem
Grand Sorcerer
tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.tomsem ought to be getting tired of karma fortunes by now.
 
Posts: 6,530
Karma: 26425959
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Debugging

I have a couple of ideas which I'd like to develop as calibre plugins.

But throughout my software development career (now retired), I've relied on being able to step through code with an IDE of some sort to understand existing code and ensure my code is working as expected.

Calibre requires setting up remote debugging, something I never really ever had to do, and have played with only a couple of times, and not recently.

My tool of choice is PyCharm Professional. I also use VSCode a bit for python projects.

Note that I want to step through both plugin code and calibre code (if this requires different setups, so be it).

I found this very brief thread which discusses setting things up for plugin:

https://www.mobileread.com/forums/sh...d.php?t=334662

However the screenshots link in the post is dead, so it leaves me with some questions about how to do it, even after reading PyCharm docs.

Calibre debugging tips aren't helping me much either apart from saying 'It is possible':

Quote:
It is possible to use the builtin debugger in your favorite Python IDE, if it supports remote debugging. The first step is to add the calibre src checkout to the PYTHONPATH in your IDE. In other words, the folder you set as CALIBRE_DEVELOP_FROM above, must also be in the PYTHONPATH of your IDE.

Then place the IDE’s remote debugger module into the src sub-folder of the calibre source code checkout. Add whatever code is needed to launch the remote debugger to calibre at the point of interest, for example in the main function. Then run calibre as normal. Your IDE should now be able to connect to the remote debugger running inside calibre.
I've tried looking for examples for PyQT development but found nothing helpful.

I've been doing a little bit of exploring with calibre python console, but it is slow-going and I'll never get very far that way, at least with my current brain and available time (I'm a full time caretaker and get interrupted a lot).

I need a little more specific detail to get going, ideally from other developers here who are familiar with PyCharm.

Thanks!
tomsem is online now   Reply With Quote