What Leo's Plugins Do

75 views
Skip to first unread message

tbp1...@gmail.com

unread,
Jun 5, 2021, 10:05:31 AM6/5/21
to leo-editor
There are a lot of plugins for Leo, but it's hard to know what they all do.  Some of them are mentioned in various Leo documentation, but I find it hard to find and understand when I wonder about a particular one.  So I wrote a Python script to extract the docstring from each .py file in the plugins directory.  The script and results are attached.

It's a little tricky to do because the various docstrings are formatted differently, use both kinds of multi-line quotes (""" and '''), and have sentinals.  The script extracts the first three non-blank, non-sentinal docstring lines.  Note that the script hard-codes my own plugins directory, so make sure to change that if you want to use it yourself.

I'm not going to pretend the results are perfect, but at least you get all the basic information in one place.
leo_plugins.txt
get_plugin_docstrings.py

Edward K. Ream

unread,
Jun 6, 2021, 3:34:49 PM6/6/21
to leo-editor
On Sat, Jun 5, 2021 at 9:05 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
There are a lot of plugins for Leo, but it's hard to know what they all do.  Some of them are mentioned in various Leo documentation, but I find it hard to find and understand when I wonder about a particular one.  So I wrote a Python script to extract the docstring from each .py file in the plugins directory.  The script and results are attached.

Thanks for this.  I'll look at folding the text into LeoDocs.leo.

It's a little tricky to do because the various docstrings are formatted differently, use both kinds of multi-line quotes (""" and '''), and have sentinals.  The script extracts the first three non-blank, non-sentinal docstring lines.  Note that the script hard-codes my own plugins directory, so make sure to change that if you want to use it yourself.

Did you consider using python's "inspect" library?  That might be more robust.

Edward

tbp1...@gmail.com

unread,
Jun 6, 2021, 4:28:33 PM6/6/21
to leo-editor
Well, no, I was trying to avoid actually importing any of the modules.  I thought it might be hard to get them all imported without working through required prerequisites - I mean, when importing them without the plugin loading mechanism - and having them all at once as live Leo code might be questionable, too. Inspect works on loaded code.  If I wanted to load the code, I could just have asked for the docstring directly, I think, no need for inspect.

Edward K. Ream

unread,
Jun 6, 2021, 4:48:17 PM6/6/21
to leo-editor
On Sun, Jun 6, 2021 at 3:28 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
Well, no, I was trying to avoid actually importing any of the modules. 

That's reasonable :-)

Edward
Reply all
Reply to author
Forward
0 new messages