Mar 2019
25 Mon
26 Tue
27 Wed
28 Thu
29 Fri
30 Sat 09:00 AM – 09:50 AM IST
31 Sun 09:00 AM – 09:50 AM IST
Jaysinh shukla
Twisted is a framework for writing event-driven applications in Python. Event-driven is a well-recommended programming paradigm for writing high performance networking applications, GUI applications or device drivers. The framework is more than a decade old and has a large community base. I am proposing an entry-level workshop to share my expertise with the community.
Duration: 180 minutes excluding breaks and question answers.
Description
Introduction
I will explain the gist of event-driven programming paradigm. I will do a small comparison of this with the existing paradigm. Event-loops are the core of event-driven programming. I will explain how the loop communicates for scheduling tasks.
Installation
Twisted is largely platform independent, but also includes platform-specific functionalities. Installation of Twisted is as simple as installing any Python package.
Components of the Framework:
Reactor
The reactor is an event-loop which drives the application.
Callbacks
Callbacks are a fundamental part of event-driven programming and are the way that the reactor indicates to an application that an event has arrived. There is two type of callbacks. One is when the event has succeeded and the other is when the event has failed. It is quite common to tangle the logic between success and failure callbacks. Twisted provides a great solution to write these callbacks by giving deferred interfaces.
Transport
Transport is a collection of various transport classes. It provides an API to transfer bytes to another end of the socket.
Protocol
The protocol describes how to react to events. Protocol factory is responsible for producing an instance of the protocol. All the configuration information are preserved in a protocol factories.
Testing
Testing Twisted code is tricky. I will demonstrate mocking response objects and show how to avoid polluting an event loop. I will be focusing on utilities of “twisted.trial” module.
Deployment guidelines
Deploying a Twisted-based application is like deploying any other Python application. I will point out various ways to deploy and maintain a Twisted-based application.
Seeking help from the community
I will conclude this workshop by sharing resources to get involved with the community and continue to learn.
A laptop with Python 3 and a will to learn :)
A full-stack developer by profession, a computer scientist by heart and an actor by a gene. One of the core organizer of PyKutch 2016.
{{ gettext('Login to leave a comment') }}
{{ gettext('Post a comment…') }}{{ errorMsg }}
{{ gettext('No comments posted yet') }}