Asynchronous and event driven story of Python with Curio
Python versions starting with 3 has added a lot of support for writing concurrent, asynchronous and event driven programs, especially for input-output. At the same time, because the language support on these is still evolving, it also gives rise to confusion. If you ask ‘how do learn to write application containing asynchronous I/O’ there are many paths and beginners might just find it bit overwhelming.
Curio is a asynchronous programming libray conceptualized by David Beazley that counts him as well as Brett Cannon (core contributor) as main contributors. It is a lightweight library which tries to build on top of features available in the language starting version 3.5.
Many new languages/platforms have favoured providing concurrent and asynchronous programming through language level support as libraries than frameworks. (for example: channels in golang, event loop and callbacks in node.js, core.async library in Clojure). Can Curio turn out to be the asynchronous programming story for Python? We can try to evaluate this hypothesis through this session.
Why this session?
Asynchronous and event driven programming is hard. On the other hand simplicity of Python is always been a big asset, the language gets out of your way. Curio aims to help by providing a fast library with simple API and debugging facility. Can Curio make asynchronous programming fun, simple and Pythonic? Let us evaluate!
Secondly, I hope to cover more realistic and interesting programming examples, than say, mapping over a list or just spawning a worker thread to multiply two numbers.
You can hope to learn or takeaway the following
- Quick (very quick) introduction to concurrent programming principles
- Whirlwind tour of current state of Python support for concurrent and event driven programming.
- Philosophy of curio, basic building blocks, how is it different (or similarities)
- Simple code examples
- More involved code examples
- Contrasting the Curio approach with other libraries
- Question-answers and open discussion
- Laptop if you want to try out the examples
- You will need Python 3.5 (note that library Curio will not work for Python 2.* or < 3.5)
- Install Curio as per instructions given here.
Harshad Saykhedkar works as lead data scientist at Sokrati, a digital advertising technology startup. He has 6+ years experience in data science and machine learning and has been programming in Python for last 4 years. He has earlier conducted many workshops on machine learning ecosystem in Python. He holds Master’s degree in Operations Research from Indian Institute of Technology, Mumbai. He also serves as a mentor with springboard, an online data science course company.