3 ms·
Flask has been around much longer than FastAPI and, as a result, is a much more mature framework. Some examples: - There's a memory leak with a particular comb
by gsa 3y ago
Flask has been around much longer than FastAPI and, as a result, is a much more mature framework. Some examples:
- There's a memory leak with a particular combination of packages FastAPI [0]
- Before Pydantic v2, you would validate your data on input (when it's stored in the db) and then every single time on retrieval. There is no way to skip validation, for example, when you are generating a response on data that was already validated when it was persisted to the db. [1]
- FastAPI has documentation only in the form of tutorials. There is no API documentation and if something is not clear looking through the source code is the only option
- You need ORJSON for maximum serialisation performance (perhaps this has changed with Pydantic v2) [2]
- Using FastAPI with uvicorn doesn't respect log format settings [3]
I don't mean to imply that FastAPI is a bad framework. The Flask ecosystem has had over a decade to mature. FastAPI and the ecosystem will get there but it _needs_ time.
- [0] https://github.com/tiangolo/fastapi/discussions/9082 https://github.com/tiangolo/fastapi/discussions/9082
- [1] https://github.com/pydantic/pydantic/issues/1212 https://github.com/pydantic/pydantic/issues/1212
- [2] https://fastapi.tiangolo.com/advanced/custom-response/#use-orjsonresponse https://fastapi.tiangolo.com/advanced/custom-response/#use-o...
- [3] https://github.com/encode/uvicorn/issues/527 https://github.com/encode/uvicorn/issues/527
- minimaxir 3y ago> - You need ORJSON for maximum serialisation performance (perhaps this has changed with Pydantic v2) [2] The common orjson trick no longer works in v2 and will throw warnings, but it appears it's no longer necessary since the JSON formatting leverages the native seralizer which happens in Rust-land.
- arun-mani-j 3y agoExactly my issue too. Why there is no API documentation for FastAPI? It is very difficult to know what is available and what is not beyond the tutorial style docs. (I love FastAPI and use it for all my projects, this one little thing troubles me sometimes)