Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 12-20-2023, 03: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,802
Karma: 26985557
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 offline   Reply With Quote
Old 12-20-2023, 03:32 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,097
Karma: 7908993
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
First, I am not familiar with PyCharm.

I do all my calibre debugging with print statements. Yes, very old fashioned but it works, often better than stepping with an IDE. Add the print statements, restart calibre, voila. When working on a plugin I use a script to install the plugin (which is the plugin's source) then start calibre in debug mode.

This technique also lets you "instrument" base calibre if you are having some trouble with an API, assuming you are running from source.
chaley is offline   Reply With Quote
Old 12-21-2023, 08:59 PM   #3
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,802
Karma: 26985557
Join Date: Apr 2009
Location: USA
Device: iPhone 15PM, Kindle Scribe, iPad mini 6, PocketBook InkPad Color 3
Thanks. I think something has clicked in my brain (sleep is amazing), and I'll be able to get remote debugging working with a little more investment of time and focus.
tomsem is offline   Reply With Quote
Old 07-04-2024, 07:27 PM   #4
zencricket
Junior Member
zencricket began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2024
Device: kindle paperwhite
Quote:
Originally Posted by tomsem View Post
Thanks. I think something has clicked in my brain (sleep is amazing), and I'll be able to get remote debugging working with a little more investment of time and focus.
@tomsem, if you were able to get the debugger working, would you please let us know how?

thx!
zencricket is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging calibre/plugins 413Michele Calibre 6 11-24-2023 02:14 PM
Debugging the screen Calenorn General Discussions 7 04-04-2017 03:56 PM
Debugging an epub anomaly? MacEachaidh ePub 12 05-17-2013 10:17 PM
Debugging Password kaitorii enTourage Archive 4 11-14-2010 10:34 AM
iLiad Debugging and the iLiad scotty1024 iRex Developer's Corner 2 10-23-2006 04:43 PM


All times are GMT -4. The time now is 10:18 PM.


MobileRead.com is a privately owned, operated and funded community.