https://blog.miguelgrinberg.com/post/a-year-in-review-flask-in-2024 miguelgrinberg.com * Home * My Courses and Books * Consulting * About Me * + Light Mode + Dark Mode + ------------------------------------------------------------- + System Default * GitHub LinkedIn Bluesky Mastodon Twitter YouTube Patreon RSS Feed A Year In Review: Flask in 2024 Posted by [Miguel Grinberg] on 2025-01-02T15:02:54Z under [Flask] I'm seeing a stream of "year in review" blog posts about all sorts of topics pop up to coincide with the start of 2025. I'm not sure if this is going to be a new tradition for me, but to follow this trend in this article I'm going to give you my review of the most interesting things that happened in the Flask ecosystem in 2024. First, a disclaimer Before I begin I want to make it clear that this is an independent review. I'm not affiliated with the Flask development team and even though I love Flask I sometimes have critical views. In this post I'll go over the highlights and give you my opinions about them, be them good, bad or ugly. My experience with the Flask framework comes from being a user since its early 0.x days and from having written books and blog articles about it, begin the maintainer of a few extensions and helping people improve their applications through my consulting work. I have also contributed a handful of improvements to both Flask and Werkzeug. The blog on which you are reading this article is actually a Flask application. Project activity The Flask project put out four releases during 2024, three patch releases and new minor release. No major releases came out during the year. Here is the list of releases in chronological order: * 3.0.1 * 3.0.2 * 3.0.3 * 3.1.0 One interesting metric is to see how many pull requests were merged during 2024 and compare the number against previous years: 2020 2021 2022 2023 2024 Flask 178 120 178 134 58 Werkzeug 162 175 92 133 73 Total 340 295 270 267 131 This clearly indicates that the pace of development has slowed down in 2024, which I consider normal and expected for a mature framework. What's new with Flask As you've seen in the previous section, in 2024 there were no new major releases of Flask, so it was a relatively quiet year. However, release 3.1.0 (the only minor release of the year) brought a couple of interesting new features that are worth mentioning: Partitioned cookies Partitioned cookies (also known as CHIPS, or Cookies Having Independent Partitioned State) are a new type of third-party cookie that can be used for legitimate use cases that aren't related to tracking user activity across multiple sites. These are enabled through the new partitioned argument to the set_cookie() method. The session cookie can be set to partitioned with the SESSION_COOKIE_PARTITIONED configuration option. Secret key rotation A new configuration option called SECRET_KEY_FALLBACKS can be set to a list of retired secret keys. Flask will use these old secret keys for decoding user sessions that were generated before the secret key was rotated. Backwards compatibility I have strong feelings about backwards compatibility. In October 2023 I have complained publicly about how all the Flask releases that were coming out at the time introduced breaking changes, often with very short or no deprecation notices. I'm happy to report that the stream of constant deprecations and breaking changes has stopped. I'm sure the low number of new releases in 2024 contributed to this, but the discussions that followed my complaining may have had some influence too. In any case, from a quick scan of the change logs I have not detected any new deprecations or breaking changes introduced in all of 2024. Looking ahead From looking at the Flask and Werkzeug projects on GitHub I expect 2025 will also be a relatively quiet year. The only change of importance that I could find is the intention to combine the application and request contexts into one. David Lord (lead maintainer of Flask) explains his thinking in the issue, indicating that the code that supports the two contexts is hard to maintain and he wants to reduce its complexity. What I did not see is a reference to the fact that this would be a reversal more than an original change, since Flask used to have a single context (called the "request context") until release 0.9, when Armin Ronacher, still in charge of the project in those days, found it necessary to add the "app context" to make it possible to support certain operations such as URL generation when there was no active request context. David also mentions in the issue that explaining the app and request contexts to newcomers is challenging (I agree) and that he hopes that with a unified context it will get easier. I don't believe a single context will be much easier to explain than two. The problem is not how many contexts there are, in my opinion, but instead that the way contexts work feels magical due to their use of context variables, which are somewhat esoteric and not very well known. I would actually be more excited if he had the intention to remove contexts altogether, even though this would be an even bigger change. Combining the two contexts is likely going to be a breaking change, so I'm also worried about what this change will do to backwards compatibility. He mentions that he plans to deprecate the dual contexts but keep them around possibly until Flask 4.0 comes out, which in principle sounds good, but there is really no way to know if 4.0 is going to come out soon or in a long time. If 4.0 is released immediately and mainly to get this change out, then there is going to be a lot of pressure on extension developers to update their extensions, as any extensions that aren't updated will prevent users from migrating to the new Flask release. I would prefer the deprecation period to be expressed in time instead of in versions, as that would give me a more clear idea of how much time I will have to update my extensions once this change is out. If he were to say that he plans the transition period in which both solutions are going to be supported to last a year then I can plan my updates and meet the deadline with confidence. Maybe I'm asking too much. I honestly wonder if it is really a change worth making, considering that in my opinion most Flask developers aren't going to care other than because a significant number of extensions are going to start polluting logs with deprecation notices. I hope I'm wrong, but I feel this has the potential to put us in another hell of ecosystem incompatibilities of the kind Flask is infamous for. We'll have to see how this plays out. I'm sure there will be more to say about this in the following months. Flask vs. the competition To end this overview, let's have a look at how popular Flask is compared to Django and FastAPI, which are its main competitors. The following table shows the number of downloads from PyPI in 2023 and 2024 for the three packages: 2023 2024 Flask 1001M (73%) 1160M (58%) Django 135M (10%) 225M (11%) FastAPI 228M (17%) 612M (31%) From this it is very clear that while Flask may still be the leader (or more accurately, the most downloaded), FastAPI is coming after it with a lot of momentum. I'm surprised that the Django download counts are so low and do not have a good explanation for that. For full transparency, below you can see the queries that I've used to get these download counts from the PyPI BigQuery dataset (if you double check my results and spot a mistake in my queries please let me know and I'll update my table): # flask 2023 SELECT COUNT(*) FROM `bigquery-public-data.pypi.file_downloads` WHERE TIMESTAMP_TRUNC(timestamp, DAY) BETWEEN TIMESTAMP("2023-01-01") AND TIMESTAMP("2024-01-01") AND file.project = "flask" # django 2023 SELECT COUNT(*) FROM `bigquery-public-data.pypi.file_downloads` WHERE TIMESTAMP_TRUNC(timestamp, DAY) BETWEEN TIMESTAMP("2023-01-01") AND TIMESTAMP("2024-01-01") AND file.project = "django" # fastapi 2023 SELECT COUNT(*) FROM `bigquery-public-data.pypi.file_downloads` WHERE TIMESTAMP_TRUNC(timestamp, DAY) BETWEEN TIMESTAMP("2023-01-01") AND TIMESTAMP("2024-01-01") AND file.project = "fastapi" # flask 2024 SELECT COUNT(*) FROM `bigquery-public-data.pypi.file_downloads` WHERE TIMESTAMP_TRUNC(timestamp, DAY) BETWEEN TIMESTAMP("2024-01-01") AND TIMESTAMP("2025-01-01") AND file.project = "flask" # django 2024 SELECT COUNT(*) FROM `bigquery-public-data.pypi.file_downloads` WHERE TIMESTAMP_TRUNC(timestamp, DAY) BETWEEN TIMESTAMP("2024-01-01") AND TIMESTAMP("2025-01-01") AND file.project = "django" # fastapi 2024 SELECT COUNT(*) FROM `bigquery-public-data.pypi.file_downloads` WHERE TIMESTAMP_TRUNC(timestamp, DAY) BETWEEN TIMESTAMP("2024-01-01") AND TIMESTAMP("2025-01-01") AND file.project = "fastapi" To have a different view into framework preferences, I've also looked at the latest Python Developer Survey, which collects responses given between November 2023 and February 2024. Here is the user share of these three web frameworks according to this survey: Flask vs. Django vs. FastAPI survey results The percentages in this chart do not add up to 100% because users were allowed to select multiple frameworks from a long list of options. Note that in the screenshot above I have not included the other frameworks that were part of this survey, so be sure to review the survey directly if you want to see the complete list. Looking at this chart we can conclude that the three frameworks have roughly a third of the market each, as other frameworks included in the survey have all much smaller percentages. The distribution in the previous year's survey was Flask 39%, Django 39% and FastAPI 25%, another indication that FastAPI is growing. Enjoy Flask in 2025! Let me know if you find this type of yearly summary useful and if there are any other things from the Flask world that you would like me to comment on. Happy 2025! Buy me a coffee? Thank you for visiting my blog! If you enjoyed this article, please consider supporting my work and keeping me caffeinated with a small one-time donation through Buy me a coffee. Thanks! Buy Me A Coffee Share this post Hacker News Reddit Twitter LinkedIn Facebook E-Mail No comments yet Leave a Comment Name [ ] Email [ ] Comment [ ] Captcha [Submit] Flask Web Development, 2nd Edition Flask Web Development, 2nd Edition If you want to learn modern web development techniques with Python and Flask, you may find the second edition of my O'Reilly book useful. Click here to get this Book! About Miguel [miguel] Welcome to my blog! I'm a software engineer and technical writer, currently living in Drogheda, Ireland. You can also find me on Github, LinkedIn, Bluesky, Mastodon, Twitter, YouTube, and Patreon. Thank you for visiting! Categories AI RSS Feed [AI] 2 Arduino RSS Feed [Arduino] 7 Authentication RSS Feed [Authentication] 10 Blog RSS Feed [Blog] 1 C++ RSS Feed [C++] 5 CSS RSS Feed [CSS] 1 Cloud RSS Feed [Cloud] 10 Database RSS Feed [Database] 22 Docker RSS Feed [Docker] 5 Filmmaking RSS Feed [Filmmaking] 6 Flask RSS Feed [Flask] 127 Games RSS Feed [Games] 1 IoT RSS Feed [IoT] 8 JavaScript RSS Feed [JavaScript] 35 MicroPython RSS Feed [MicroPython] 9 Microdot RSS Feed [Microdot] 1 Microservices RSS Feed [Microservices] 2 Movie Reviews RSS Feed [Movie Reviews] 5 Personal RSS Feed [Personal] 3 Photography RSS Feed [Photography] 7 Product Reviews RSS Feed [Product Reviews] 2 Programming RSS Feed [Programming] 187 Project Management RSS Feed [Project Management] 1 Python RSS Feed [Python] 170 REST RSS Feed [REST] 7 Raspberry Pi RSS Feed [Raspberry Pi] 8 React RSS Feed [React] 18 Robotics RSS Feed [Robotics] 6 Security RSS Feed [Security] 12 Video RSS Feed [Video] 22 WebSocket RSS Feed [WebSocket] 2 Webcast RSS Feed [Webcast] 3 Windows RSS Feed [Windows] 1 (c) 2012- by Miguel Grinberg. All rights reserved. Questions?