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 03-17-2023, 11:07 PM   #1
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 793
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Sage
Absolute Beginner: Import Calibre Source for Plugin Use?

I'm an absolute beginner to all aspects of editing an existing plugin in Calibre. So, I'm not even smart enough to search for an answer. I'm trying to look at an existing Calibre plugin in an IDE (VS Code). Looking at even the _init_.py module, I see that the IDE can't resolve the very first "from" line:
Code:
# The class that all Interface Action plugin wrappers must inherit from
from calibre.customize import InterfaceActionBase
Quote:
Import "calibre.customize" could not be resolved
Does that mean I have to grab the Calibre source as described:
https://manual.calibre-ebook.com/dev...tting-the-code
and then set up a Windows development environment:
https://manual.calibre-ebook.com/dev...nt-environment
?

Or, is that just for modifying Calibre, itself?

If I do have to grab that source code, do I need to worry about my regular use of Calibre?
enuddleyarbl is offline   Reply With Quote
Old 03-17-2023, 11:55 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,617
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yes, you need the calibre source.
kovidgoyal is online now   Reply With Quote
Advert
Old 03-18-2023, 07:05 PM   #3
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 793
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Sage
I did a git clone on the Calibre repository and got the source code ok. But, then I couldn't figure out how to point the plugin's code in my IDE (VS Code) at the Calibre source. I finally found a reference in the Calibre manual to doing that with PYTHONPATH in the IDE:

https://manual.calibre-ebook.com/dev...ite-python-ide

Which I couldn't figure out how to do. Finally, I just created a Windows environment variable (just like I did with CALIBRE_DEVELOP_FROM) and most of the references resolved (the remaining ones are for the actual plugin's configuration file and for "from PyQt5.Qt import QApplication" -- which I'm working on).

But, as a suggestion, could you add a sentence to either the Getting the Code or the Windows Development Environment sections of the manual to set up that PYTHONPATH Windows environment variable at the same time as setting up the CALIBRE_DEVELOP_FROM one (assuming I did the right thing)?
enuddleyarbl is offline   Reply With Quote
Old 09-24-2025, 10:24 AM   #4
bopuc
livin' with ebooks
bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'bopuc understands when you whisper 'The dog barks at midnight.'
 
bopuc's Avatar
 
Posts: 42
Karma: 42048
Join Date: Jun 2014
Location: Berlin (DE), winters in Aomori (JP), from Montréal (CA)
Device: Libra2, KOA
Indeed, adding this explicitly to the documentation would be very helpful.

It is unfortunately not obvious (even to the experienced) where to put development plugin code (which is a repo itself) in relation to a local clone of the Calibre source code in order for the IDE to resolve imports when working on said plugin.

Last edited by bopuc; 09-24-2025 at 10:38 AM. Reason: emoji not supported so edited out
bopuc is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugin to import Highlight information from external source fmagin Development 5 06-01-2023 11:41 PM
Absolute beginner confused Help! LivingLegend Kindle Developer's Corner 9 12-29-2021 11:03 AM
Kindlets development: Absolute beginner's guide Alexander Turcic Amazon Kindle 0 08-09-2013 04:43 AM
Kindlet writing guide for the absolute beginner [PW] Hotrootsoup Kindle Developer's Corner 5 08-08-2013 08:37 PM
Import source calibre feliciam Development 2 03-26-2013 04:59 AM


All times are GMT -4. The time now is 11:07 PM.


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