[Twisted-Python] Re: Teach Me Twisted?

Steve Holden steve at holdenweb.com
Wed Jan 23 22:47:26 EST 2008

alex clemesha wrote:
> On Jan 23, 2008 4:36 PM, <glyph at divmod.com <mailto:glyph at divmod.com>> wrote:
>     On 12:10 am, clemesha at gmail.com <mailto:clemesha at gmail.com> wrote:
>      >Thanks Steve Holden for organizing this, it's a great idea.
>     Indeed!
>      >Some nice topics might include:
>     Thanks for the suggestions.  Do you have any others?  :-) 
> For my usage of twisted, these are important to me and I am
> the most familiar with them. (See below)
>     I hate to
>     rain on your parade here, but I think maybe my explanation of why I
>     don't like these suggestions will spark discussion of more different
>     ones...
>      >a) Start off simple with a " twisted.web2" example (everyone "gets"
>      >http)
>     I think that this is actually something we should avoid in a tutorial.
>     The web situation in Twisted is complicated
>     ( http://twistedmatrix.com/trac/wiki/WebDevelopmentWithTwisted).
>      web2 in
>     particular is suffering from an extreme lack of maintenance and still
>     has never "officially" been released; work is just starting to get
>     underway to unify t.web2 and nevow into t.web and reduce the confusion,
>     but this is all still in progress and who knows when, how, or even if it
>     will be completed.  
> Oh yes, I know, I know.  While learning twisted I read *most* (that's 
> alot ;)
> of posts to the twisted-web mailing list.  So I am very familiar with 
> the state.
Interesting. I am also subscribed to the twisted.web newsgroup, and I 
have been surprised about how quiet it's been. I imagine that if 
twisted.web2 would be very good for things like high-volume web services 
work. It has relatively few advantages in the heavily-competitive 
templating world, and I have to say that my early experience with Nevow, 
while it caused me to admire the system, wasn't entirely trouble-free. I 
think that may be partly because it wasn't being used in a Twisted 
environment (I'm thinking of the python.org reorganization that was put 
in effect after PyCon 2006).

> That said, oh how I wish you guys could make twisted.web2 the one and 
> only!!!
> It would be good for beginners and others alike.
> Note however: I can only barely imagine how hard that might be,
> so I am *definitely not* complaining ... Twisted is excellent, thanks 
> very much for it.
Hear, hear. And the world needs to know, hence my enthusiasm for "Teach 
Me Twisted".

>     If you get a group of experienced Twisted folks
>     together to talk about writing web applications, you're more likely to
>     spark a debate than an educational session.
Twisted's not alone there, of course.

>     Even if all these problems were fixed, and there were a really good,
>     well-supported, universally understood web server for Twisted, the
>     benefits of Twisted's programming model are not immediately obvious to
>     the bread and butter of the web programming world.  Learning how to use
>     some combination of Twisted tools to generate a web page will always be
>     at least a little bit harder than writing the sort of glorified CGI
>     script that most web frameworks require these days - unless you're
>     using
>     something like Athena, which might be too much complexity to address in
>     a single tutorial session.  (And while Athena is more polished and "one
>     right way" than the lower-level HTTP stuff, there is still a painful
>     dearth of documentation, not to mention the fact that you need to write
>     JavaScript as well as Python.)
Right. I think a Django replacement might be a bit ambitious for an open 
space session or two ...

Maybe once I get into Twisted I'll be able to lend a hand with t.w2 
development (or maybe not).

> "Comet" (aka what Athena does) is one of my main uses of twisted, see
> http://svn.xantus.org/shortbus/trunk/cometd-twisted/
> is some code that I use. 
> That and other ajax-y stuff.  Not much templating html, etc.
That's neat, but definitely a few too many layers for a starter project.
>     Twisted really shines best when you're writing a client as well as a
>     server.  Chat is the quintessential application where Twisted makes the
>     most sense - and the lack of a well-documented chat server is much less
>     of a problem than the lack of a well-documented web server, since you
>     can easily define a wire protocol and wacky semantics for your purpose-
>     built tutorial chat application.
> Yes!
I'd suggest possibly a client/server game , but I am under the 
impression that's already taken care of.
>      >b) then plug that into a simple sqlite database using
>      >" twisted.enterprise"
>     twisted.enterprise is similarly a scary and inconsistent area, and
>     requires understanding the interaction of the DB thread and the reactor
>     thread.  (And at least part of this section would have to be dedicated
>     to "and never, ever touch anything in this package aside from adbapi".)
We'll definitely stay away from that, then.
> I only ever use 'adbapi'.  The reason I say this is database functionality
> is pretty darn important for all non-trivial programs, so programmers 
> need/want
> to know about this functionality, wouldn't you agree?
Important but not fundamental, I'd say.
>      >d) Show how using "twistd" is really convient
>      >(i.e. "twistd -ny server.tac" and "twistd -y server.tac", with some
>      >logging
>      >capability, etc)
Yes, yes, yes! If I could come away with a clear understanding of how a 
.tac file encapsulated one or more Twisted network services I'd be happy.

>     This, however, is a great suggestion.  Twisted plugins should be
>     part of
>     this discussion. 
> Yes.
> Thanks again for Twisted!
This is great. Keep it coming! Still looking for reading suggestions ...

Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/

More information about the Twisted-Python mailing list