|
|
#1 | |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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? |
|
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,617
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes, you need the calibre source.
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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)? |
|
|
|
|
|
#4 |
|
livin' with ebooks
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
|
|
|
![]() |
|
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 |