-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[refactor] plugins: allow setting default enabled state via settings.yml #4282
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
Conversation
41d826f to
ac0000e
Compare
|
I'm a bit confused about the current way we identify plugins:
|
feb1dc0 to
37716f4
Compare
Since a long time, it is possible to reference plugin by id (python module name), the reference by user name was there as a retrocompatibility ; however the switch was never done. This PR is good opportunity to do it. [EDIT] the code has changed compare to what I remember, the above statement might be wrong. |
Many plugins don't have an ID set yet, so I assume we need to add IDs to them? Or does the ID default to the filename of the module? Isn't that ID property useless anyways, shouldn't we always use the filename as ID? @return42 As you have recently modified the plugins logic, do you have any opinion on that? |
|
Sorry for my late response: I will look for answers to your questions later, but first I want to introduce the model behind: TL;DR; Plugins should be identified by ID and they are identified by the ID .. there is just some old quirk around the settings option Plugins & Answerers were revised in the course of typification. These can now be implemented as classes.
Plugins have an searxng/searx/plugins/_core.py Lines 72 to 79 in 147bda8
One Plugin has implemented as a class: searxng/searx/plugins/hash_plugin.py Lines 19 to 26 in 147bda8
I haven't touched all plugins .. for those plugins that have not been migrated to the class model, there is a legacy wrapper: searxng/searx/plugins/_core.py Lines 165 to 175 in 147bda8
It is the module name for legacy builtin plugins: searxng/searx/plugins/_core.py Line 186 in 147bda8
Plugins are manged by the searxng/searx/plugins/_core.py Lines 236 to 240 in 147bda8
When SearXNG starts searxng/searx/plugins/_core.py Lines 267 to 271 in 147bda8
The hash plugin shown above is loaded by this part: searxng/searx/plugins/_core.py Lines 279 to 281 in 147bda8
the other internal plugins are loaded with the legacy wrapper searxng/searx/plugins/_core.py Lines 283 to 285 in 147bda8
external plugins are loaded by this part of the searxng/searx/plugins/_core.py Lines 287 to 288 in 147bda8
The The |
From an admin's point of view, but also from a technical point of view, it makes no sense to distinguish between external and internal plugins / the switch All plugins are inheritors of the searxng/searx/plugins/_core.py Lines 72 to 73 in 147bda8
And all plugins are managed in the searxng/searx/plugins/_core.py Lines 236 to 237 in 147bda8
In the configuration, external & internal plugins should be identified by there full qualified name (ATM this is only true for externel ones): We can migrate this list to a list of dict: The We just have to think about a migration path for |
37716f4 to
cf4c8f9
Compare
Before searxng#4183 a builtin plugin was *defautlt_on* when it is listed in the "enabled_plugins" settings, this patch restores the previous behavior. Not part of this patch but just to mentioning in context of searxng#4263: In the long term, we will abolish the "enabled_plugins:" setting and combine all options for the plugins in the "plugins:" setting, as is already planned in the PR searxng#4282 Closes: searxng#4263 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Before searxng#4183 a builtin plugin was *defautlt_on* when it is listed in the "enabled_plugins" settings, this patch restores the previous behavior. Not part of this patch but just to mentioning in context of searxng#4263: In the long term, we will abolish the "enabled_plugins:" setting and combine all options for the plugins in the "plugins:" setting, as is already planned in the PR searxng#4282 Closes: searxng#4263 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Before #4183 a builtin plugin was *defautlt_on* when it is listed in the "enabled_plugins" settings, this patch restores the previous behavior. Not part of this patch but just to mentioning in context of #4263: In the long term, we will abolish the "enabled_plugins:" setting and combine all options for the plugins in the "plugins:" setting, as is already planned in the PR #4282 Closes: #4263 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
|
Superseded by: ... The The implementation is similar to what has been described in this comment: #4282 (comment)
With #4538, plugins can be registered via a fully qualified class name. A configuration ( plugins:
...
searx.plugins.hostnames.SXNGPlugin:
active: true
... |
What does this PR do?
Why is this change important?
How to test this PR locally?
Related issues
closes #4263
closes #759