My talks About Software Development

Speeding up Flask & Quart’s routing

The routing algorithm used by Flask & Quart to match requests to the relevant handler has recently been changed from using a regex table to using a state machine. This has improved the performance, with a 5 times improvement being seen in the best case.

This talk will explain what routing is, how the algorithms work, and what it means for Flask and Quart.

Watch →
Read Slides →

What's new in Flask 2.0

Flask 2.0 introduces async/await support, short form @app.post decorators, nested blueprints and more!

This is a lightning talk.

Watch →
Read Slides →

Flask 2.0

I joined the Talk Python podcast with David Lord to talk about Flask 2.0.

Listen →

Why isn't Flask async?

The introduction of async/await and asyncio has lead to an explosion of new web frameworks bringing many new ideas. Yet the enduring WSGI frameworks have been slow, and often unable, to adopt these new features - particularly the two most popular frameworks, Django and Flask.

With the recent Django 3.0 supporting async/await, the focus is switching to Flask - why isn't Flask async?

This talk will discuss the approaches taken in the past to support async/await in Flask, where they struggled, and the challenges in general. It will then show how inspiration has been taken from Django to introduce support in the upcoming Flask-2.0 release.

Watch →
Read Slides →

An ASGI Server from scratch

I intend for this to be a fairly advanced talk that shows the steps required to go from a TCP echo server to a basic HTTP/1 ASGI server using asyncio for the IO. This is aimed at people who've read about asyncio, coroutines, etc and want to see them used in practice.

This is a tutorial on how to build a HTTP/1 ASGI server using asyncio. I plan to start by building a TCP echo server and then add HTTP parsing and ASGI compliance.

Watch →
Read Slides →

Async Flask, an introduction to Quart

Quart is the Flask API re-implemented in async/await. This talk will introduce Quart and explain how it relates to Flask. Then I'll talk about potential async support in Flask and discuss the future relationship between the Quart and Flask.

Watch →
Read Slides →

Web development with Trio

The introduction of asyncio to the Python stdlib led to a flurry of new web frameworks. Lesser known though are the async/await based event loop alternatives to asyncio, curio, and trio. Yet the development of asyncio has been and continues to be, heavily influenced by these two projects.

This talk will introduce Trio and motivate why I think it is a great choice for web development. I'll talk about the advantages trio brings and the ecosystem available to developers. As a practical example I'll show my own site (frontend React + backend Quart-Trio).

Read Slides →

An introduction to ASGI, Asynchronous Server Gateway Interface

WSGI has been a huge success, allowing for an ecosystem of servers and frameworks to exist and develop independently, however, WSGI is unable to support websockets or the new async/await syntax. ASGI is the asynchronous spiritual successor to WSGI, with websockets and async support built in.

Watch →
Read Slides →

Async web servers; design and implementation

In this talk I'll describe an idealised process I've gone through developing Hypercorn. I'll define the aims of a modern async web server, overview the tooling used to be async, and finally the constraints imposed by the event loop choice.

Read Slides →

Quart; an ASGI alternative to Flask

Flask is a great web micro-framework, that is best utilised with event-loop concurrency. Sadly with Flask the event-loop framework can’t be asyncio, although some extensions (Flask-Aiohttp) have tried. Quart is the solution as it shares the Flask API and is based on asyncio. In addition Quart goes beyond Flask adding HTTP/2 and websockets.

This talk will outline why ASGI is a good asynchronous version of WSGI, and then give an overview of Quart, demonstrating features that go beyond the Flask framework.

Watch →
Read Slides →

Quart: Flask, but 3x faster

I joined the Talk Python podcast to talk about Quart.

Listen →

Quart; a asyncio alternative to Flask

Flask is a great web mirco-framework, that is best utilised with event-loop concurrency. Sadly with Flask the event-loop framework can’t be asyncio, although some extensions (Flask-Aiohttp) have tried. Quart is the solution as it shares the Flask API and is based on asyncio. In addition Quart goes beyond Flask adding HTTP/2 and websockets.

This talk will outline why event-loop concurrency is a good choice for web servers, why asyncio is a good choice and then give an overview of Quart, demonstrating features that go beyond the Flask framework.

Watch →
Read Slides →

Building Quart from Flask and Asyncio

The Python world is moving towards asyncio web (micro) frameworks, with Sanic and Aiohttp leading the way. Sadly the best (IMO) micro framework, Flask, is incompatible with asyncio. The Quart framework aims to solve this by reimplementing the Flask API using asyncio.

I intend to talk about the lessons and difficulties encountered with Flask, Asyncio and the combination. Detailing the difficulties calling coroutines from synchronous functions, and the eventual workaround, how the crux of Flask, global thread locals, have equivalents and how they work, finishing with a discussion about how Python monkey patching allows for some of the Flask extensions to work.

Watch →
Read Slides →