Amundsen's Maxim in practice
Amunden's Maxim, is a great guide to building applications. In this article I'll show how it can be applied in practice.
Blog posts from PGJones
Amunden's Maxim, is a great guide to building applications. In this article I'll show how it can be applied in practice.
I like to use zod and react-hook-form to validate and manage my frontend forms. These require careful typing to work correctly, as this article explains.
Asyncio's TaskGroup makes it much easier to write concurrent code and hence have faster routes. This article will show how using Quart and Quart-DB examples.
Flask has a great ecosystem of extensions. Many of which can be broken when we make changes to Flask. I argue that users can expect stability, but that does not imply no breaking changes.
The current OWASP guidance (early 2023) is to use Argon2id for password hashing. This has required me to change from bcrypt, which is now considered legacy. This is how I upgraded.
PyPI have recently introduced a method to publish to PyPI via a github action without the need for manual tokens or username and passwords. In this post I show how I've set this up for the projects I maintain.
With Flask approaching 13 years old I thought it would be helpful to compile 13 tips and techniques to get the most out of Modern Flask.
The existing HTTP router used by Flask and Quart will soon be significantly faster thanks to improvements in the upcoming Werkzeug 2.2. These improvements switch the router algorithm from a regex table to state machine without any loss in functionality.
Quart 0.17.0 and Flask 2.1.0 both introduce a new method to load configuration values directly from the environment. The method, Config.from_prefixed_env will load all variables starting with a given prefix as explained in this article.
I'm often asked to compare Flask/Quart with FastAPI, usually in terms of the support of Pydantic based data validation and OpenAPI schema generation. I find this direct comparison unfair, and instead I compare Flask-Pydantic-Spec/Quart-Schema with FastAPI and Flask/Quart with Starlette.
Clients that half close the socket (shutdown the write part) are responded to by Hypercorn, as explained.
How to use Sentry with Quart, focusing on the integration to use to capture errors and trace performance.
How to use Postgres with Quart, focusing on the libraries to use and setup to make type conversions and things generally easy.
How to use Hypothesis, and Quart-Schema, to automatically test your API.
A guide to writing ASGI middleware via an example domain based dispatcher.
I've been writing JSON-REST APIs for a number of years, all the time wanting to have tooling that validates the JSON sent and received and automatically generates documentation. I finally have this with Quart-Schema, and this article explains how I got there.
I've rewritten the frontend of this website using Svelte + Sapper and it works great. I think Svelte + Sapper is the best of the modern web frameworks for my needs.
The first release of Quart, 0.1.0, was three years ago today. This a brief review and an attempt to produce a roadmap towards version 1.0.
I've recently started packaging without setup.py by using poetry and pyproject.toml. This explains why and how I have done so.
Type hints in Python 3 are executed at import time at a computational cost. This cost can removed in Python >= 3.7 via from __future__ import annotations, see PEP-563. The startup time when importing quart is measured both with and without the future import with no difference observed.
Hypercorn 0.8.0 introduced support for HTTP/2 prioritisation the verification of which is demonstrated via a simple webpage.
I've proposed a change to Flask to support async(io) view functions following on from a recent change to Quart to support (non-blocking) sync view functions. This article explains this approach and why Flask and Quart are necessarily complimentrary projets.
This is an overview of how this site performs when served over HTTP/3.
RSS is very useful feature that was missing from this blog, so I've added it. This explains why I've added it and how.
Serving HTTP/1, HTTP/2, and HTTP/3 in Python has never been easier, as Hypercorn can serve all three. This article will show how to use Hypercorn and how Hypercorn uses three great Sans-IO libraries to work.
Modern Single Page Apps have a increasingly common architecture whereby the frontend is served on a different domain to the backend necessitating the use of CORS. This article shows how to make CORS work in this architecture.
This is a commentrary on my usage of, and experience with, push promises and how I've added support in Quart.