[Twisted-Python] Components

Phillip J. Eby pje at telecommunity.com
Fri Feb 27 09:26:56 EST 2004

At 12:24 AM 2/27/04 -0500, Glyph Lefkowitz wrote:

>Looking at PyProtocols, it doesn't seem to me to have taken simulations
>or gaming into account as a use-case.  An indication of this is the
>seperability of the full component model from the interface / adapters
>system.  Without a full understanding of the execution context of an
>adapter, I don't know how I could integrate external adapters like TTW
>login or email delivery into a simulation.  (Pardon me for not being
>terribly specific here.  It's difficult for me to come up with examples
>that take less than 5 or 6 pages of dull prose to explain.)

There was a recent discussion of writing an interactive fiction game using 
PyProtocols on the PEAK mailing list; the thread started here:


Mostly, I told the guy what sort of component model sounded like it would 
work for what he was trying to do, and how to do that sort of component 
model with PyProtocols.

To pull out your statement about execution context, though, I should 
mention that in PEAK, some adapters are "contextful" and others are 
not.  The PEAK component model has the simple concept of things having 
parent components.  Adapters that want to know about context make sure to 
set their parent to the thing they're adapting, or perhaps its 
parent.  Whenever you put a component in another component, the container 
adapts the containee to binding.IAttachable if possible, and tells it, 
"hey, I might be your parent", so the containee can know its 
context.  That's really about it for context.  The binding and config 
packages then offers lots of useful APIs to walk up the parent tree to find 
or do things.

>However, I am not sure, because I can't figure out what PEAK as a whole
>is really for.  The likely source of an explanation,
>seems awfully vague.  What is the problem that PEAK was designed to
>solve, exactly?  Clearly it was difficult, because there was a lot of
>solution :)

What is Twisted as a whole really for?  ;)  At least PEAK's name says 
exactly what it is: Python Enterprise Application Kit.  It's a kit for 
writing enterprise applications in Python.  Specifically, configurable, 
component-based applications.  The PEAK core (aka peak.core) frameworks are 
a component architecture for building task-specific frameworks.  The rest 
of PEAK is either task-specific frameworks (storage, events, net, commands, 
etc.), utility modules, or development/deployment tools (supervisor, 
version, n2, etc.)

More information about the Twisted-Python mailing list