No way to load plugins not included with ibid

Bug #1067845 reported by Dan Poirier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ibid
Incomplete
Undecided
Unassigned

Bug Description

I'd like to load plugins from my own packages. It appears that Ibid will only load plugins from the ibid.plugins package, which is part of ibid.

Tags: plugin
Revision history for this message
Stefano Rivera (stefanor) wrote :

You can create your own ibid.plugins package on the python path (e.g. in the botdir) and just drop plugins into it. We use twisted.python.modules to unify the ibid.plugins package across the python path.

Changed in ibid:
status: New → Incomplete
Revision history for this message
Dan Poirier (poirier) wrote :

I did try that, but sometimes my plugin could be found, sometimes not, probably depending on how I happened to have my environment set up. The only reliable way seemed to be just having the one ibid/plugins dir and adding my plugin's .py there.

Revision history for this message
Dan Poirier (poirier) wrote :

If need be, I can try to come up with steps to reliably recreate the problem I'm seeing.

Revision history for this message
Stefano Rivera (stefanor) wrote :

That sounds very odd. I successfully have "local" plugins in a few bots, and have never had any trouble with them.

Revision history for this message
Dan Poirier (poirier) wrote :

I played around with it some more, creating a new virtual environment and installing ibid into it with "python setup.py install".

If I create a botdir with an ibid/plugins dir and drop a plugin .py file into it, it seems to load okay by ibid-plugin.

However, if I pip install a python package that includes an ibid/plugins dir with a plugin .py file in it, ibid-plugin fails to load it:

WARNING:core.reloader:Couldn't load haiku plugin because it requires module haiku

Revision history for this message
Stefano Rivera (stefanor) wrote :

I can't remember, but it may be that you mustn't have __init__.py s in your ibid or ibid/plugins.

Revision history for this message
Stefano Rivera (stefanor) wrote :

Also, pip merges directories, so ibid/plugins in another package should be the same directory, when installed, as ibid's ibid/plugins.

Revision history for this message
Dan Poirier (poirier) wrote :

The directory merging must only happen in some cases, because ibid's plugins are in

./lib/python2.7/site-packages/Ibid-0.2.0dev-py2.7.egg/ibid/plugins/quotes.py

while mine is at

./lib/python2.7/site-packages/ibid/plugins/haiku.py

Note that I installed Ibid by invoking setup.py directly, while I used pip to install my own package, which ought to be work fine if the packages were independent.

Anyway, it's not working; Ibid can't load my plugin.

Wouldn't it be simpler if I could just configure Ibid to load my plugin from its own package? I could give it the full import path for the class (my.package.file.ClassName?) and remove all ambiguity, leaving ibid/plugins for the plugins that are shipped with Ibid.

Revision history for this message
Stefano Rivera (stefanor) wrote : Re: [Bug 1067845] Re: No way to load plugins not included with ibid

Hi Dan (2012.10.18_19:34:54_+0200)
> while mine is at
>
> ./lib/python2.7/site-packages/ibid/plugins/haiku.py

Make sure that you don't have:
./lib/python2.7/site-packages/ibid/__init__.py
or
./lib/python2.7/site-packages/ibid/plugins/__init__.py
or .pyc files for either of those

> Wouldn't it be simpler if I could just configure Ibid to load my plugin
> from its own package?

I wouldn't say that's any simpler, but I can see how this can be
frustrating :)

Revision history for this message
Dan Poirier (poirier) wrote :

Trust me, it would be simpler.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.