Learn Python with Talk Python's 270 hours of courses

Flask 2.0

Episode #316, published Fri, May 14, 2021, recorded Mon, May 10, 2021

Flask is one of the most popular Python web frameworks. And they have huge news to share with us. Flask 2.0 just released after a ton of work. And it's as big of a deal as the version number suggests. Async changes are coming, Python 3.5 and below (including Python 2) support has been dropped and much much more. Join me as I discuss Flask 2.0 with David Lord and Philip Jones.

Watch this episode on YouTube
Play on YouTube
Watch the live stream version

Episode Deep Dive

Guests Introduction and Background

David Lord is one of the core maintainers of the Pallets Projects, which includes the popular Python web framework Flask as well as foundational libraries such as Werkzeug, Click, and Jinja. He has been deeply involved in Flask’s evolution, working on bug fixes, features, and community building since Flask 1.0. David introduced Python and Flask at his workplace, where he's been for over a decade, and he continues to shape Flask's development in important ways.

Philip (Phil) Jones is the creator and maintainer of Quart, an asyncio-based web framework intended to be API-compatible with Flask. Phil also contributes extensively to the Pallets Projects, helping to bring async functionality to Flask 2.0 and beyond. He has worked in several companies in London, attempted his own startup, and remains a passionate open-source enthusiast.

What to Know If You're New to Python

Here are a few pointers that will help you follow the conversation about Flask 2.0:

  • Be aware that Flask is a web framework in Python, so you’ll need some basic Python syntax knowledge (functions, decorators, etc.).
  • Understand the concept of virtual environments so you can install and isolate Flask or other libraries without affecting your system Python.
  • Grasp the basics of HTTP and web server concepts—Flask is all about serving and handling web requests.

Key Points and Takeaways

  1. Flask 2.0 Release and Why It’s Significant Flask 2.0 is a major milestone for the project—its first mainline release after Flask 1.x. It brings modern Python 3 features, new async capabilities, updated decorators, and performance improvements. This version also officially drops support for Python 2 and older 3.x versions below 3.6. The release was carefully planned to maintain backward compatibility while welcoming new Pythonic enhancements.
    • Tools and Links:
      • Flask – Official website and documentation
      • GitHub Sponsors – Pallets Projects sponsorship page
  2. Async Support in Flask One of the most notable features in Flask 2.0 is its native support for async def endpoints. This makes it easier to integrate async libraries (e.g., HTTPX, async SQL drivers) without resorting to workarounds. You can now use async and await inside your route handlers, although Flask remains a WSGI framework for the most part. For fully async servers, the community looks to either bridging Flask with ASGI or using Quart.
    • Tools and Links:
      • Quart – Phil’s async-compatible Flask variant
      • asgiref – Underpins Django and others for async
  3. Compatibility with Existing Extensions A key aim of Flask 2.0 is backward compatibility. Extensions like Flask-SQLAlchemy, Flask-Login, and others should continue to work with minimal or no changes. The maintainers have taken extra care to deprecate features gradually, giving extension authors time to adapt. This means you can upgrade and then gradually incorporate the new async features if and when they make sense.
  4. Dropping Python 2 and Older Python 3 Versions Flask 2.0 now requires Python 3.6+, and it officially removes all Python 2.7 and Python 3.5 support. This decision allowed the maintainers to eliminate legacy code paths and introduce more streamlined Python 3 idioms. The new release also benefits from performance enhancements due to dropping these older interpreters.
  5. Performance Improvements and Sans I/O Alongside new features, the team introduced major performance gains in Werkzeug (the WSGI toolkit underlying Flask). Form parsing and file uploads are now significantly faster—particularly for large files. The effort toward a “Sans I/O” approach in Werkzeug paves the way for better async support and ensures minimal overhead when transferring data.
    • Tools and Links:
      • Werkzeug – Flask’s WSGI library
      • uvicorn – An ASGI server often used for async frameworks
  6. Blueprint Nesting Flask’s blueprint system gets a major update in 2.0, allowing nested blueprints. Before, only a single layer of blueprints existed under the main Flask app. Now, developers can structure their routes in a more hierarchical way—prefixes can sit under prefixes, which is especially helpful for larger applications or modular designs.
  7. Short-Form Decorators Another handy addition is short-form route decorators such as @app.get("/path"), @app.post("/path"), and so on. Instead of repeatedly specifying methods=["GET"] on a single route decorator, you can directly use these new method-specific decorators for more succinct and readable route definitions.
  8. Difference Between Flask and Other Web Frameworks The episode addressed why Flask is popular compared to Django and more modern frameworks like FastAPI. Flask is minimal by design, requiring extensions for databases, authentication, and so on, whereas Django has a “batteries included” approach. FastAPI leverages modern Python type hints and async for building APIs swiftly, but Flask 2.0’s additions help it stay relevant for both new and established projects.
    • Tools and Links:
      • Django – Popular “batteries included” web framework
      • FastAPI – Modern Python web framework using async
  9. Production Deployment Choices Existing deployment stories remain the same. If you’re running Flask in production, you can continue to use WSGI servers like Gunicorn or uWSGI, or run an ASGI approach via an adapter. The key takeaway: Flask 2.0 does not force a switch in how you deploy—just new options if you want them.
    • Tools and Links:
      • Gunicorn – Commonly used WSGI server
      • uWSGI – Another widely-used WSGI server
  10. Flask on Mars (NASA F Prime) A fun anecdote is that NASA’s F Prime software references Flask in its dependencies. This project is used in monitoring and control dashboards for missions like the Mars helicopter “Ingenuity.” While Python isn’t literally flying the helicopter, the framework plays a role in ground control and real-time data dashboards, highlighting Flask’s robustness and trust across industries.
  1. Community Support and Sustainability The Pallets team receives funding via GitHub Sponsors, Tidelift, Read the Docs (Ethical Ads), and PSF donations. Such support enables ongoing maintenance, community events like FlaskCon, and new features without a commercial backer. They encourage companies using Flask to consider sponsoring and individuals to contribute to code and documentation.
  1. Quart Integration and Future Evolution As Flask 2.0 offers partial async, the next evolution—fully ASGI-compatible Flask—may or may not happen. Instead, Quart continues filling that niche by mirroring Flask’s API while running under ASGI. Over time, the two frameworks might share more code as Werkzeug becomes more I/O-agnostic, but the principle of developer choice remains central.
  • Tools and Links:
    • Quart Docs – Documentation for async Flask-compatible web apps
  1. Editor, Testing, and Workflow David and Phil use various tools, from PyCharm or Emacs for editing to the usual GitHub workflows. The new GitHub “sync fork” feature simplifies contributor workflows. The maintainers emphasized easy on-ramping for new contributors with an interest in open source.

