Twisted and Debian

Posted 8 Oct 2002 at 12:24 UTC by moshez Share This

Twisted is an LGPLed framework for writing Python network programs. Debian is a portable, comprehensive, stable and free operating system. Since many of the developers on the Twisted team use Debian, Twisted can be easily integrated into your normal Debian life.

This article is also available at the Twisted web site


Twisted is a Python networking framework. It is useful for development of both clients and servers, and strives to support as many externalities as possible -- from network protocols (with over a two dozen RFCs implemented) to GUI toolkits (supporting GTK+, Qt, wxWindows and Tk).


Debian is a free, stable and comprehensive operating system, based on GNU software and the Linux kernel. Debian supports eleven hardware archtecture and over 6000 programs. Debian, as a free, community-supported, operating system, has been used as a base for many other operating systems, including Lindows and Knoppix.

Using Twisted on a Debian System

The latest stable release of Debian, woody, comes with Twisted 0.15.5 built in. New versions of Twisted, which are tested on both stable and unstable, are always available from "deb". So, even those using stable Debian can use the latest Twisted releases, including the upcoming 1.0, without the overhead of adding unstable sources to their sources.list, dealing with apt-pinning or building the sources themselves.

Of course, users of Debian unstable can get the releases directly from Debian -- the released packages, already having been tested on the main Twisted Debian machine, are usually uploaded to Debian unstable within hours of the official release.

Twisted supports, as fully as possible, the Python versions available in Debian -- currently, 2.1, 2.2 and pre-releases of 2.3. For those needing just a version of Twisted which works with the Debian default Python version, "python-twisted" is available. For low-impact on production servers, the documentation of Twisted (over half a megabyte) is packaged seperately. Twisted uses the Recommends: and Suggests: fields, to allow the Debian packaging tools to supply the information about which packages can be used to maximise the potential of Twisted.

For those on the bleeding edge, or people who want to make sure their applications work flawlessly for the next version of Twisted, all release candidates are available from the apt source "deb". These are the release candidates the Twisted team uses itself to prepare for the next release -- but third party developers interested in assuring compatibility are also welcome to use them.

Using Twisted's Debian Integration

For Twisted-based server application developers who want to deploy on Debian, Twisted supplies the tap2deb program. This program wraps a tap file (Twisted Application Pickle, a Twisted configuration) in a Debian archive, including correct installation and removal scripts and <code>init.d</code> scripts. For the more savvy Debian users, the

tap2deb also generates the source package, allowing her to modify and polish things which automated software cannot detect (such as dependencies or relationships to virtual packages). In addition, the Twisted team itself intends to produce Debian packages for some common services, such as web servers and an inetd replacement. Those packages will enjoy the best of all worlds -- both the consistency which comes from being based on the tap2deb and the delicate manual tweaking of a Debian maintainer, insuring perfect integration with Debian.

This things will insure you can run a fully functional Debian system which relies on Twisted for many of its core, and security sensitive, portions -- thus, eliminating many of the classical security holes (such as buffer overlows, uninitialized memory access and stack smashing), allowing you to sleep better at night.

tap2deb is the best, posted 8 Oct 2002 at 18:16 UTC by itamar » (Master)

I really like tap2deb - it lets me have servers that start on the right runlevel, shutdown on the right runlevel, log to the correct place, and are managed by dpkg, all without worry about creating Debian packages, daemonization, or any of the usual stuff you'd need to know when building a server for Debian (or any Unix).

So to use my banner ad server that was implemented with Twisted, just generate a config file for the server, run tap2deb, install the .deb and the server is deployed:

  $ mktap --uid=33 --gid=33 bannerfish --port 9080 /var/lib/bannerfish
  $ tap2deb bannerfish.tap
  $ dpkg -i .build/bannerfish*.deb

and you now have a running from /etc/init.d fully configured banner ad server on port 9080.

tap2deb is nice, indeed, posted 8 Oct 2002 at 18:21 UTC by moshez » (Master)

But just so people will have the correct command line, itamar probably used

$ tap2deb -t bannerfish.tap -m 'Itamar Shtull-Trauring <>' -u

As one would expect with a Debianized utility, when one installs the Twisted packages, full man pages are provided covering every option.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

Share this page