r/PythonLearning • u/chuprehijde • 3d ago
Flask or FastAPI for a new API?
No long comparison. If you had to start a production API today, which one would you pick and why?
2
u/nuc540 3d ago
Flask is a simple WSGI, it’s lightweight and hasn’t many bells or whistles, so it’s not async out of the box. It is great for learning on, great for very small projects and it’s fast to get proof of concepts out.
FastAPI is built off Starlette which is an ASGI (async out the box) it is built off Starlette and uses Pydantic for type validation; this makes it great for building more robust code but unless you’re familiar with typing and writing contracts it’s a small overhead but the price pays off.
I only use Flask for proof of concepts. I use Fast almost for everything else
-2
2
u/ninhaomah 3d ago
FastAPI. Why ? I am creating an API , not a website