Flask 2.0
flask.palletsprojects.com
flask.palletsprojects.com
FastAPI is more focused on making it easy to make APIs, especially with the built-in Swagger docs generation (I don't believe Flask has this out-of-the-box).
So if your greenfield project is more web-based (clients are web browsers), Flask may be more suited. If your greenfield project is service-based (command line applications, or front end), FastAPI may be more suited.
In both cases, it's as easy to substitute one for the other. Personally I'll be trying out FastAPI since the dev experience seems a lot nicer (integration with `pydantic`).
Edit: Thanks for the correction, my point is moot and irrelevant.
> When you declare a path operation function with normal def instead of async def, it is run in an external threadpool that is then awaited, instead of being called directly (as it would block the server).
Flask itself doesn't support swagger out of the box (much like security or login/auth) but the community has you covered.
IMHO go with whatever one you know and don't depend too much on any special features or framework-specific things that aren't critical. You're likely going to throw away and rewrite whatever you produce many times throughout its lifetime if it gets some legs and grows.
What “headaches” have you encountered with Python/Flask in relation to deploying, managing, scaling? Specifically, what headaches have you encountered that are not present in every platform/language? Are you a NodeJS dev?
You seem to be suggesting that there is a much simpler / better alternative. What is it?
Bottle is the simpler Flask
It seems like it was probably just a misunderstanding due to an ambiguous way someone could interpret your post. I see what you likely actually meant, now, and that you probably weren't talking about some issue with Python but about different levels of complexity in deployment in general, but I also initially misinterpreted it like the other posters did and thought it was a jab at Python.
So everyone was basically misunderstanding everyone else and mutually thought they were being baited even though they weren't, I think.
He said he under appreciated how big the community would get but also the number of people who would use it.
He faulted himself for not spending time thinking about the transition from him primarily working on it to others. And that he should have been thinking about how things would work when he was not involved.
The specific item he was concerned about was that he did not work to build a "community of like minded people" which he says Django did a much better job at doing.
At the very end of the comment, he openly considers if there are things he should have done differently:
"I probably would feel less detached from it if I would have communicated some of my ideas more.
I feel like it is no longer my fight to make it more backwards compatible for instance. The community sees this differently than I do, so that's fine."
I don't know too much about it but raymond hettinger gave a talk about it. https://www.youtube.com/watch?v=p33CVV29OG8
- Add type hinting. https://github.com/pallets/flask/pull/3973
I think it's fair to assume annotations is the big reason.
[0] https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-compa... [1] https://mail.python.org/pipermail/python-dev/2017-December/1...
They are now insertion ordered.
I’m guessing they want to tell people it’s time to upgrade. And 3.6 brings a lot of niceties that they might want to use, like f-strings.
If you haven't updated in that time, you probably have a systemic problem which shouldn't be blamed on Python moving too fast (in fact I suspect those people don't keep up with bugfixes either, so nudging them to upgrade when they try to update flask/numpy is a good idea).
I imagine that removing it from the supported versions in Flask allows for example to use f-strings.
(Current is 3.9 so 8,7,6 are also supported)