Modern APIs with FastAPI and Python Transcripts
Chapter: Welcome to the course
Lecture: Fastapi vs. x

Login or purchase this course to watch this video and the rest of the course contents.
0:00 One of the questions people always ask is "Which Web framework should I use for building an API? Should I use flask? Should I use Django? Should I
0:08 use Django REST framework?" like, all these different things. So let's take a moment and look at FastAPI versus other frameworks,
0:14 real briefly. Well, the big two have got to be Django and Flask. Django has Django REST framework. Flask has some REST-ful extensions,
0:22 you can add to it. But here's the thing, FastAPI is an API framework first. It's an async framework
0:29 first. It automatically creates documentation with openAPI documentation, all those things. So it's built specifically to be what it is,
0:38 an API framework, where as Django, yes it also does API's, but that's not it's main goal. Flask also does API's,
0:46 but it's not got all that infrastructure there to help you make it go fast. Oh yeah, and both Django and Flask don't fully embrace the async and await
0:55 style programming. At the time of this recording, Django is working on it, Flask has plans that are not really there
1:00 yet. So, if you want a modern API and you're starting from now, you're starting from scratch, your starting
1:05 now, why not choose the most modern framework that has some momentum behind it? We also might compare it to Pyramid or Tornado. Pyramid,
1:13 I love Pyramid. I think it's a great framework, but it does not, and has no plans to, support async as far as I
1:19 know. Also, it's more on the web, less on the API framework side. Pyramid's great.
1:26 There's a lot of things I like about it and I actually created some open source libraries to bring those features that I like about Pyramid to
1:31 FastAPI, but that sort of not exactly the main topic of this course.
1:35 But Pyramid, nice. Tornado, Tornado is interesting because it's one of the few frameworks that embraces the async and await style of programming.
1:44 But FastAPI is the modern version of Python's async. And also there's other specific API frameworks, right? So Django, Flask, all these,
1:54 they're about building Web apps. They can also build API's. Hug,
1:57 for example, built on Falcon, is one of these frameworks that's specifically about building API's. "Embrace the API's of the future",
2:04 the happy Koala hugging bear things says. And Hug is actually nice, but the guy who created Hug actually talked about his
2:12 admiration for FastAPI and how it's really, really special. Let's look at one more aspect of these here.
2:17 Programming is not exactly a popularity contest, but when things are popular, that means there's more momentum behind it,
2:24 there's more other tools to go with it, there's more tutorials and whatnot, so let's just look at the number of GitHub
2:30 stars around each of these. So, Django: 54,000, Flask: 53,000, Pyramid: 3,000, Tornado: 20,000, Hug: 6,000. You look at FastAPI,
2:40 It's at 22, 23,000 right now. What's interesting though, you might say, Well, "it's less popular than Django and flask",
2:48 Yeah, it's only been around a year and a half, and Django and Flask have been around like 10 years.
2:52 So, that tells you a sense of just how popular FastAPI is. It's way popular more than all the other ones below that have been around a while.
3:01 But even for the big hitters, it's like halfway there, 1/7, 1/6 the time it's been around, so really,
3:07 really exciting. There's so much momentum behind FastAPI and I do think it's because of this modern aspect that we've talked about.


Talk Python's Mastodon Michael Kennedy's Mastodon