-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins: load plugins from setuptools entry points #1585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this. It's much more elegant than the sopel_modules
namespace introduced under my predecessor (and not only because it should have been named sopel_plugins
😛)! Just some nitpicky (as usual) naming stuff from me—and only one grammar fix! You're getting better. 😸
Just a quick note: fixed as asked. It looks good for a last review & merge. Can't wait to play with that feature for future plugins! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last English nitpick. Don't worry about the EntryPointPlugin
class note; I'm just asking, not requesting that you update or rewrite anything for this PR.
By defining a `sopel.plugins` entry point in a `setup.cfg` (or `setup.py`) it is now possible to expose a Sopel plugin: setup( name='my_plugin', version='1.0' entry_points={ 'sopel.plugins': [ 'custom = my_plugin.path.to.plugin', ], } ) This definition will allow Sopel to load the `custom` plugin, from the Python sub-module `my_plugin.path.to.plugin` from the `my_plugin` package. Co-Authored-By: dgw <dgw@technobabbl.es>
35fed08
to
18e8ac6
Compare
@dgw done! 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoorah!
By defining a
sopel.plugins
entry point in asetup.cfg
(orsetup.py
) it is now possible to expose a Sopel plugin:This definition will allow Sopel to load the
custom
plugin, from the Python sub-modulemy_plugin.path.to.plugin
from themy_plugin
package.I'm not 100% happy with my abstractclass/subclasses, but I think that's for another day. Here, I wanted to showcase how quick and easy it is to implement new ways to discover Sopel plugins.
I'd like to mention that, in my opinion, entry points are probably a better option than
sopel_modules.*
subpackages.