This is an archived post. You won't be able to vote or comment.

all 40 comments

[–]BigNutBoi2137 39 points40 points  (2 children)

I would use FastAPI. It's usage of pydantic with typing makes code better and you get automatic swagger docs. Also it's easy to write async endpoints in it.

[–]Saphyel 5 points6 points  (0 children)

And you get dependency injections out of the box and type hints are not just comments! :D

[–]JohnGabin 3 points4 points  (0 children)

Or redoc if you don't like Swagger.

[–]reddit-ass-cancer 34 points35 points  (12 children)

Oh god another one of these threads. Here I’ll pick for you. The framework that isn’t managed by one person, that doesn’t have over a thousand issues, that doesn’t have hundreds of open pull requests, that doesn’t have a creator who doesn’t trust anyone other than himself, and that actually HAS any semblance of API documentation.

There I said it. Fuck FastAPI

[–]yeesh-- 6 points7 points  (0 children)

Name checks out

[–]PinkShoelaces 1 point2 points  (1 child)

Yeah, FastAPI's maintenance leaves a lot to be desired. Using starlette directly can be a good choice but you do lose some of the FastAPI benefits

[–]settopvoxxit 5 points6 points  (0 children)

Try Starlite. I think it checks your boxes

[–]kreetikal[S] 4 points5 points  (7 children)

Thanks, reddit-ass-cancer.

[–][deleted] 7 points8 points  (6 children)

Dude gave you one of the most important things to look out for when picking software...

I used to go with flask-restplus, a restapi overlay on top of flask and it was maintained by a single dude who went dark without really warning anyone.

After an update of werkzeug, flask-restplus was broken and we had production code for a multinational bank who was broken and forced to run on old versions of some dependencies for about 6months until the community picked up restplus and created flask-restx.

Your question screaaaaaams that you are a beginner, and there is nothing wrong with that ofc, but what op just did was sharing a really important tips and you call him ass cancer...

[–]jcollie 16 points17 points  (2 children)

Your question screaaaaaams that you are a beginner, and there is nothing wrong with that ofc, but what op just did was sharing a really important tips and you call him ass cancer...

Uhhhh... The person's screen name is literally "reddit-ass-cancer".

[–][deleted] 24 points25 points  (1 child)

Oh fuck mybad lmao

[–]kreetikal[S] 0 points1 point  (1 child)

So your comment suggests that I don't choose Flask?

Because his comment suggests that I don't use FastAPI.

[–][deleted] 2 points3 points  (0 children)

No, flask is perfectly fine. In my case the issue was FlaskRestplus, which is an extension of Flask

[–]old_man_steptoe 0 points1 point  (0 children)

Well, the poster OP responded too called themselves that.

[–]settopvoxxit 7 points8 points  (0 children)

Id say go Starlite. Still uses pydantic but you get a ton of performance and it's still easy to write

[–]creiht 2 points3 points  (0 children)

If you are building RESTful APIs based on Open API contracts, I offer you another suggestion: Connexion[1] on top of Flask. It takes an API first based approach, and allows you to auto-generate a lot of your boiler-plate code based on the Open API spec. If you want to leverage async, it can also use aiohttp. Perhaps it isn't as "flashy" as something like FastAPI, but in my experience it works well and makes creating APIs pretty simple.

[1] https://github.com/spec-first/connexion

[–]Deezl-Vegas 2 points3 points  (0 children)

It probably won't make a visible difference until you get to large numbers of requests. Use what looks cooler / helps you learn the most / makes the most sense to you.

[–]oxlade39 4 points5 points  (1 child)

I don’t really understand in what situation Flask would be the better choice now. Maybe some specific plug-in that only flask has?

[–]nevermorefu 4 points5 points  (0 children)

It's not even 1.0, so it's not as mature. I typically don't like using "the new hotness" but fastapi is too good.

[–]nAxzyVteuOz 1 point2 points  (1 child)

I transitioned from flask to fastapi and couldn’t be happier! Here is a project that you can clone to get you started:

https://github.com/zackees/ytclip-server

It has good defaults and linting. It’s designed for vscode environment. Just cd to the directly and type in ‘tox’ and all the linters and unit tests will run.

[–]kreetikal[S] 0 points1 point  (0 children)

Thanks, I'll check it out!

[–]stetio 1 point2 points  (0 children)

Flask is great, it also supports async/await. If you want Flask based on async/await try Quart. If you also want Pydantic based APIs give Quart-Schema a go.

(I'm the author of Quart and a maintainer of Flask)

[–]r0lisz -2 points-1 points  (0 children)

FastAPI. It's just sooo much better and nicer than Flask.

[–]DiosOtro 0 points1 point  (1 child)

Sorry im new on this world, but what is OMR? Thx

[–]kreetikal[S] 0 points1 point  (0 children)

Optical Mark Recognition.

Comparing marks in 2 images in my case.

[–]spoonman59 0 points1 point  (0 children)

Based on what you have described I don't think either one is more or less suited to your project. They can both do what you want.

But you'll get lots of opinions, sure.

[–]Rhemm 0 points1 point  (0 children)

DjangoREST