Flask 2.0 Major Release Updates
Edited by: Varun Singh and Background Image by William Daigneault on unsplash

Flask 2.0 Major Release Updates

Finally, with the release of Flask 2.0, and hearing the podcast of the flask team, it is official that Flask is the most popular python web framework to date. Here are the stats discussed in the podcast.

Survey done by Jetbrains 2020

Since 11 years of its inception, Flask has proven itself a powerful microservices and application development framework for python developers and organizations. And yes, Flask 2.0.0 has been released on the 5th of May 2021 giving all the python developers out there something to think about.

As a python enthusiast myself, I would like to list out the major updates that are released with this version of Flask. Without further ado, below is a list of major updates:

??? Support for Python3.6+ is added.

?? No support for python version 2.7 and 3.5. Probably because even Python3.5 has reached its end of life with the last release version 3.5.10.

?? More readable and short route decorators added for common HTTP methods.

For example:

@app.route("/auth", methods=["POST"])

Can also now be written as:

@app.post("/auth")

?? Initial async-await support (optional install flask[async]), that allows for async route handlers, error handlers, before/after request, and teardown functions. Here is an example from the docs:

@app.route("/get-data")
async def get_data():

    data = await async_db_query(...)
    

    return jsonify(data)
    

?? Now for microservice developers - Nested blueprints are supported. Now, you can use register_blueprint(another_app) to nest blueprints. Here is an example from docs:

def create_app():
    app = ...
    # existing code omitted

    from . import auth
    app.register_blueprint(auth.bp)

    return app

?? If you work with files - Flask has done one update in the send_file() utility, that it will now raise ValueError if an IO object is passed in text mode. Previously, it used to return an empty file with a 200 status code.

?? This release of Flask brings lots of deprecations. So don't be alarmed when you see a lot of deprecation warnings when you run the Flask 2.0 server (BTW I have seen the list -- you can panic ?? ). You can find a detailed list of deprecations on the Flask website.

Well, that is all I can list out for you folks. There are many other updates related to improved type hinting, default encoding, etc.

I know, a few of you are thinking about using Flask2.0 as your next python framework, I would just say one thing:

Lets be optimistic and have an open mind for FastAPI ?? 

Follow me for more interesting articles on Python and AWS. You can read more of my blogs and findings on Medium - Varun Singh.

要查看或添加评论,请登录

Varun S.的更多文章

  • 10 Javascript Tricks — You Must Know in 2025

    10 Javascript Tricks — You Must Know in 2025

    Javascript has been around for quite a long and it has always made the trend in the programming world. Like any other…

  • 10 Tricks that Helped Me Land Data Engineering Role

    10 Tricks that Helped Me Land Data Engineering Role

    Data Engineering was a distant dream for me. I was the guy who only knew some Python programs and a few AWS services…

  • Auto-Scaling Glue Jobs is Easier Than Ever

    Auto-Scaling Glue Jobs is Easier Than Ever

    AWS is a pioneer in cloud technologies and Glue jobs are one of the many services that help many firms process and…

  • 5 Python Itertools I Should have Known in 2021

    5 Python Itertools I Should have Known in 2021

    Looping through a sequence has been the most common programming task I perform daily. Python provides a great module…

  • Python 3.10 Released - 5 New Features You Should Know

    Python 3.10 Released - 5 New Features You Should Know

    Python has been in the market for quite some time now and as a Python Developer myself, am very excited to share that…

  • Background Tasks in FastAPI

    Background Tasks in FastAPI

    FastAPI is a relatively new web framework for Python, taking inspiration from web frameworks like Flask, Django…

  • AWS Lambda can now run containers

    AWS Lambda can now run containers

    Lambda has served many happy customers who do not wish to manage servers while developing the code. The users need to…

    1 条评论

社区洞察

其他会员也浏览了