-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
sopel: reduce and reorganize imports for critical modules #2179
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.
OK, I pulled together a full review. Only took (I think) three sessions—which is shamefully inefficient on my part, but there has been a lot going on IRL and it's been hard to find time to focus on this stuff. Should be more or less caught up on unreviewed PRs after this, though. 🥳
Alright so, 2 topics to discuss that needs an action:
Name conflict resolutionsBefore even talking about semantics, there is still a name conflict to deal with. There are 3 options:
SemanticsThere is a question behind this, which is "what is a Plugin Handler?", and with it, "what does it do?". I argue that a Plugin Handler is not a plugin, it's a handler: it's a proxy between Sopel and its plugins. I argue that its actions are to load, setup, configure, and shutdown the plugin that it handles, and that "plugin" is its action's target. When I read "Hold up!" said @dgw "why is PyModulePlugin named like that, and not PyModulePluginHandler?" AH AH. Great question my friend: it's because they are internal names, and their "handlerness" comes from their module: However... nothing is that simple, because I know there are functions that call handlers "plugins", which create inconsistency in Sopel's codebase. That's not new, but that's not great either. |
@dgw before I rebase to fix conflict, would you consider my first question?
That would close a lot of comment, as I would either apply the changes or mark as resolved! |
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 like sopel.plugin as a shortcut and I think it makes sense to present that to plugin authors and to document it as such (i.e. keep using sopel.plugin in the doc). Action: keep or switch to
sopel.privileges
in the doc?
I like the shortcut, too, but it seems to me that we should always document things as they appear in the docs—and these constants don't appear in the documentation for plugin
any more after this change.
Marked up a couple little things that I noticed while idly scrolling around, thinking about the answer above.
Alright, so I've to find a way to properly convey that information. Thanks! |
4ec003a
to
2277425
Compare
ping @dgw for the follow up :) |
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.
Turns out I had more thoughts left than expected—and that was after writing (then deleting) a whole thing about the plugin_jobs
/tools_jobs
thing that will be addressed in a separate patch.
Co-authored-by: dgw <dgw@technobabbl.es>
1e20f85
to
912f616
Compare
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 say if any typo or other mistake has eluded both of us for this long, it deserves to make it into master
and then get patched out in X months when we finally notice. 😁
Description
Sopel has critical modules (
sopel.bot
,sopel.coretasks
, etc.) and I wasn't really happy with their dependencies, starting with a dependency tosopel.loader
. This is where I started: I tried to remove dependencies to loader when possible or necessary, and I followed that by reducing imports when possible, with few reorganization here and there.This is not much, and some may argue that this isn't necessary. However, I'd rather take preventive action now against circular imports or dependency hell now than facing these issues later.
Also I had to extract privilege constants from
sopel.plugin
into their own module, which lead me to write some proper documentation about privileges.Checklist
make qa
(runsmake quality
andmake test
)