Tech News
← Back to articles

The "impossibly small" Microdot web framework

read original related products more articles

The "impossibly small" Microdot web framework

Benefits for LWN subscribers The primary benefit from subscribing to LWN is helping to keep us publishing, but, beyond that, subscribers get immediate access to all site content and access to a number of extra site features. Please sign up today!

The Microdot web framework is quite small, as its name would imply; it supports both standard CPython and MicroPython, so it can be used on systems ranging from internet-of-things (IoT) devices all the way up to large, cloudy servers. It was developed by Miguel Grinberg, who gave a presentation about it at EuroPython 2025. His name may sound familiar from his well-known Flask Mega-Tutorial, which has introduced many to the Flask lightweight Python-based web framework. It should come as no surprise, then, that Microdot is inspired by its rather larger cousin, so Flask enthusiasts will find much to like in Microdot—and will come up to speed quickly should their needs turn toward smaller systems.

We have looked at various pieces of this software stack along the way: Microdot itself in January 2024, MicroPython in 2023, and Flask as part of a look at Python microframeworks in 2019.

Grinberg began his talk with an introduction. He has been living in Ireland for a few years and " I make stuff ". That includes open-source projects, blog posts (on a Flask-based blog platform that he wrote), and " a bunch of books ". He works for Elastic and is one of the maintainers of the Elasticsearch Python client, " so maybe you have used some of the things that I made for money ".

Why?

With a chuckle, he asked: " Why do we need another web framework? We have so many already. " The story starts with a move that he made to Ireland from the US in 2018; he rented a house with a "smart" heating controller and was excited to use it. There were two thermostats, one for each level of the house, and he was " really looking forward to the winter " to see the system in action.

As might be guessed, he could set target temperatures in each thermostat; they would communicate with the controller that would turn the heating on and off as needed. In addition, the system had a web server that could be used to query various parameters or to start and stop the heaters. You could even send commands via SMS text messages; " there's a SIM card somewhere in that box [...] very exciting stuff ".

When winter rolled around, it did not work that well, however; sometimes the house was too chilly or warm and he had to start and stop the heaters himself. He did some debugging and found that the thermostats were reporting temperatures that were off by ±3°C, " which is too much for trying to keep the house at 20° ". The owner of the house thought that he was too used to the US where things just work; " at least she thinks that in America everything is super-efficient, everything works, and she thought 'this is the way things work in Ireland' ". So he did not make any progress with the owner.

At that point, most people would probably just give up and live with the problem; " I hacked my heating controller instead ". He set the temperatures in both thermostats to zero, which effectively disabled their ability to affect the heaters at all, and built two small boards running MicroPython, each connected to a temperature and humidity sensor device. He wrote code that would check the temperature every five minutes and send the appropriate commands to start or stop the heaters based on what it found.

... continue reading