-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Bottle by FastAPI #2181
Comments
Another possible option to consider: |
Consider https://sanic.dev/en/ - one of the fastest Python frameworks (talking about 100k req/s) and has API very similar to FastAPI or Bottle/Flask+async. Already proven, used in large projects (e.g. Italian government Covid tracing app). Can directly run a public web server incl. HTTP/3, and comes with other advanced features while staying low level and unopionated. Just almost nobody seems to know it exists. Disclaimer: I am a developer of it. |
Assuming that the FastAPI are not biased, it might be better to just stick with FastAPI Litestar/Starlite seemed interesting but seems to be quite less used than FastAPI. FastAPI also has a huge userbase with lot of community support, so I think sticking with it would be the best bet in a long term standpoint. @nicolargo What do you think? |
@RazCrimson Uvicorn (that Starlette and FastAPI run on) is an ASGI server and can be used with Sanic as well. However, the preferred way to run Sanic is using its integrated HTTP server which runs much faster than what is possible via ASGI. That being said, FastAPI can run fairly quick too. I've yet to see useful conclusive benchmarking between the two, and we do not intend to compete with it for users (rather, we are interested on how to awake Flask and Django users, as well as NodeJS Express users, to that there are modern alternatives). Sanic benchmarks consistently faster than FastAPI and other popular frameworks in these micro benchmarks (that I wouldn't put much value on): Your application looks like it wouldn't be super heavy on requests, so you might be looking more at how to get your routes setup (FastAPI notably using type annotations for that), or perhaps just setting up a static site with VueJs or alike that talks to the backend via a single websocket endpoint. And then how easy it is to deploy either on localhost or perhaps if you are looking for TLS certificates, possibly also authentication, on a public site. I believe both frameworks are smart enough to avoid the use of callback functions, and to have proper flow control and security to run safely on hostile networks (things that haven't always been certain on earlier frameworks). |
My bad, I should have put that a bit better. The reason I preferred FastAPI to Sanic was not really the performance but the huge community behind it. So in the end FastAPI would end up being more tested for bugs and vulnerabilities than other frameworks as the larger user base would be having more diverse use cases. |
@RazCrimson Not sure whether you'll get that, as it is a very young framework and only built for JSON APIs (rather than diverse use cases). But yes, it certainly seems more popular at this time and has more active developers, so I understand why you'd go with that. |
Work started on branch issue2181 |
Merged into develop. BREAKING CHANGE: API version is now 4. |
Trade-off should be made between the current Bottle Framework and a new one like FastAPI (see https://fastapi.tiangolo.com/#requirements).
The text was updated successfully, but these errors were encountered: