Closed geier closed 5 months ago
i'm not sure exactly how to properly architecture khal's codebase to support plugins
are you suggesting that the plugin would modify or register new cli functionalities? not sure exactly how this can be done but it really makes me think of the pdbpp project which works by extending the Python debugger (pdb) without pdb explicitly supporting any "plugin". i think pdbpp just comes to slightly modify ("patching") pdb's code in some way? haven't looked at the code but it works out of the box and "replaces" (not really because it's just a better UX) pdb
In #1279, I experimented with the "load all python modules in xdg_data_home/khal/plugins/ approach and at least for loading color themes it seems to work fine. Not sure yet how it would work with new (click) commands.
pluggy looks like the best option:
Some python plugin frameworks:
I missed this!
I got a start on a very basic way of registering plugins, similar to how mdformat works (i.e. with global maps, callables and interfaces).
I wouldn't have thought too many third party plugins would be needed, making a plugin manager overkill, but I can see the value in less boiler plate.
I'm not attached to my work, happy to help integrate a 3rd party library too.
@tcuthbert I'm also not attached to any of those frameworks.
@tcuthbert I have tried something very simple at #1309 and #1303 but I believe your approach using importlib is much smarter. I'll try to rebase #1309 and #1303 and the example plugins on your branch.
I have merged @tcuthbert's and my work at https://github.com/pimutils/khal/pull/1312
Excellent! I ended up starting a new job and lost all my free time to work on it.
On Mon, 30 Oct 2023, 12:45 am Christian Geier, @.***> wrote:
I have merged @tcuthbert https://github.com/tcuthbert's and my work at
1312 https://github.com/pimutils/khal/pull/1312
— Reply to this email directly, view it on GitHub https://github.com/pimutils/khal/issues/1258#issuecomment-1784163986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7LQLZMXMSPDNOGW2PHTBDYBZ23FAVCNFSM6AAAAAAYN6U67GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGE3DGOJYGY . You are receiving this because you were mentioned.Message ID: @.***>
Excellent! I ended up starting a new job and lost all my free time to work on it.
I hope, it's fun and pays well.
We should support plugins, probably most useful for UI changes. There have been several suggested major changes or additions to the UI (as PRs). I'm hesitant to merge (or even getting them to a state to be mergable). In the past, some of those bigger merged PRs let to code that needed to be maintained by the "core team" and for other, they just go against my personal preferences. Having the ability to support plugins would solve those issues, as those UI changes could be supported by other parties out of tree.
Does anyone have experience with supporting plugins in python code bases? My first naive idea would be to load any python module placed in a specific directly, probably after all click related parts have been initialized.