Systemwide installation of plugins / Discovery of installed plugins via pkg_resources
#1  t-8ch 10-10-2020, 09:23 AM

I would like to develop a mechanism for Calibre to discover and use systemwide installed plugins in addition to builtin plugins and plugins loaded from the users settings.

This would allow users and Linux distributions to package third-party plugins the same way as the rest of the system, including custom distribution or pip package repositories.

My primary idea is to use the existing setuptools discovery mechanism for plugins: pkg_resource entrypoints.
This is the standard Python way, does not require any dependencies and should always work.
The only disadvantage I can see is that existing plugins probably don't have setuptools metadata. But that should be easy to add, first downstream by people packaging the plugins and later directly inside the plugins repository.

I am willing to implement this feature and see it through, but first I'd like to get feedback from the Calibre team whether this has a chance of being accepted.


#2  kovidgoyal 10-10-2020, 10:47 AM
Are there actual plugin authors that want this, or that are even interested in distributing their plugins via pip/linux distributions, or are willing to add the necessary metadata to their plugins?

As per there are under 5% of calibre users on Linux, which is really the only platform where this would have even a chance of being used.

In order for me to consider this, there would need to be some demonstrated interest from plugin authors.

#3  t-8ch 10-11-2020, 05:32 AM
My concrete usecase would be the DrDRM plugin.

They are currently not part of the Calibre repository.
I'll ask them about their opinions.

#4  kovidgoyal 10-11-2020, 07:28 AM
I highly doubt any linux distros would be willing to distribute that as it would violate the DMCA

#5  eschwartz 10-13-2020, 01:27 AM
I don't see any need for pkg_resources entry points, especially since calibre doesn't currently use setuptools or pkg_resources (though its dependencies might).

Furthermore, calibre is still not in site-packages (we would need to figure out a way to get upstream tinycss/odfpy to not be broken, and fork templite properly I suppose. css_selectors is custom code that could I suppose be turned into a generic library. polyglot can be phased out)

IMO it should be entirely sufficient to have calibre pick up plugins first, from e.g. /usr/share/calibre/plugins/

As for whether people would package plugins... I might update my current fanficfare CLI package to provide a calibre plugin too. Perhaps I'd package other plugins too, but not DeDRM software.

#6  t-8ch 10-16-2020, 12:41 PM
Loading a normal plugin ZIP from a central directory also sounds good. Especially as it does not need any change to plugins.
I intend to package that plugin for Arch in the AUR.

#7  JSWolf 10-16-2020, 12:56 PM
Quote t-8ch
Loading a normal plugin ZIP from a central directory also sounds good. Especially as it does not need any change to plugins.
I intend to package that plugin for Arch in the AUR.
It's not worth the hassle for such a small return. Also, most repositories botch Calibre big time. So why would you risk the plugins being botched? Plugins work well as it is. You get updtaes when you should and you get a place to post about any problems or questions you may have.

#8  eschwartz 10-16-2020, 01:29 PM
I have no idea what JSWolf just said. But he's not permitted to have an opinion on what Linux distributions want to do, since he is not a linux user, linux users don't care about his negativity regarding linux, and no one cares how much better Windows 10 is, so he can go troll some other thread.


I'm primarily interested in plugins not needing changes, yes.

Though idk, it might be a performance boost to let them run extracted (since they're externally managed, a primary benefit of zipped plugins is not there). They could be byte-compiled and distributed by distro packages with better-than-zip compression.
Not sure if it's worth the added complexity, but... shower thoughts.

#9  t-8ch 11-14-2020, 10:25 AM
The PR is here:

Today's Posts | Search this Thread | Login | Register