[Twisted-Python] Components

Donovan Preston dp at twistedmatrix.com
Thu Feb 26 15:42:50 EST 2004

On Feb 26, 2004, at 3:17 PM, James Y Knight wrote:

> On Feb 26, 2004, at 2:43 PM, Bob Ippolito wrote:
>> How about just migrating off of t.p.components and switching to 
>> PyProtocols?  The license is compatible, it has PEP-backing, it is a 
>> superset of what t.p.components does, has optional Pyrex 
>> acceleration, and is compatible with Interfaces from itself, 
>> t.p.components, and zope.components.  The default Interface 
>> implementation does not support the __call__ adaptation that we all 
>> know and love, but it is actually generic enough to allow it.
>> As a side note, PEAK's peak.util.imports.whenImported hooks, 
>> importString, and lazyModule might also be pretty useful to Twisted 
>> (among so many other things).
> And, while PyProtocols doesn't seem to support any sort of lazy 
> adapter registration, it would probably be doable via a framework 
> built on top of whenImported.

Switching Nevow to PyProtocols would have been my first choice. Since I 
didn't have the time to learn it, and didn't feel like introducing the 
additional dependency at the time, I hacked t.p.c into nevow.compy so 
that I could prevent t.p.c's "import the world" behavior which was 
detrimental to nevow. Unfortunately this means you have to now use 
*two* "global" component registries when you use Nevow.

I am +1000 with using PyProtocols for Nevow since it would reduce my 
headaches. I think that a global component registry is the one central 
important feature of a components system, making the current situation 
less than ideal. twisted.python.components wasn't flexible enough to do 
what I needed to do in Nevow but PyProtocols is, and supports more 
useful things like protocolForURI which will be necessary once people 
start designing interfaces that are useful outside of just one project.

I am less excited about introducing a dependency into Nevow. It would 
be nice if we could distribute PyProtocols in the same tarball as Nevow 
and only install it if needed.


More information about the Twisted-Python mailing list