Twisted (software)
Original author(s) | Glyph Lefkowitz |
---|---|
Developer(s) | Community |
Initial release | October 22, 2002[1] |
Stable release | 24.7.0[2]
/ 10 August 2024 |
Repository | |
Written in | Python |
Type | Event-driven networking |
License | MIT License |
Website | www |
Twisted is an event-driven network programming framework written in Python and licensed under the MIT License.
Twisted projects variously support
Core ideas
Separation of protocols and transports
Twisted is designed for complete separation between logical protocols (usually relying on stream-based connection semantics, such as HTTP or
Deferreds
Central to the Twisted application model is the concept of a deferred (elsewhere called a
For example, if a deferred returns a string from a remote peer containing an IP address in quad format, a callback can be attached to translate it into a 32-bit number. Any user of the deferred can now treat it as a deferred returning a 32-bit number. This, and the related ability to define "errbacks" (callbacks which are called as error handlers), allows code to specify in advance what to do when an asynchronous event occurs, without stopping to wait for the event. In non-event-driven systems, for example using threads, the operating system incurs premature and additional overhead organizing threads each time a blocking call is made.
Thread support
Twisted supports an abstraction over raw threads — using a thread as a deferred source. Thus, a deferred is returned immediately, which will receive a value when the thread finishes. Callbacks can be attached which will run in the main thread, thus alleviating the need for complex locking solutions. A prime example of such usage, which comes from Twisted's support libraries, is using this model to call into databases. The database call itself happens on a foreign thread, but the analysis of the result happens in the main thread.
Foreign loop support
Twisted can integrate with foreign event loops, such as those of
Applications using Twisted
This section needs additional citations for verification. (March 2017) |
- The BuildBot continuous-integration system relies on Twisted for client/server communication.[3]
- ITA Software has developed an airline-reservation system for Air Canada that uses Twisted extensively.[4]
- Twisted was used in the Omegle one-on-one chat service[7] until it was replaced with gevent for performance reasons.[8]
- The Apple Calendar Server uses Twisted,[9] as do some internal projects of NASA.
- Conch, an implementation of the Secure Shell(SSH) protocol
- The original version of social networking and microblogging site Jaiku used Twisted.[citation needed]
- AMQP), for its internal services, and for external APIs.
- The file-hosting service Ubuntu One used Twisted.
- Tor Hidden Services (HS), uses Twisted.
- GlobaLeaks, an open-source whistleblowing framework, uses Twisted.
- Cloudkick, a cloud-server management web-application, used Twisted. It now has been rewritten using Node.js.
- Twilio, a cloud telephony provider, uses Twisted.
- Twitch, a video game broadcasting and chat community, uses Twisted.[10]
- Velocity Weather, a meteorological data processing and integration API is built on Twisted.[11]
- qwebirc, a web-based IRC client, uses Twisted.
- Zenoss Core, a network management platform, uses Twisted for many internal and collection daemons.
- Scrapy, a web crawler based on Twisted.
- Listen to Wikipedia, a Wikipedia audio-visualizer, uses Twisted to broadcast real-time edit events to browsers.[12]
- Tahoe-LAFS, a distributed data store and distributed file system.
- Deluge, a highly modular BitTorrent client, uses Twisted.[13]
- Magic Wormhole, a secure file transfer tool using PAKE.[14]
See also
- Application server
- Reactor pattern
- Perl Object Environment, a comparable framework for the Perl programming language
- Netty, for the Java programming language
- Node.js, for Javascript
- EventMachine, an event-processing library for Ruby[15]
- Kivy (framework), a multi-platform GUI framework (including iOS and Android)[16]
References
- ^ Shtull-Trauring, Itamar (2002-10-22). "Twisted 1.0". twisted-python (Mailing list). Retrieved 2008-08-14.
- ^ "Release 24.7.0". 10 August 2024. Retrieved 27 August 2024.
- ^ "BuildBot Manual". github.com. Archived from the original on 2012-07-29. Retrieved 2017-10-28.
- ^ "Python Slithers into Systems". eweek.com.
- ^ SageMath#Features
- ^ Sage a Basic Overview[permanent dead link]
- ^ "mistah deejay". omegler.blogspot.com.
- ^ "Google Groups". groups.google.com.
- ^ "Calendar and Contacts Server". www.calendarserver.org.
- ^ "Twitch - Jobs". Twitch.
- ^ "Velocity Weather -". www.velocityweather.com.
- ^ A WebSocket-oriented monitor for Wikipedia (also, wikimon, wikital monsters), hatnote, 2017-09-03, retrieved 2017-09-21
- ^ "Deluge: build from source". dev.deluge-torrent.org. Retrieved 2020-01-08.
- ^ "Magic Wormhole". github.com.
- ^ "EventMachine". Retrieved 20 August 2011.
- ^ "Integrating with other Frameworks — Kivy 1.11.0.dev0 documentation". kivy.org.