Plurrrr

Thu 09 Feb 2023

13 tips and techniques for modern Flask apps

Flask is approaching its 13th birthday in active development, with new features that make it easier for you to build your web application continually being added. Thirteen years ago the industry and Flask focused on server rendered pages, now there is a strong focus on JSON APIs. Flask has kept up with this change by adding features that make API development easier.

In this article I've picked out 13 tips, for the 13 years of development, that make modern Flask ideal.

Source: 13 tips and techniques for modern Flask apps, an article by Philip Jones.

Shells are Two Things

The fundamental problem of shells is they are required to be two things.

  1. A high-frequency REPL, which requires terseness, short command names, little to no syntax, implicit rather than explicit, so as to minimize the duration of REPL cycles.
  2. A programming language, which requires readable and maintainable syntax, static types, modules, visibility, declarations, explicit configuration rather than implicit conventions.

And you can’t do both. You can’t be explicit and implicit, you can’t be terse and readable, you can’t be flexible and robust.

Source: Shells are Two Things, an article by Fernando Borretti.

Profile-guided optimization preview

With no definitive information about how the code is used in a production environment, the compiler can operate only on the source code of packages. But we do have a tool to evaluate production behavior: profiling. If we provide a profile to the compiler, it can make more informed decisions: more aggressively optimizing the most frequently used functions, or more accurately selecting common cases.

Using profiles of application behavior for compiler optimization is known as Profile-Guided Optimization (PGO) (also known as Feedback-Directed Optimization (FDO)).

Source: Profile-guided optimization preview, an article by Michael Pratt.