skillfed

Twisted

An asynchronous networking framework written in Python

twisted v26.4.0 16.0M downloads/30d#1,164 on PyPI5,975
Permissive license MIT License Active released

What it is and what it does

Twisted is a mature, event-driven framework for building asynchronous networked applications in Python. It abstracts away platform-specific event loops (select, poll, epoll, kqueue, IOCP) and provides a unified reactor interface, letting you write code that runs efficiently across different systems. The framework includes protocol implementations for HTTP, SSH, Telnet, DNS, SMTP, IMAP, POP3, IRC, and XMPP, along with tools for GPS communication and unit testing.

You use Twisted by defining protocol classes that handle network events (data received, connection made, connection lost) and registering them with the reactor, which then dispatches I/O events to your handlers. It's designed for long-lived server applications that need to handle many concurrent connections without blocking, and it integrates with GUI event loops for applications that need both networking and UI responsiveness.

Use it for:

  • Build HTTP servers and clients with twisted.web, including WSGI integration and HTML templating.
  • Implement SSH or Telnet servers and clients using twisted.conch for secure remote access.
  • Create IRC, XMPP, or other instant-messaging servers and clients with twisted.words.
  • Run SMTP, IMAP, or POP3 mail servers and clients with twisted.mail.
  • Test asynchronous code using twisted.trial, a unit testing framework designed for Twisted applications.
  • Build DNS servers and clients or integrate with GPS receivers using twisted.names and twisted.positioning.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Twisted is an event-driven networking framework that provides asynchronous I/O and protocol implementations for building internet applications in Python, including HTTP, SSH, DNS, SMTP, IMAP, IRC, and XMPP servers and clients.

Yes. Twisted is a well-established, actively maintained framework with no known vulnerabilities, low install friction, and permissive licensing. It is the right choice if you need to build event-driven networked applications, especially those requiring protocol implementations beyond basic TCP/UDP or integration with multiple event loops. For simple HTTP-only use cases, lighter alternatives may be preferable.

Install

twisted on PyPI

pip

pip install twisted

uv

uv add twisted

poetry

poetry add twisted

Installing Twisted

Before you install

Low install friction with a pure-wheel distribution and seven straightforward runtime dependencies. The project is actively maintained with recent releases and 5975 repository stars, indicating stable ongoing development.

License in practice

MIT License permits commercial and private use with minimal restrictions; you may use, modify, and distribute Twisted freely as long as you include the license notice.

Quickstart

pip install twisted

from twisted.internet import reactor
from twisted.internet.protocol import Protocol, Factory

class EchoProtocol(Protocol):
    def dataReceived(self, data):
        self.transport.write(data)

factory = Factory()
factory.protocol = EchoProtocol
reactor.listenTCP(port, factory)
reactor.run()

Requires Python 3.9.12 or later; some subsystems (SSH, DNS, mail) may need additional optional dependencies not included in the base install.

Verify before relying

  • Whether the 7 listed runtime dependencies are sufficient for all major subsystems or if optional dependencies are commonly needed for typical use cases.
  • Performance characteristics and scalability limits for high-concurrency scenarios compared to other async frameworks.
  • Specific port numbers or configuration examples for common protocol servers.

Package facts

License MIT License (permissive)
Python support supports the current Python release (>=3.9.12)
Install friction low — pure-Python wheel
Runtime dependencies 7 — attrs, automat, constantly, hyperlink, incremental, typing-extensions, zope-interface
Maintenance actively maintained — 95 days since the last release
Last repo commit
First released
Downloads 16,041,245/month — #1,164 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: twisted-26.4.0-py3-none-any.whl

Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9

Tags

async networking framework pythonevent-driven server frameworktwisted web serverasynchronous protocol implementationpython internet applicationsreactor-based networkingtwisted ssh telnet server
async-networkingevent-drivenprotocol-implementation

More Application Frameworks packages