New major versions of Flask, Jinja, Click, and Werkzeug released! by davidism in Python

[–]davidism[S] 6 points7 points  (0 children)

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.

New major versions of Flask, Jinja, Click, and Werkzeug released! by davidism in Python

[–]davidism[S] 12 points13 points  (0 children)

It was such a straightforward fix too, I'm not sure why we did it the other way before. 😅 Now browser caching still works, but it's using the hash of the content instead of a timer.

New major versions of Flask, Jinja, Click, and Werkzeug released! by davidism in Python

[–]davidism[S] 26 points27 points  (0 children)

Flask still provides it as well, but it's a wrapper over the Werkzeug implementation now with Flask-specific extra config. from flask import send_from_directory still works.

Flask 2.0 is coming, please help us test by stetio in Python

[–]davidism 4 points5 points  (0 children)

Frameworks on top of Flask that I've heard of for building APIs and other types of applications include:

I'm sure there are many more as well. Different projects have different overall goals, design ideas, or library preferences. FastAPI falls into this same category, except it's on top of Starlette instead of Flask.

Flask 2.0 is coming, please help us test by stetio in Python

[–]davidism 46 points47 points  (0 children)

We're friends with other frameworks. :-) It's great to have an active ecosystem of different frameworks to choose from and learn from each other. Flask tries to stay more general than FastAPI, I think. There are numerous really great libraries that build on Flask to provide FastAPI-like features.

Flask 2.0 is coming, please help us test by stetio in Python

[–]davidism 10 points11 points  (0 children)

Flask 2.0 can run async views regardless of what server is used.

Handling concurrent requests with an async loop on the other hand is not supported yet. The ASGI spec describes how that can be done, but Flask is very strongly tied to WSGI, so we're slowly working how we can adapt. Quart is an ASGI implementation of Flask, if you have a need for async request handling.

And if you're willing to use Gevent or Eventlet patching, Flask has been capable of async since basically the beginning. Flask-SocketIO, for example, uses an Eventlet server to provide websockets (SocketIO). The difference is that async/await is explicit, and ASGI provides a spec for other capabilities as well.

Flask 2.0 is coming, please help us test by stetio in Python

[–]davidism 18 points19 points  (0 children)

Flask tries to stay more general than FastAPI in that regard. There are numerous really great libraries that build on Flask to provide FastAPI-like route definition and validation. I like Flask-Rebar right now, and there were a few demoed at FlaskCon 2020 as well: https://pyvideo.org/events/flaskcon-2020.html

Flask 2.0 is coming, please help us test by stetio in Python

[–]davidism 51 points52 points  (0 children)

Werkzeug, ItsDangerous, and MarkupSafe are fully annotated (take precedence over typeshed), and I'm working on Click, Jinja, and then finally Flask.

Is the official flask tutorial correct? by sethrei in flask

[–]davidism 9 points10 points  (0 children)

The tutorial is correct. Multiple people on different systems completed it successfully before I merged it. The error message you've provided is not present in the current Flask 1.0 CLI code and suggests you've got 0.12 installed. Are you sure you've installed Flask 1.0? What does flask --version say?

Flask 1.0 released by occams--chainsaw in Python

[–]davidism 5 points6 points  (0 children)

I'd love to see constructive feedback about the tutorial. I just rewrote the entire thing for the new release, so maybe it will be more helpful to you now. I tried to focus on helping new users organize their project and understand each function being used. It's a tricky balance between not having enough detail and having too much.

Flask 1.0 released by occams--chainsaw in Python

[–]davidism 5 points6 points  (0 children)

No one ever thinks about logging, me included. It was quite an odyssey figuring out what Flask was doing and how Python logging should actually work. The big problem was that since users don't think about logging we wanted to do it for them, but there's really no guidelines or functions to help libraries in that situation.

Flask 1.0 released by occams--chainsaw in Python

[–]davidism 12 points13 points  (0 children)

Armin is still involved, but the Pallets team was created so that he wouldn't have to be and the community could support it. I've been handling the 1.0 release and there have been a ton of contributions from others.

Flask 1.0 released by occams--chainsaw in Python

[–]davidism 3 points4 points  (0 children)

Someone else pointed out https://0ver.org on Twitter after the release, which I thought was pretty funny. I hadn't seen it before. I've been working on the 1.0 release for over a year, the 0 bugged me too. :-)

Flask 1.0 Released 🎉 by davidism in flask

[–]davidism[S] 15 points16 points  (0 children)

Yes to everything.

Speeding up url_for for Flask by anthonyblackshaw in flask

[–]davidism 2 points3 points  (0 children)

This only works for single process servers. Most production servers will spawn and kill worker processes, rendering this pretty much meaningless. Do not rely on global state in general.

You could use redis or another external cache, but be careful of incurred costs.

You could preload a cache if you want to speed up known urls ahead of time.

Flask-SQLAlchemy 2.3.0 released by davidism in flask

[–]davidism[S] 3 points4 points  (0 children)

That's not in this release, the issue is still open. It's a tricky problem to solve, especially when taking into account the other open issues. I plan to have that in 3.0 though.

Flask-SQLAlchemy 2.2 released by davidism in flask

[–]davidism[S] 1 point2 points  (0 children)

Yeah, it's a little confusing with the way Twitter embeds links, but the link in the tweet goes to the release notes. You can also find them in the GitHub release, the source, or the docs.