r/Python • Flask Maintainer • May 12 '21

News New major versions of Flask, Jinja, Click, and Werkzeug released!

Representing over two years of work from the Pallets team and contributors, new major versions Flask, Werkzeug, Jinja, Click, ItsDangerous, and MarkupSafe have been released on May 11, 2021. Check out our announcement on our blog: https://palletsprojects.com/blog/flask-2-0-released/, and retweet it to spread the word on Twitter as well: https://twitter.com/PalletsTeam/status/1392266507296514048

Every project has significant changes, and while we don't anticipate breaking things, it may take some time for extensions and other projects to catch up. Be sure to use tools like pip-compile and Dependabot to pin your dependencies and control when you upgrade.

Overall changes to every project include:

  • Drop Python 2 and Python 3.5 support. Python 3.6 and above is required, the latest version is recommended. Removing the compatibility code also gives a nice speedup.
  • Add comprehensive type annotations to all the libraries.
  • Better new contributor experience with updated contributing guide and consistent code style with tools like pre-commit and black.

Check out the changelog links for each project to see all of the great new features and changes. I've included some of the highlights here as well.

  • Flask 2.0
    • async def views and callbacks.
    • Nested blueprints.
    • Shortcut HTTP method route decorators like @app.post() and @app.delete().
    • Static files like CSS will show changes immediately instead of needing to clear the cache.
  • Werkzeug 2.0
    • multipart/form-data is parsed 15x faster, especially for large file uploads.
    • Getting ready for async support behind the scenes.
    • Improved test client experience.
    • Routing understands websocket URLs.
  • Jinja 3.0
    • Async support no longer requires patching.
    • Lots of weird scoping fixes.
    • I18N supports pgettext.
  • Click 8.0
    • Completely rewrote the shell tab completion system to be more accurate, customizable, and extensible to new shells.
    • Support for 256 and RGB color output.
    • Options can be given as a flag without a value to use a default value or trigger a prompt.
    • * and ~ patterns are expanded on Windows since its terminal doesn't do that automatically.
    • User-facing messages like validation errors can be translated.
  • ItsDangerous 2.0
  • MarkupSafe 2.0

Four years ago, each project had 150+ open issues, some going back a decade, and pages of open pull requests too. Over time I've grown the maintainer team and the community, and we've managed to cut down the backlog to a much more manageable size. I'm thankful for all contributions and support people have given, and I hope you all continue to build amazing applications with the Pallets projects.

663 Upvotes

38 comments sorted by

View all comments

Show parent comment

7

u/davidism Flask Maintainer May 13 '21

You can still use that too. We removed the max age value and rely on etags only.

Instead of waiting for the age to expire and never sending a request before that, the browser sends a request with the etag it has stored, and the server sends a special empty response instead of serving the file again only if the etag still matches. So a slight bit of overhead for the request and hash, but immediate updates. You can still set a max age if you do want that behavior too, perhaps in production.

2

u/trevg_123 May 13 '21

That sounds quite awesome actually, thanks for the response! And thanks for all the work your team does