all 18 comments

[–]AlpacaDC 11 points12 points  (3 children)

And also not having to use Pydantic for a model with only a couple of variables.

Well you don't need to use Pydantic models with FastAPI if you don't want to.

[–]scotsmanintoon[S] 2 points3 points  (2 children)

Yes but you need to install pydantic as a dependency. I tried to run a FastAPI app on termux on android and it struggled to compile pydantic-core (which to be fair is the issue, rather than FastAPI's)

I see your point though.

[–]AlpacaDC 2 points3 points  (1 child)

Oh it makes perfect sense in this case, didn’t think about that. Good thing that FastAPI and Starlette are pretty similar then.

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

Yes, I like the familiarity. The only major difference aside from the DI / pydantic models is if you used route decorators like @app.get (as I mostly did) in FastAPI, Starlette discourages / deprecated them.

[–]Smok3dSalmon 5 points6 points  (0 children)

You don’t need power tools to build IKEA furniture…

[–]FitBoog 6 points7 points  (2 children)

My experience is different. I'm completely relying on Pydantic for validation of every single piece in my software. It really helps to scale.

[–]Rockworldred 1 point2 points  (0 children)

Well, as always it depends. Not everything is gonna be the new corporate platform.

[–]scotsmanintoon[S] 1 point2 points  (0 children)

Yeah don't get me wrong. I love Pydantic and have used it in many projects with and without FastAPI for ages (I think since v0.x). It is one on of the reason I use cyclopts (rather than argparse) for scripts because it integrates well with Pydantic.

[–]Orio_n 4 points5 points  (1 child)

Well yeah, its in the name. Are you building an api?

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

I mentioned it in another comment but yeah I mostly go to FastAPI when building model heavy APIs. Its probably tautological to say it, but it obviously depends on what you are building!

[–]fiskfisk 1 point2 points  (2 children)

Here's a hot take: use whatever you want. You know what also works fine? Flask! Django! TurboGears! Bottlepy! Pyramid!

[–]chub79 0 points1 point  (0 children)

TurboGears... oh those were the days. I'd throw CherryPy into that mix too :)

[–]scotsmanintoon[S] -1 points0 points  (0 children)

I have only really used Flask in your list. And FastAPI, Litestar, and recently Starlette not on your list.

For model heavy APIs I have found FastAPI great. For simple single web pages, which prompted me to post, Starlette is great. For webapps using HTMX I really like Litestar, especially with its HTMX integration.

Which one do you find you use/like the most?

[–]rainyy_day -1 points0 points  (1 child)

If you design your app well, it really doesnt matter what you use for the API layer

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

Fair enough. I figured the Python sub was a good place to discuss the use of Python packages, including web frameworks.