Skip to content

Conversation

somsomin
Copy link

This PR resolves Issue #1694 by adding a warning for plugin folders named lib, test, or utils. These names may cause plugin loading conflicts due to Python module resolution or backend-specific files (e.g., Slack's lib.py).

I reproduced the issue by creating a plugin in a lib/ folder, which failed to load silently. I added a log.warning(...) message in plugin_manager.py to alert developers early. I also added a documentation warning in docs/plugindevelopment.rst to guide plugin authors.

Let me know if you'd like anything adjusted.

@nzlosh
Copy link
Contributor

nzlosh commented Apr 26, 2025

If you intended to push code changes to this PR, you should adjust the title as it no longer only addresses documentation.

plugfiles = path.glob("**/*." + extension)

plugfiles = []
for ext in ("plug", "plugin"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unfortunately would break the usage in

def _load_plugins(self) -> Dict[Path, str]:
feedback = {}
for path in self.plugin_places:
self._load_plugins_generic(
path,
"plug",
"errbot.plugins",
BotPlugin,
self.plugins,
self.plugin_infos,
feedback,
)
self._load_plugins_generic(
path,
"flow",
"errbot.flows",
BotFlow,
self.flows,
self.flow_infos,
feedback,
)
return feedback
, as the parameters being passed include plug and flow. This change, unfortunately does not address that and include a new one named plugin.

@@ -0,0 +1,3 @@
.. warning::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning can be very useful for plugin developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants