[Twisted-Python] Plugins in files with hyphenated names found in 2.5.0 but not in 8.1.0

glyph at divmod.com glyph at divmod.com
Tue Jan 20 14:25:59 EST 2009

On 12:53 pm, mithrandi at mithrandi.net wrote:
>* Terry Jones <terry at jon.es> [2009-01-20 12:23:26 +0100]:

>The exact change, I believe, is that plugin source files have to be
>valid python modules; that is to say, you have to be able to do:
>import foo.plugins.some_plugin

This was always the intent.  The change from 2.5 to 8.0 was essentially 
a bugfix; although not an entirely intentional one.  I'm actually 
surprised that dashes in plugin filenames ever worked.  I suspect things 
defined in "some-plugin.py" would have bogus __module__ attributes under 
2.5, and interact oddly with some introspection tools.
>>I guess this restriction on plugin-containing filenames should either 
>>documented, or the code should be made to work as it did. I'm happy to 
>>a ticket - though the text of the ticket would depend on which 
>>solution is
>I believe this change was deliberate, so I expect it won't be reverted,
>but perhaps someone else can comment further on the design motivations
>(and confirm that my explanation is correct).

It definitely won't be reverted :).  I don't think it should be 
documented in terms of a filename restriction, either.

In my opinion, the best way to deal with this would be to really improve 
the plugin documentation to make it clear that plugins are not magical 
.py files executed in a weird context, but modules which are imported 
normally and then have their contents inspected.  I've tried writing 
this up a few times, but the difficulty is that there just isn't much to 
write: the full impact of "this is just a module" is hard to 

More information about the Twisted-Python mailing list