Interesting Quotes and Stories

“It’s hard to wrap your head around that many people using Flask.” – David Lord

“If you want fully async or you’re mostly async, that’s where Quart comes in.” – Philip Jones

“We always want to evolve things, but we don’t want to break anybody without warning them first.” – David Lord

“It’s pretty cool to see it used on Mars. It’s definitely one of the biggest proofs of concept you can get!” – Michael Kennedy


Key Definitions and Terms

  • WSGI (Web Server Gateway Interface): A specification for how a web server communicates with Python web applications.
  • ASGI (Asynchronous Server Gateway Interface): A newer specification designed to handle asynchronous Python apps and frameworks.
  • Blueprints: A way to organize and structure Flask applications into smaller modules that can be registered on the main app.
  • async/await: Python keywords for writing asynchronous code that can handle I/O operations without blocking.
  • Werkzeug: A WSGI utility library powering Flask’s request and response handling.

Learning Resources


Overall Takeaway

Flask 2.0 ushers in a new era for one of Python’s most iconic frameworks, balancing stability with modern features. By adding native async route support, dropping legacy versions of Python, and enhancing performance, Flask keeps its place at the forefront of Python web development. Whether you are building simple sites or large-scale projects, the improvements in Flask 2.0 and its thriving community ensure a healthy, flexible foundation for years to come.

Links from the show

Pallets Team on Twitter: @PalletsTeam
Reddit discussion on Flask 2.0: reddit.com
Phil's Why is Flask not Async Talk: youtube.com
Miguel Grinberg's Websocket Ideas: twitter.com
Pydantic with Quart: gitlab.com/pgjones/quart-schema
Open source goes to Mars 🚀: github.blog
YouTube Live Stream: youtube.com
Episode transcripts: talkpython.fm

--- Stay in touch with us ---
Subscribe to Talk Python on YouTube: youtube.com
Talk Python on Bluesky: @talkpython.fm at bsky.app
Talk Python on Mastodon: talkpython
Michael on Bluesky: @mkennedy.codes at bsky.app
Michael on Mastodon: mkennedy

Talk Python's Mastodon Michael Kennedy's Mastodon