Full Twisted as a Zip for Leopard

For those that aren’t familiar with it, Twisted is a truly amazing python based framework for building internet applications. For those that are familiar with Cocoa, Twisted takes a similar philosophy. You configure a server and/or client project with a few basic parameters — easily changed — like IP address, port or ports, UDP or TCP, and Twisted creates a client or server that does exactly that. It responds to or makes connections and has a standard set of hooks for processing data and dealing with all the random network events that may come up.

In other words, it is like a default Cocoa application. It does all the generic Cocoa application things and it is up to you, the developer, to modify it to do what you need to fulfill your specific ideas.

And, like Cocoa, there are a bunch of add-on toolkits, many included with the stock distribution (but not with Leopard, unfortunately), that add significant features. Whereas Cocoa has tools like CoreData to add persistency and change management, Twisted has tools like — say — Conch which adds a full SSH v2 client/server implementation upon which you can build additional tools.

Twisted really is an amazing technology stack. I have encountered nothing like it in any other language or on any platform.

Via PyObjC, Twisted integrates quite nicely with the Cocoa event loop and, thus, is a perfect choice for building and, even, deploying network heavy Cocoa applications.

Twisted is included in Leopard, but only the core. It is enough to build custom networking protocols and the like, but does not include the various modules that ease writing web apps, AIM clients, SSH v2 tools, or that embrace any number of other protocols.

As such, I built a zip file that contains all of the stuff included with the regular Twisted distribution; conch, cred, enterprise, internet, lore, mail, manhole, names, news, persisted, plugins, protocols, runner, spread, tap, trial, web, and words.

It is 32 bit only, ppc and intel.

You can grab a zip from http://www.friday.com/downloads/twisted.zip.

Now, you don’t have to actually unzip it (though you can — shove it somewhere in /Library/Python/). If you add it to the head of sys.path (or PYTHONPATH) before importing anything from twisted (so you don’t get the core stuff from Leopard):

>>> import sys
>>> import os
>>> sys.path.insert(0, os.path.expanduser("~/lib/twisted.zip"))
>>> from twisted import web # this will fail if you get the path wrong

Works well enough for me. If you need the support binaries, they are tar’d up for download at http://www.friday.com/downloads/twisted-bin.tgz (not encapsulated in a directory — just the binaries).

David Reid has been kind enough to toss together Leopard installer packages.

2 Responses to “Full Twisted as a Zip for Leopard”

  1. Scott Anguish says:

    Bill.. geez, take a second and throw a bit of context in there for those who are less smart than you! 🙂

    Something like

    “Twisted is an event-driven networking engine written in Python and licensed under the MIT license.”

  2. David Reid says:

    There is also a twisted package for leopard available from http://twistedmatrix.com/trac/wiki/Packages#Leopard

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>