Full Web Apps with FastAPI Transcripts
Chapter: Welcome to the course
Lecture: FastAPI compared to other frameworks
0:00 Now let's compare FastAPI to some of the other popular Python options that you might choose. Here's FastApi's home page,
0:08 it's documentation and so on. The documentation is really thorough and really good. So what else might you use instead of FastAPI?
0:16 Well, there's what I think of as the big two: Django and Flask.
0:20 These two combined represent about 80 to 82% of the current Python web application framework
0:27 mindshare, deployments and so on, especially looking at stuff that's been built recently. Between them
0:32 they are the two ways that people often think about web applications and Python.
0:38 Django has all these somewhat larger building blocks that you click together to build your app
0:43 whereas Flask is all about it's micro framework lifestyle. You get to pick every little thing and there's zero help for you. You want a database? Okay,
0:51 go get a database. You want to talk to it. OK, go figure that out. Right? Do you decide on SQLAlchemy Do you decide on MongoDB? Do you? What do you do?
0:59 So it's all about picking the little pieces and putting them together however you like in Flask. We also have Pyramid and Tornado.
1:06 I'm a fan of Pyramid, I like that framework quite a bit. It's very fast, and Tornado is one of the very first asynchronous style of frameworks.
1:14 It doesn't necessarily use the, at least in the early days the async and
1:18 await style of programming that's popular today because it actually existed before that style of programming but these air two good options.
1:25 And if you're looking at just your API, there's frameworks like Hug or Django REST framework, or so on that you might consider.
1:33 So which side are you leaning? More APIs and also need a little web or more web, and maybe we'll need an API. So if we compare these, you might say,
1:42 well, how does this compare to FastAPI? One way to think about it is popularity. We're gonna talk about the features that make FastAPI awesome
1:50 as well. But one is popularity. If you look Django and Flask, they're quite popular. 54k and 53k stars on GitHub.
1:59 This represents their very nearly equal split in the mindshare. We have pyramid at 3k. Tornado at 20k, Hug at 6k. What's FastAPI at? 26k.
2:10 Now wait. Maybe it's not as good as Flask or Django. Here's the thing. Django is like 10, 15 years old. At this point,
2:17 FastAPI is less than two years old. So in the, you know, Django's had all this time to build up people like following and being part of it
2:24 and FastAPI is really, really coming on strong. As far as I can tell, it is the most popular, relatively new framework,
2:31 and being relatively new is an advantage. It means that supports async and await right out of the box without jumping
2:37 through a bunch of hoops. It does really powerful things with type annotations.
2:41 It works with Pydantic data models that do automatic conversion and validation and on and on and on. So because it's new,
2:50 it's awesome. It has all the modern Python features you would hope for, but you can see it's nearly as popular as some of these older ones, the most
2:57 popular, too, amongst the Python web landscape.