[Twisted-Python] Twisted Plugins - Implementation Discussion

Itamar Turner-Trauring itamar at itamarst.org
Thu Apr 7 06:14:05 MDT 2011


On Thu, 2011-04-07 at 02:08 -0400, Glyph Lefkowitz wrote:

> My idea for exposing it is that if you then do 'getPlugins(IPlugin2)',
> you will get back an iterable of IPlugin2 providers, but not
> necessarily instances of your classes: they could be cached plugins,
> with cached results for metadata() and willProvide() - the latter
> based on the list currently saved as the 'provided' attribute.  So a
> loop like this to load a twistd plugin by name:
> 
> 
>         def twistdPluginByTapname(name):
>             for p2 in getPlugins(IPlugin2):
>                 if p2.willProvide(IServiceMaker) and
>         p2.metadata()['tapname'] == name:
>                     return p2.load()
> 
> 
> ... would not actually load any plugins, but work entirely from the
> cached metadata.

That's where the whole idea falls down for me. Evidence suggests (and
you note this earlier) that caching doesn't work anywhere in the real
world. My current Ubuntu install complains about a read-only cache every
time I run lore (and I'm pretty sure there's nothing added to my
PYTHONPATH other than installed system packages). Any design which
assumes caching works appears to be useless in the real world.

So, the design has to *not* rely on caching working.






More information about the Twisted-Python mailing list