Learn Python with Talk Python's 270 hours of courses

#315: Awesome FastAPI extensions and add ons Transcript

Recorded on Thursday, Apr 22, 2021.

00:00 Have you heard that FastAPI is awesome?

00:02 We have Michael Herman back on the show to help us make it even more awesome

00:06 with his FastAPI Awesome list.

00:08 He's categorized many extensions and other libraries working with FastAPI

00:13 to help you be even more efficient with this framework.

00:16 This is Talk Python to Me, episode 315, recorded April 22, 2015.

00:22 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

00:41 This is your host, Michael Kennedy.

00:43 Follow me on Twitter where I'm @mkennedy, and keep up with the show and listen to past episodes at talkpython.fm,

00:49 and follow the show on Twitter via at Talk Python.

00:52 Talk Python to Me is partially supported by our training courses.

00:55 At Talk Python, we run a bunch of web apps and web APIs.

00:59 These power the training courses as well as the mobile apps on iOS and Android.

01:03 If I had to build these from scratch again today, there's no doubt which framework I would use.

01:08 It's FastAPI.

01:09 To me, FastAPI is the embodiment of modern Python and modern APIs.

01:14 You have beautiful usage of type annotations.

01:16 You have model binding and validation with Pydantic.

01:19 And you have first-class async and await support.

01:22 If you're building or rebuilding a web app, you owe it to yourself to check out one of our newest courses,

01:27 Modern APIs with FastAPI, over at Talk Python Training.

01:30 This is the first course in a series of FastAPI courses we're building, and you can get it for just $39.

01:36 It'll take you from interested to production with FastAPI.

01:40 To learn more and get started today, just visit talkpython.fm/FastAPI or email us at sales at talkpython.fm.

01:47 Michael, welcome back to Talk Python to me.

01:50 Thank you.

01:51 Yeah, it's really great to have you back.

01:53 You've been on before, and there's a bunch of stuff that we're going to talk about that you've been up to and we've done.

01:59 So you were back on episode 206 when you talked about running Django in production.

02:03 And you've had a couple of large sites that you've been running.

02:07 And the most recent one is probably testdriven.io where you do some articles, some tutorials, and some courses, right?

02:14 Yeah.

02:15 So life was obviously much different back in when I was on the podcast back in, what was that, February of 2019.

02:22 But so now I'm still working on testdriven.io.

02:26 So that's a, I do training courses for mid to senior level developers that are looking to learn test driven development,

02:32 microservices, and AWS infrastructure and whatnot.

02:36 Nice.

02:36 It's mostly Python and JavaScript stuff.

02:38 Is that right?

02:39 Yeah.

02:39 Yeah.

02:40 Yeah.

02:40 Cool.

02:40 Maybe some at the same time.

02:42 Yeah, a bit.

02:43 I also get a lot into like container orchestration and whatnot.

02:45 A little bit of Kubernetes, a little bit of AWS ECS as well.

02:49 Awesome.

02:50 And so what do you have to do now?

02:51 So yeah, I am running testdriven.io on the side, but my full-time main gig is for Monitor.

02:57 And we, as the banner there says, we're doing machine learning assurance.

03:02 We're really doing probably machine learning governance is probably more like what way to redo the website.

03:07 That's probably what we would establish machine learning governance would be there rather than assurance.

03:11 But basically we're helping to ensure that your AI is doing what it should be doing in production.

03:19 So that your models are basically inferences or predictions that your models are serving up are like within a certain bounds, essentially.

03:26 Right.

03:27 Like if the input data changes and you don't change your models, maybe they're not meant to understand that type of data.

03:34 And there's just, you know, the thing is you're always going to get an answer, right?

03:36 Yeah.

03:37 It just might be the wrong or invalid data, but it looks like a valid answer.

03:40 Like, how do you know, right?

03:41 Yeah.

03:41 It's kind of like an Excel, like whenever you get, you know, whatever it is besides an NA or whatever, you know, you don't know that's like good or bad or not.

03:49 And so, yeah, we're looking for like feature drift.

03:51 We're looking for model drift.

03:53 We're looking for bias, you know, that sort of things.

03:55 We're also, we take all inferences that go through a model.

03:58 We're logging and then we're also versioning the model as well.

04:01 So you can recreate the model, run counterfactual type tests and whatnot.

04:05 Interesting.

04:05 Okay.

04:06 Is that mostly Python stuff over there?

04:08 What's the tech?

04:09 Yeah.

04:10 So it's a Django monolith.

04:11 That's like the, the backend API using Flask is sort of a middle layer to transform data between the API and the front end.

04:20 The front end is in view and it's primarily AWS.

04:24 And so I'm using Terraform as infrastructure as code to simplify the maintaining of the infrastructure.

04:30 Oh, that's cool.

04:31 I feel like Terraform has definitely taken off.

04:33 I hear a lot of people saying that they're using it these days.

04:35 Yeah, I really.

04:36 Is that like Ansible or Chef or it's like a competitor to that, right?

04:41 Yeah, I think those are a little bit different.

04:43 I would say it's more of a competitor to like CloudFormation templates.

04:48 And CloudFormation, I think there's a new sort of infrastructure as code from AWS called CDK.

04:53 That's a little bit more declarative, sort of how Terraform is.

04:57 And I haven't had a chance to look at that, but I think that's sort of like the new hotness these days.

05:01 And then there's one more called like Bloomy, I believe is the name, but I haven't used that one.

05:06 Yeah, cool.

05:07 People want to learn more about what's going on with Monotar, they can check out episode 261, which is a little newer, April 2020 with one of your co-founders, Andrew Clark.

05:17 Is he still working with you?

05:18 Yeah, definitely.

05:19 Yeah, cool.

05:20 So we dive into all that sort of stuff over there, which is cool.

05:23 So really the main thing that we're going to talk about is FastAPI, right?

05:27 Like that's what we're both here.

05:29 We're both fans of FastAPI on multiple levels.

05:31 And yeah, so we're going to talk about the basically all the extensions in the ecosystem around FastAPI.

05:39 But make the case for us for FastAPI itself.

05:43 Like I feel like there was quite a thousand flowers blooming type of thing going on once async and await came out in Python, right?

05:51 We had the Django, the Flask, old standbys.

05:55 And then when things switched with type annotations and with async and await, those frameworks couldn't move super quick to adapt to those.

06:02 So things like FastAPI and Sanic and Jeprento and Starlette and API Star, all these things just sort of came into existence.

06:09 And, you know, FastAPI is certainly among that crowd, right?

06:12 Yeah, FastAPI definitely leverages Starlet.

06:14 And so, yeah, you get the whole async syntax, async and await syntax.

06:18 I would say that I like FastAPI for other things.

06:21 Like I don't really take advantage of async and await.

06:24 And like the, I have one production app that's running in FastAPI and I could honestly care less about async and await.

06:30 But it's more about like the developer experience that I get.

06:33 And also I really like Pydantic.

06:35 I would say that, yeah, if you're really into Pydantic and that's like what you use for serialization, deserialization, whatnot, then I would definitely check out FastAPI.

06:45 Absolutely.

06:46 Just, you probably don't realize it because it's not very obvious.

06:50 There's like, you scoured the website, you might learn this.

06:52 I just interviewed Samuel Colvin, the creator and maintainer of Pydantic, about Pydantic and all the cool stuff it does.

06:59 So people who are listening to this may have just listened to that episode.

07:02 And FastAPI is a framework that absolutely takes Pydantic and puts it on the boundary, right?

07:09 Like it's, when data is exchanged with FastAPI, the most default way to do that is to somehow involve Pydantic models, right?

07:15 Yeah.

07:15 And I mean, like if you could think back to like Flask, Flask is like just a wrapper on top of Wurzwig and I'm not pronouncing that right, but Wurzwig, Click and a couple others that are escaping me right now.

07:26 But FastAPI is really just a wrapper.

07:28 It's dangerous.

07:29 And like a couple other, yeah.

07:30 Yeah.

07:30 It's just a wrapper on top of Pydantic, OpenAPI, JSON schema, that sort of things.

07:36 Yeah.

07:36 A few more like sort of modern tools like that.

07:39 And so what makes FastAPI cool is that you can, makes it easy to like hook into those two so you can like leverage that and build plugins and whatnot.

07:47 Yeah.

07:48 So you can say things like, here's my API endpoint that I expect somebody to send a JSON document to.

07:54 Oh, and the argument to the document is just a Pydantic model.

07:59 Yeah.

08:00 Right.

08:00 And then FastAPI will either successfully convert that model over or send something like a 400 or 422 back to say bad data.

08:08 We can't convert it to what we're expecting.

08:09 And on top of that, FastAPI then automatically generates the OpenAPI stuff, which you hinted at based on those models, right?

08:17 Yeah.

08:17 Yeah.

08:18 So you can sort of that runtime type checking that you were talking about.

08:21 And so you're really abstracting that out all to Pydantic.

08:24 And so like you don't have to maintain like a test suite around that either.

08:27 And so it handles all of like the error handling around that.

08:30 It sends back a nice human and computer readable response.

08:34 Yeah.

08:35 One of the things I like is if you've got like a nested object, maybe I've got a Pydantic model and has a list of little baby Pydantic models.

08:42 And then there's an error.

08:44 The error would say the third thing in the list is where the problem is.

08:48 Not just there's some invalid data, but on this field, you got a list.

08:52 You've sent me a list of things.

08:54 The third one, that's where that type conversion error is.

08:57 It's like really good about giving you like allowing you to drill on where the data is wrong.

09:01 Yeah.

09:01 Okay, cool.

09:02 So we've got the async and await stuff, which you said you don't use a lot, but if you need it.

09:06 It's there.

09:07 It's nice to have it, right?

09:08 It's really there.

09:09 We're going to talk about some of the places that like plug into that in a moment.

09:12 Pydantic, I think is a big one.

09:14 The OpenAPI stuff is a big one.

09:17 And to me also deployment is just simple, right?

09:19 As long as you've got UVicorn or G-Unicorn plus UVicorn, you're kind of good to go, right?

09:24 There's not a lot of other stuff you got to do on the server.

09:27 Just G-Unicorn, fire this thing up and maybe point Nginx, put Nginx in front of it.

09:31 Yeah.

09:32 Yeah, definitely.

09:32 I like how it doesn't have a development server either.

09:35 So you have to use...

09:36 I do too.

09:37 Yeah, UVicorn and development.

09:39 And I think that helps beginners that are new to sort of web development conceptually understand

09:44 that, hey, this development server is...

09:47 There's a difference here between this development server and this production server.

09:51 Whereas like with Flask and with Django, where they give you like a development WSGI server

09:56 right out of the box.

09:57 I think it's confusing because a lot of people are like, well, why do I need that?

09:59 Why do I need...

10:00 Why can't I use this instead of G-Unicorn?

10:02 Exactly.

10:03 And they always come with this warning.

10:04 This is not a production server.

10:05 Please don't use this.

10:07 And you're like, okay, well...

10:08 Yeah.

10:08 What if I want to test it like for performance?

10:10 Is it kind of like what I would expect?

10:12 Is it really different?

10:13 Like there's all these things.

10:15 Just like, just make it run what you're going to run in production anyway, right?

10:18 Yeah.

10:18 Yeah, definitely.

10:19 Yeah.

10:19 Pretty cool.

10:20 Okay.

10:20 Well, I think that's a pretty solid case for FastAPI.

10:23 I do think it's probably its biggest parallel competitor type thing is probably Flask.

10:29 You know, a lot of times people are using Django.

10:31 They're trying to do a little bit more than maybe what they're doing with Flask.

10:35 Flask has many, many plugins as well.

10:37 So I don't know.

10:38 What do you think about this?

10:38 Do you see these working together?

10:40 Would you use one instead of the other?

10:42 It's interesting because I think last week, you know, Flask announced their 2.0.

10:46 Yes, they did.

10:46 Another 2.0 is going to have some async and await support.

10:49 That'll be interesting because like the entire Flask, part of the power behind Flask is the ecosystem.

10:54 Like you have just thousands of plugins.

10:56 Some might argue that's like there's too many plugins, but regardless, there's a lot of different

11:00 plugins there.

11:01 And so are they all going to start migrating over and supporting async and await?

11:05 What are they going to do?

11:06 So I think that'll be interesting.

11:08 But I would say there's obviously a lot of comparison type articles between Flask and Fast

11:12 API.

11:13 I don't know.

11:14 Like I try not to get into the either or type thinking and try and think of and in both.

11:18 They're both tools.

11:19 I use all three.

11:20 I like FastAPI for certain things.

11:22 I use Django for other things and I use Flask for other things.

11:25 And so it's just all about like the tool, having the right tool for the job.

11:29 Yeah.

11:29 Yeah.

11:30 I would say that FastAPI is more similar to Flask than obviously is Django.

11:35 And so it's probably going to be compared more to Flask.

11:37 But I still think that there's like certain reasons that I would probably use Flask over

11:41 FastAPI.

11:42 Sure.

11:43 That may well be because one of the plugins that you're talking about exactly nails the use

11:47 case.

11:47 Yeah.

11:47 And I'm also going to have David and Phil on to talk about the Flask 2.0 release pretty

11:53 soon.

11:53 So that's, I think there's been this sort of like leapfrog thing is probably going to put

11:58 Flask back, if not ahead of FastAPI and some of the cool features, it'll bring a lot of those

12:02 features over, I would expect.

12:03 It's also worth pointing out that like in Flask, you can still do cool stuff with say Pydantic,

12:08 right?

12:09 You just need one extra line of code.

12:10 The very first line of your API method could just be model equals Pydantic thing, star,

12:16 star, request, dot, get form or whatever the call is to get the form data that's been posted

12:21 over or get the JSON data that's been posted over and then just run with it the same.

12:25 Yeah.

12:25 Yeah.

12:26 And there's a nice like Flask Pydantic plugin as well.

12:28 So yeah, you can definitely use Pydantic inside of Flask.

12:32 And then there's also like Flask Res X, which will give you nice open API slash Swagger type

12:37 support as well.

12:38 So if you want that out of the box.

12:39 Interesting.

12:40 Okay.

12:40 And a lot of this is awareness, right?

12:43 Like knowing, oh, there's this thing that I can go get, right?

12:45 Knowing that I could get Flask Pydantic or the open API, so on.

12:50 And that brings us to our main topic here.

12:52 How do you discover these things and know that they're out there, right?

12:56 It turns out there's actually a bunch of extension type libraries for FastAPI.

13:02 I don't know there's an official plugin model for FastAPI, but certainly things built to make

13:06 FastAPI better and add functionality to it, right?

13:09 And so I learned about a lot of them from your awesome FastAPI list.

13:13 But maybe just for a minute, for people who are not aware of this whole trend of awesome

13:18 lists, maybe just talk about awesome lists for us a little bit.

13:22 Like what's the story?

13:23 Where do these things come from?

13:24 Yeah, I can't remember exactly when they started popping up.

13:26 I feel like maybe like five years ago, something like that.

13:29 But I mean, awesome lists is, I guess, just literally just a list of awesome things.

13:33 In theory, it's contributed, maintained by the community.

13:36 I mean, oftentimes what really happens is like the main author becomes like sort of a dictator

13:42 around that, which I think is totally fine.

13:44 But I think there's just, there's thousands of different awesome lists out there.

13:48 And so it's just, you're like a meta, meta awesome, awesome list of awesome lists, you know,

13:54 type thing there.

13:55 So it gets a little crazy.

13:57 It does get super, super meta.

13:59 And it gets very specific as well.

14:01 The one that probably people know best in the Python space is awesome-python.com, which is

14:07 really general, right?

14:08 I mean, there's Flask stuff and FastAPI stuff.

14:10 There's zillions of other areas.

14:13 And then there's all these offshoots like yours around FastAPI and Stump for Flask and

14:17 so on.

14:18 Cool.

14:18 So when did you create your awesome FastAPI?

14:22 It can't be more than two years ago, right?

14:24 Yeah, I would say.

14:26 How long FastAPIs?

14:27 It must be like a year old, I would say.

14:30 I can't remember when we launched the FastAPI course on Test Driven, but it was like right

14:35 around the same time.

14:36 I think the list probably actually came out before that because the first blog posts on

14:40 FastAPI came out in January of 2020.

14:43 So it was definitely after that.

14:44 Yeah, really cool.

14:46 Well, and I think, you know, it's FastAPI being around two years old.

14:49 It takes a little while for these extra libraries to build up around it, right?

14:53 And I definitely think it's gaining momentum.

14:56 It was for the first time it showed up on, I think it was the PSF JetBrains survey for

15:01 2020.

15:01 And I went straight to number three as the most popular web framework.

15:05 It was really quite interesting how popular it, how quickly it became popular.

15:09 To me, it's because it brings together these little pieces, each one that is kind of a neat,

15:15 new modern Python idea, like type hints, like Pydantic, like async and await, all those things.

15:21 And you just bring it all together and wanting to go, yeah, this has all the things that I

15:24 care about.

15:24 This is cool.

15:25 All right.

15:26 So your awesome list is broken down into a bunch of different categories, like third-party

15:30 extensions, and then resources, including, say, a podcast episode like this one, and so on,

15:36 hosting, and so on.

15:39 So what I thought it'd be fun to do is let's just maybe go through some of those sections

15:42 and highlight a couple of the tools or extensions or whatever that are really neat.

15:47 Yeah, that sounds great.

15:49 How about the FastAPI admin for the first one?

15:51 One of the reasons why I did create this is mainly for these third-party extensions for

15:56 listing these.

15:57 I think it's kind of Django packages.org really aggregates them really well for, you know,

16:02 obviously for Django.

16:03 I don't think there is one anymore for Flask.

16:06 The main Flask docs used to have a list, but it just got out of control.

16:09 Yeah.

16:10 But I think one of the powerful things is definitely the ecosystem and like these extensions.

16:14 So I thought like someone's got to like start this, so.

16:17 Fantastic.

16:18 All right.

16:18 So the first one I think is pretty interesting is this FastAPI admin.

16:22 Tell us about this.

16:23 Yeah.

16:23 So, I mean, if you're familiar with Django, like one of the powerful things that you get

16:27 from Django right out of the box is a nice CRUD admin where you can interact with your

16:33 models, your database models in sort of like a CRUD GUI-like fashion.

16:37 And so you can add data, all of sort of the CRUD functionality right out of the box.

16:41 So you don't have to jump into SQL.

16:43 So yeah, this just like mimics sort of that same sort of behavior.

16:46 Very cool.

16:47 Very cool.

16:48 Yeah.

16:48 That's one of the main features of Django that I would see people using it for.

16:52 Yeah.

16:52 So the idea is basically if I want to create users or mess with other tables, like here

16:58 they have products and categories and it's just like a grid type thing to add new ones,

17:03 edit existing ones, right?

17:04 Yeah.

17:04 Yeah.

17:05 It's very straightforward, but yeah, it's not like there's not really too much to say about

17:08 it.

17:08 It's not some super sexy interface or anything like that, but it is like, it just saves a

17:12 lot of time.

17:13 Yeah.

17:13 Like one of the main features of the newer Django 3.2 maybe was that there's now templating

17:18 for its admin stuff to make it look all super cool.

17:20 Yeah.

17:21 But to be honest, I think one of the really important things is to make it easy for people

17:25 to get started.

17:26 And you know, for me, if I had to build a little admin back in thing like this, like, all right,

17:30 well, there's half a day.

17:31 Got to do that to add in.

17:33 But if you're starting new and you're like, okay, I got this page showing, but now I need

17:37 to edit them.

17:37 Oh no.

17:38 Like this is going to be such a pain, right?

17:40 Having something like this, you can just plug in.

17:43 It'd be really helpful to say, oh, actually maybe I will choose FastAPI over a Django

17:48 rest framework, for example, potentially because it might have an admin, right?

17:51 Yeah.

17:52 I think one of the negatives about this, and this is one of the negatives with Django is

17:55 a lot of people use it for stuff that it's not intended to be used for.

17:59 Like they try and create, like, you know, make a consumer facing version of it.

18:03 I think that's partly the impetus for like the templates is to be able to do more stuff

18:07 like that, which I think that is not, then you have to make everyone sort of an admin.

18:11 I think that's a bad practice.

18:12 Yeah.

18:12 It might lead to some problems.

18:14 Yeah.

18:15 Yeah.

18:16 Yeah.

18:17 Joe out there on the live stream says, does this include identity?

18:22 Like, can I get a, I'm guessing a restricted admin backend?

18:26 Yeah.

18:26 I'm not sure.

18:27 We are going to talk about other things that do include identity.

18:30 And I suspect, I don't know, I haven't plugged in, but there's probably some point where you

18:34 write some bit of API endpoint, maybe.

18:38 I don't know.

18:39 There's got to be a way where you restrict access to it.

18:42 Yeah.

18:42 It does have admin secret here.

18:44 Maybe that's it.

18:45 I mean, if it works, I haven't used this particular one.

18:48 I don't use Tortoise in production.

18:50 Last I looked at this, it didn't work with any other ORMs besides Tortoise.

18:55 But I know like the, if it's built similar to the, or designed like the Django ORM, the

18:59 Django ORM doesn't have like a concept of permissions.

19:01 So it's just, it has like a super user.

19:04 And so if you're super user access, you get access to it.

19:06 So there's not really any, I think there's probably maybe some extensions you can use to

19:09 like limit access.

19:10 But yeah.

19:11 Yeah.

19:11 It looks like permission true.

19:13 Maybe there is like a concept of permissions here.

19:15 So I'm thinking there's two places where you can put a little bit of protection here.

19:19 One is this, where you say the URL is slash admin.

19:22 The URL could be slash UUID out of some insane length, right?

19:28 So it's not very guessable.

19:29 Yeah.

19:30 And then this app secret, I suspect is like, what is the secret?

19:33 You know, knock, knock, what's the magic word sort of thing.

19:35 And there's just one login for it.

19:36 But for the right type of app, that's probably good enough.

19:39 Yeah.

19:40 You would definitely want to change that URL in production.

19:41 You don't want the forward slash admin.

19:43 People are just always poking for stuff like that.

19:45 Yeah.

19:46 I don't know if you've ever, yeah, I'm sure you've done it.

19:49 And I don't know if people out there in the audience have ever done this, but if you haven't,

19:52 it's shocking.

19:54 If you go and you just tail the log of your site, like the main request log, you'll just

19:59 see like requests for all sorts of like weird, unrelated stuff.

20:03 People just trying to guess to see if it exists.

20:05 Like there's all sorts of requests for like WP admin.

20:08 Yeah.

20:09 Dot PHP on my site.

20:12 And it's written in Python.

20:13 It has no admin thing like that whatsoever.

20:15 But people are just going, is there this type of, can I get and try a default password against

20:20 a PHP admin backend or try that for a Joomla backend and just start jamming on those things.

20:27 Right.

20:27 And so having that URL, something that's just not default, while it's not a big piece of

20:32 security, it dissuades the bots.

20:34 I think.

20:35 Yeah.

20:35 Yeah.

20:36 Keeps the honest people honest.

20:37 Exactly.

20:38 You want to hack, you got to do it for real.

20:39 Okay.

20:40 Let's talk about authentication.

20:43 There's a whole section on different types of things here, right?

20:45 Yeah.

20:46 So the one that I like the best or the one that I've used the most, I guess I'd say is

20:50 FastAPI users.

20:51 Okay.

20:51 And I think that's the most popular one.

20:54 Yeah.

20:54 Yeah.

20:55 This is it.

20:55 So it uses all, like it uses Jot based auth, but you can also sort of like, you can store

21:00 your Jot wherever you want.

21:01 But this also has like a session, you know, capability built into it where you can store

21:06 the Jot in a cookie.

21:07 Okay.

21:08 Because a lot of times, you know, people are storing Jots and local storage, which could

21:11 lead to XSS type attacks or like open you up to like some.

21:15 Yeah.

21:16 XSS or cross-site script or I always get those mixed up.

21:20 But yeah, I thought that was cool.

21:22 You don't see that a lot in like sort of like libraries that are like Jot based.

21:25 Yeah.

21:25 That's cool.

21:26 Yeah.

21:26 It has either a cookie auth or a Jot auth backend, which is cool.

21:30 And it also supports different ORMs.

21:32 So if you'd like SeekwAlchemy, you can do that.

21:35 If you'd like MongoDB, you can do that.

21:37 Cortis or ORMR, which I haven't actually heard of before, but we'll probably talk about it in

21:42 a minute anyway.

21:42 But yeah, quite neat.

21:44 And also OAuth 2.

21:46 Yeah.

21:46 So this is quite neat.

21:48 If you want to plug it in, it looks like a bunch of people have contributed to it.

21:51 So it looks pretty lively.

21:53 Yeah.

21:53 It's very popular.

21:54 Yeah.

21:54 I mean, one thing people might want to check out is the sneak package advisor.

21:59 Have you seen this?

21:59 Mm-hmm.

22:00 Over here.

22:01 And you can put all sorts of different packages in here.

22:04 So if you're like, ah, this one or that one, you could actually pull it up and have it tell

22:08 you, maybe not always that quickly, the health of the community, like how popular is it?

22:13 How healthy is its maintenance and its security and its sustainability and so on?

22:17 So if you're like, oh, I got these two or three extensions that might be doing the same

22:20 thing, it might be worth throwing into this sneak package advisor and get a sense for like,

22:24 ah, this one seems a little stronger in terms of liveliness.

22:27 Is the popularity score, is it based on similar packages or just like kind of global?

22:31 Yeah.

22:32 That's a good question.

22:33 Because I can't imagine that there'd be a more popular off library for FastAPI.

22:38 I think it's global.

22:40 I'm pretty sure it's like a logarithmic global type thing because yeah, right.

22:45 This is probably the most popular one.

22:46 So what's going to beat it, right?

22:47 But it's only 798 stars relative to like Flask users or something like that.

22:53 Right.

22:53 Yeah.

22:54 Yeah.

22:54 I'd have to look and actually see.

22:55 It does like show you similar packages if you can find, sometimes it'll say, here's some

23:00 other stuff that's like it.

23:01 But anyway, I think that might be something to like bring together with just awesome lists

23:05 in general.

23:05 Right.

23:06 And that's, give me a chance to check these out and see how they're doing.

23:08 You've also got Flask, no, FastAPI login based on Flask login.

23:13 They're both two similar and both words in the same place.

23:16 Yeah.

23:17 Yeah.

23:17 Cloud Auth, which is kind of cool.

23:19 So like using Auth0 or AWS Cognito or things like that.

23:25 If you're doing that anyway, that might be nice.

23:27 Yeah.

23:27 Auth0, they just got bought by somebody.

23:30 I feel like Google or something like that.

23:32 Facebook.

23:32 Yeah.

23:33 I think they might've.

23:34 Yeah.

23:34 I feel like they bought something else and then, you know, little fish, big fish, whale.

23:39 Okta.

23:40 I think Okta just bought them.

23:41 Yes.

23:42 That's right.

23:42 It was Okta.

23:42 That's right.

23:43 Yeah.

23:43 Another one I wanted to throw out there while we're in this section that I don't see here

23:46 and I don't see anything that does this.

23:48 Possibly.

23:49 Let's look at FastAPI security.

23:51 Maybe this one does.

23:52 It's not super documented over there.

23:55 I feel like this throws some of the permissions in there that you would really want, but a place

24:01 called.

24:01 Like OpenAPI type stuff?

24:03 More like the general OWASP stuff.

24:07 If you check out secure, just how did they get this as the modern IPI package name?

24:14 Just the word secure.

24:16 But this one, it doesn't say that it plugs in with FastAPI, but it plugs in with Flask

24:22 and Django and Pyramid and Court and Responder and Starlet.

24:26 And Starlette is the foundation.

24:27 So I think that it would actually.

24:29 And what it does is it does things like it sets all the default header behaviors like that

24:35 the frame, you can't embed somebody else's, your site into somebody else's site.

24:40 And that cross-site scripting protection is set and certain types of cache policies and

24:46 whatnot.

24:46 And just by doing like one line of code over on against it, one or two lines, it'll automatically

24:52 just like wrap every request with one of those.

24:54 So that might also be interesting to think about in this regard.

24:58 Yeah.

24:58 Those headers can get confusing, especially if you're using like a single page application.

25:02 You have to, if you're trying to use cookies or some sort of like session based off or whatever

25:08 at the same time.

25:09 Yeah.

25:09 Like it can get pretty complex on those headers.

25:12 So yeah, that seems like a cool package.

25:13 Yeah.

25:14 And if something new comes out that should be added that you don't pay attention to, but

25:17 you happen to upgrade your package, maybe it'll bring like the new best practice along.

25:21 Right?

25:22 Yeah.

25:22 Okay.

25:22 So that's authentication.

25:23 Databases.

25:24 You have it broken down into ORMs, query builders, ODMs, which is for document databases, but it

25:30 looks like a quick scan that document equal equal MongoDB for the moment here.

25:34 Yeah.

25:35 And then there's other, which like JSON exchange and whatnot.

25:39 Let's talk, let's talk ORMs first.

25:41 Big, like you pointed out, big news for SQLAlchemy, right?

25:44 Yeah.

25:44 SQLAlchemy 1.4.

25:46 It was either last week or the week before.

25:48 The change actually broke FastAPI or actually broke the FLAS course because it requires the

25:54 database URI to have PostgresQL as the name rather than just Postgres.

25:58 And so, you know, that broke the course.

26:00 So a little annoying, but you know.

26:02 Yeah.

26:03 And it broke my courses too.

26:05 It broke one of my FastAPI courses because we were using async.

26:08 We were using the new one, the async one, but then they said, well, you're using a driver

26:12 that doesn't support async.

26:13 So we're going to throw an exception instead of just work more slowly.

26:17 And like, ah, so.

26:18 Yeah.

26:18 Again, you had to put like a separate different driver in there and so on.

26:21 So.

26:22 Yeah.

26:22 Yeah.

26:22 So we find out sometimes the hard way about these releases, but.

26:25 Yeah.

26:25 So what's the big deal with SQLAlchemy?

26:27 And then we got the SQLAlchemy plug in here.

26:30 Yeah.

26:30 Let's see.

26:31 So, I mean, I haven't updated this like for specifically for like anything new with

26:35 SQLAlchemy.

26:36 So yeah, there's that FastAPI SQLAlchemy.

26:38 That'd be interesting to take a look at that one to see if like, have there been any updates

26:42 since SQLAlchemy new one has been released?

26:44 It looks like no.

26:46 Looks like it hasn't been touched yet.

26:47 Yeah.

26:48 So maybe if you're looking to contribute, maybe there's something to be done here because

26:51 SQLAlchemy used to not support async.

26:53 The big thing with the SQLAlchemy 1.4, there's stuff with changes in the API to sort of move

26:58 to something new.

26:59 But the big one that's probably relevant here is SQLAlchemy now as of 1.4 supports

27:05 async and await.

27:05 Like async, await, execute this query type of thing and give me the objects back.

27:11 And you might not care at all about that.

27:13 But if you're using async and await view or API endpoints in FastAPI, but you want to use

27:18 SQLAlchemy, well, there goes your async, right?

27:20 It's gone.

27:21 Because one of the most important things to await upon is the database.

27:24 And so now the new SQLAlchemy has that support.

27:27 And I'm guessing this one, it probably doesn't support that, right?

27:30 Because it just, it didn't exist.

27:31 But yeah, so cool.

27:33 Yeah.

27:33 I'm not exactly sure.

27:34 I'm sure it won't work because the sample right here is exactly the same code I had that

27:38 broke.

27:38 So it's not going to work.

27:40 But it also is very possible to be quickly and easily updatable.

27:44 I don't know.

27:44 But people can check that out.

27:46 I guess another one you've mentioned earlier is Tortoise Aurium.

27:49 I haven't really done anything with Tortoise.

27:50 What's the story?

27:51 Like databases are supposed to be fast and here's the turtle going on.

27:54 Yeah.

27:57 I mean, naming is tough, right?

27:58 Exactly.

28:00 I would say like Tortoise is probably the most popular one or like just the one that I've

28:05 like seen the most use out of in terms of seeing a lot of FastAPI projects.

28:09 And so, yeah, I think Tortoise is one that's like leveraged a lot.

28:12 Honestly, people use SQLAlchemy probably more than anything else.

28:16 And they just like don't deal with async type stuff.

28:18 But if you want async await, then yeah, I mean, Tortoise definitely has quite a bit of

28:22 support there.

28:23 Yeah.

28:23 You've got Honi ORM, Tortoise ORM, PeeWee.

28:27 I know PeeWee has an async version.

28:28 I know the Django people are working on an async ORM story, but it's not there yet.

28:34 SQLAlchemy just got it.

28:35 One of the things I like about this is they put just what seems like a pretty fair graph

28:41 comparing all the different ORMs in terms of performance.

28:44 And Tortoise ORM comes up pretty nice on like single inserts and the whole updates.

28:50 But there's also places where it's slower than other stuff.

28:53 And they're just like, we're going to put it all up there and if you find it useful,

28:55 here's what you get.

28:56 And Tortoise is similar to the Django ORM in the sense that it uses an active record type

29:01 approach, more similar to PeeWee.

29:03 Whereas SQLAlchemy uses the Data Mapper approach, I believe.

29:07 Yeah.

29:07 The unit of work style.

29:08 Yeah.

29:09 Yeah.

29:09 Yeah.

29:10 And that's confusing for people because you've got to create the session, then you do all the

29:13 stuff and then you call commit if you want to make changes.

29:15 And it's not that hard to deal with, but it is one of those things.

29:19 You're just like, why?

29:19 Where do I get a hold of the session?

29:21 If I got a hold of the objects and I want to update it, like I do find the active record

29:24 stuff for simple cases, pretty handy.

29:26 Right.

29:27 And it comes from Django as well in that style.

29:29 Yeah.

29:30 So it'd be real familiar.

29:31 Yeah.

29:32 Yeah.

29:32 Very cool.

29:33 Joe also out there says, what's the most popular database to use with FastAPI?

29:37 Postgres, ExpressJS, Mongo maybe is like another example of a pairing.

29:43 Yeah.

29:43 I would say Postgres.

29:44 Yeah.

29:45 I think generally speaking, you're talking Python, it's Postgres if you're relational,

29:49 MongoDB if you're not.

29:50 That seems to be like the story.

29:52 The important thing here is that you may care about async and await.

29:56 So then that limits the way in which you can talk to the things, but both Postgres and MongoDB

30:00 have really good async stories.

30:02 So I think that still holds for FastAPI.

30:04 Does SQLite have any sort, like, I don't know if you know this offhand, if SQLite has any

30:09 sort of async support?

30:10 It doesn't, I don't think the real way you access it has important behaviors that are

30:15 any different, but there's a new driver that allows it to integrate with an async event

30:21 loop, asyncio event loop.

30:22 So it won't block the loop, but basically it just means there's another thread waiting and

30:26 you won't get like true scalability, but at least like you're waiting on a query here

30:30 and an external API there, they can both happen at the same time.

30:33 But if you have a bunch of database calls, I think it just queues up.

30:36 Yeah.

30:36 Cool.

30:37 All right.

30:38 So Portis Orem, useful because down here somewhere we probably have an await, I'm guessing.

30:44 Oh, here's the, you asked about the SQLite.

30:46 Here's the SQLite library.

30:47 AIO SQLite is the one that Mike Bayer was recommending.

30:51 Yeah.

30:51 But down here you can do, you know, await, create object, await, filter, object.first,

30:57 exactly what you want for simple access to those APIs.

31:01 Yeah.

31:02 I mean, if you're just doing like a quick select or delete or whatever it is, you're probably

31:06 not going to get any sort of performance boost.

31:07 But if you're doing for whatever reason, if you're doing a lot of different queries in

31:10 a route handler that are not dependent on each other, or if you're like, you're doing more

31:14 than one query that is very expensive.

31:17 Yeah.

31:17 That's also not dependent on each other.

31:18 Then you might get a performance boost like this.

31:20 Basically the worse your database is, the better.

31:23 Yeah, there you go.

31:26 The more of a benefit you're going to get.

31:27 Because async await is all about scaling, weighting, and latency.

31:31 So the more latency your database has, because you're doing slow queries or it's like cloud

31:37 and far away or whatever, you're going to benefit.

31:38 But if it's a one millisecond response time, who knows?

31:42 All right.

31:42 You also mentioned Gino, G-I-N-O.

31:44 This is like literally the first time I'm seeing it.

31:47 What is this?

31:47 Yeah.

31:47 So Gino is from what I understand, it's more of like a full ecosystem.

31:52 Okay.

31:53 So Gino is not ORM, it's like asynchronous ORM.

31:57 So, but yeah, I mean, it is an ORM, but it also like, I believe there's a generator in

32:02 here where you can build like a scaffold out an entire like FastAPI app, sort of like based

32:08 on your models.

32:09 Yeah.

32:09 Interesting.

32:10 Similar to like how the Rails like skeleton command works.

32:13 I don't know if you're familiar with that at all.

32:14 You can like scaffold out like a quick CRUD app.

32:16 Okay, cool.

32:17 And it's one of these recursive acronyms.

32:19 Yeah, it is.

32:20 Yeah.

32:20 It talks about having an async API on top of SQLAlchemy.

32:23 I wonder how much importance that will have these days.

32:26 But yeah, it sounds like it has other stuff.

32:28 Like you talked about the whole community and stuff.

32:30 So very cool.

32:31 What else is in here that we should talk about?

32:34 There's a couple other ORMs people can look at.

32:36 Query builders.

32:37 I've used databases quite a bit.

32:39 Okay.

32:39 One difficult thing about databases is Googling.

32:42 It is like, if you try and Google any sort of like errors around databases, it's, you

32:46 know, like knows what's going to come up.

32:48 But yeah, I mean, this is like one that's...

32:50 Was this originally done by Kenneth Wright and then handed off?

32:53 Or is this different?

32:54 You know, I'm not sure.

32:55 I think it's by the same team that does Starlet.

32:58 Yeah.

32:59 Yeah.

32:59 Yeah.

32:59 Tom Christie.

33:00 That's escaped me there.

33:01 Yeah.

33:01 Yeah.

33:02 Yeah.

33:02 Definitely.

33:02 Cool.

33:03 He does a lot of stuff.

33:04 Yeah.

33:05 That guy's busy.

33:05 I've had him on the show before.

33:06 He's definitely a busy guy.

33:08 That's awesome.

33:08 Cool.

33:09 So it's like a wrapper around SQLAlchemy core that then will give you back proper queries

33:14 and stuff like that.

33:14 Yeah.

33:15 Nice.

33:16 Okay.

33:16 ODMs.

33:17 Just really quick mentions.

33:19 Since I was recently talking about Beanie on Python Bytes.

33:22 Beanie is kind of cool.

33:23 It's an async way to talk to MongoDB, an ODM, object document mapper, because there's no

33:29 relations.

33:30 Not really.

33:30 But what's interesting about that is it's one, it has an async option.

33:34 And two, it's all about Pydantic.

33:35 So you're normally you'd have like Django models or SQLAlchemy models.

33:39 Like the models are Pydantic models that go to and from the database, which has an interesting

33:44 possibility for integration back into the like return types and stuff that you would

33:48 have, say for a FastAPI.

33:50 So anyway, that's if you're into it, that's potentially worth checking out.

33:54 It's based on Motor, which is the MongoDB official async driver for Python.

33:58 Yeah.

33:58 The PR for that one came out, I think last week and I heard about it maybe the week before.

34:03 So I don't know if that's like a new library, Beanie, but.

34:05 Yeah.

34:06 It's quite new because I was talking to Roman Reyes.

34:09 This is a guy who created this and when he did some stuff on it, I talked about how

34:13 I thought it was really cool to be using Pydantic models and types, but it needs indexes.

34:17 And so he actually went and put a whole mechanism in for doing indexes.

34:22 I got to check them out.

34:23 I guess that's just the example, but whole way in which you can put indexes in your models

34:27 and stuff.

34:28 Yeah.

34:28 MongoDB index is perfect.

34:29 So pretty cool that it has that stuff built in.

34:32 And yeah, it looks like it's coming on strong.

34:35 So maybe that's a good one.

34:36 Mongo engine is actually what I use over at Talk Python, but I don't believe it.

34:38 I don't believe it's async.

34:39 I have suspicions that will never be async.

34:41 It's super, super involved and it doesn't seem to be changing real quickly.

34:45 So I'm guessing that that's kind of where it is.

34:47 Have you checked out this Pydantic SQLAlchemy?

34:49 Pydantic to SQLAlchemy?

34:51 I haven't, no.

34:52 Tools to convert SQLAlchemy models to Pydantic models.

34:55 Like I just talked about the benefits of having your database models be Pydantic so they can

34:59 be on the boundaries, right?

35:00 Yeah.

35:01 And maybe this is just like a way to sort of map those over.

35:03 That's kind of cool.

35:04 Yeah, that is cool.

35:05 I did.

35:05 When I looked at this earlier, one thing I wasn't psyched about, I'd be interested to hear your

35:09 thoughts on this, Michael.

35:10 The way that it does this is at runtime, right?

35:13 So the way you get your SQLAlchemy model, you say, now I'm going to create a Pydantic

35:17 user from my user by passing it to a function that does probably magic metaprogramming and

35:22 boom, out comes this type Pydantic user, right?

35:25 And that's cool.

35:25 But one thing I don't like about that style is the editors can't be very smart about helping

35:32 you, right?

35:32 Like it doesn't know what the heck a Pydantic user can do or can be or autocomplete and

35:37 all that sort of stuff.

35:38 So I feel like a lot of these sort of runtime converter things, I don't know.

35:43 They let the good editors like PyCharm and VS Code down.

35:46 What do you think?

35:46 Yeah.

35:47 I mean, is there a way to look at what it'll convert that down to?

35:50 It'd be great if you could get it to like spit out.

35:52 Yeah.

35:53 The actual model.

35:54 A code file.

35:55 You run this one time and then you're like, we're good.

35:57 Yeah.

35:58 We're good.

35:58 I just want a way to go from 20 SQLAlchemy models to 20 Pydantic models and then I'm

36:03 going to save that code and go with it or something like that would be cool.

36:06 But I didn't know.

36:07 It must be cached sort of at some point.

36:09 So.

36:09 Yeah.

36:10 Yeah.

36:11 That's interesting.

36:11 Yeah.

36:12 I do think it's really powerful though, but it's just like, yeah, it's a little tricky

36:15 to get help with what you're supposed to do.

36:16 Right.

36:16 Because otherwise you have two different like model concepts.

36:19 Like you have your model, like your database model, which is SQLAlchemy.

36:22 And then you have like sort of like your model, which is more of like a schema.

36:24 Yeah.

36:25 But Pydantic calls them models.

36:26 And so like in my FastAPI code, I call them schemas.

36:31 So I have like a schemas.py file.

36:32 And then I have a models.py file, which is the flask.

36:35 Sorry.

36:35 I keep saying flask.

36:36 But the.

36:37 I know.

36:38 I was doing it too.

36:39 It's so hard because they're the same size word and they play a very similar role.

36:42 Yeah.

36:42 Yeah.

36:43 Yeah.

36:43 Are they sponsoring this?

36:46 Yeah.

36:48 Just having them combined together, like would make sense.

36:51 But yeah, I get what you're saying about like, you don't know exactly what that is.

36:54 Like until like at runtime.

36:55 Yeah.

36:56 If I go to one of those and say dot, it's like, it gives me nothing.

36:59 Right.

37:00 Yeah.

37:00 Yeah.

37:01 Cool.

37:01 Yeah.

37:01 So Joe out there in the live stream says, what would you recommend as a DB driver instead

37:05 of psycho PG two for Postgres and FastAPI?

37:08 You got a recommendation?

37:10 Well, like if you're using synchronous, you want to go psycho PG two, obviously.

37:13 But if you're using the async, then it's going to be async PG.

37:15 Yeah.

37:16 So there's a separate async one.

37:18 Very cool.

37:18 All right.

37:19 Let's talk about, did I just bag on code generators?

37:21 Let's talk about code generators.

37:22 Okay.

37:24 Because they are valuable.

37:25 One of the things that's super cool, like here I have a, here's a little site I built for

37:30 a course, weather.talkpython.fm that lets you go and enter a city and it'll tell you literally

37:35 the real weather right now.

37:36 Like for now in Portland, it's broken clouds within like a few moments.

37:40 Right.

37:40 That's cool.

37:41 And one of the things that's really nice though, with all these things is you can go to slash

37:44 docs and you get this cool documentation thing.

37:47 And that's just where like your Pydantic model kicks in for the JSON schema response and

37:52 all those cool things.

37:53 Right.

37:53 So that's just FastAPI.

37:55 That's amazing.

37:55 But the next thing is the FastAPI code generator.

37:58 Right.

37:59 So this takes an open API file and then it'll scaffold out your FastAPI app based on that.

38:04 And so does that do all like the Pydantic models and whatnot?

38:07 I'm not sure if it does.

38:09 Or does it just do the endpoints?

38:11 It seems like it.

38:12 It says the response model is pets.

38:13 I think so.

38:14 From the models import pets.

38:16 Yeah.

38:16 Yeah.

38:16 So you pointed at that documentation, that slash docs that I was just talking about.

38:20 And you say, here's some API specification.

38:23 I want a FastAPI server implementation of that.

38:25 Boom.

38:26 And you get it, right?

38:27 So you can sort of do like the document driven development.

38:30 So then if you want to change your API, you change the open API doc.

38:34 Exactly.

38:34 Yeah.

38:35 You can see right here, it is actually generating the Pydantic models and even the errors that

38:40 it throws and so on.

38:40 This is super cool.

38:41 It even has support for say optional strings and default values versus non-optional strings.

38:46 I like it.

38:47 That's cool.

38:47 I'm not sure I would use it because I don't find myself in a situation where I have that

38:51 a lot.

38:51 But if you wanted to do it, it seems like it would be really cool to have.

38:54 All right.

38:55 Related to that is the other side of the story.

38:58 I want to talk to an existing FastAPI.

39:00 Probably this would work for any open API thing, I would guess.

39:04 But it says it's for FastAPI.

39:07 So generate a mypy and IDE friendly API client from an open API spec.

39:12 This looks cool.

39:13 Let's see some examples down here.

39:15 It both supports async and synchronous clients.

39:17 And I'm guessing it's using the similar example model because we have a pet here as well.

39:23 So it generates the model, the Pydantic model that you're going to exchange with the server

39:26 and all sorts of stuff.

39:27 This is cool.

39:28 So what does this generate exactly?

39:30 It's generating a client library to interact with the API?

39:32 Yeah.

39:33 So instead of using requests to call the API and just putting bare dictionaries, it will

39:39 actually generate the Pydantic models and it'll give you the API endpoints as functions instead

39:45 of just request this URL.

39:46 Nice.

39:47 Does that give you like Sphinx documentation and all that too?

39:50 I have no idea.

39:52 That would be cool.

39:53 Yeah.

39:54 It's super cool though.

39:55 It shows you how to basically take all that stuff and generate those.

39:58 And it does say that it generates IDE friendly ones.

40:01 So it must export those and not do it at runtime, which, you know, those pet, you can see right

40:06 here, like from client.models import pet.

40:08 So it generates the Python files and then you consume them instead of at runtime so that you

40:13 get like autocomplete and type check in and all that.

40:16 That's cool.

40:16 Yeah.

40:16 Teddy out here on the live stream says, what use case would you use FastAPI versus say Django

40:23 REST framework?

40:24 It's kind of hard to compare the two.

40:25 I mean, if you're already using Django, then yeah, obviously go with Django REST framework.

40:29 But yeah, in terms of Django plus Django REST framework versus FastAPI, as always, it depends.

40:36 It just depends on what you're doing.

40:37 It depends on the size of the API.

40:39 It depends on if you need authentication.

40:40 It depends if you want like the CRUD admin, you know, type stuff.

40:44 It depends on what tools you're going to be using to consume the API.

40:48 You know, if you want something that's tried and true and battle tested, I would go with Django

40:52 and Django REST framework.

40:52 If you want to play around with the new hotness and take advantage of, you know, you sync and await

40:57 and all the cool stuff that's coming out, then maybe check out FastAPI.

41:01 Yeah, I would certainly say if you already have Django and you're already using it and

41:06 just want to plug into the same app and just keep rolling, probably just Django REST framework,

41:10 right?

41:10 Unless you really want to commit to having multiple apps that you run separately and I don't

41:14 know, put behind Nginx through URL routing or something like that.

41:17 Also, you know, how much of the FastAPI features are you going to use, right?

41:21 If you don't care about async and await and you don't care about the typing very much and

41:25 you don't care about the documentation, like, well, then it kind of comes down.

41:28 But if like all of those things are super important to you, maybe breaking that out matters.

41:32 I don't know.

41:32 That's kind of my thought as well.

41:33 Yeah.

41:34 Also, Galvin Haas asks, best JS front-end framework for FastAPI?

41:38 I mean, it's kind of open, right?

41:39 But is there anything that stands out as better?

41:42 No.

41:43 I mean, it works well with Vue, React, Angular.

41:46 Vue.js because it's Vue.js.

41:48 Cool.

41:51 All right.

41:51 Another one here I want to talk about that's super neat is FastAPI Profiler.

41:55 This looks really cool.

41:56 So it's middleware.

41:57 I mean, Ian, you're the Django expert, certainly for the two of us here.

42:01 Tell me how it works.

42:02 I know in Pyramid, there's a debug toolbar you can turn on.

42:06 And then one of the parts of that is show me the profile.

42:08 Like when I request this page, where was my time spent?

42:12 Show me my SQLAlchemy queries actually interlaced in there and so on, which is super cool.

42:16 Django has something like that, right?

42:17 Yeah.

42:17 Django has Django debug toolbar.

42:19 Yeah.

42:19 You had said it does.

42:20 Basically, that works with your service side templating to figure out with that specific template or with that specific route, how many different queries did it take to load this view?

42:30 Right.

42:30 Find if you got the N plus one problem because you passed this thing and then you're all over touching the lazy loaded properties over and over and over.

42:38 Something like that, right?

42:39 It's not going to detect N plus one issues for you, but you should be able to see them.

42:43 Yeah.

42:43 If you're like, why do I have a hundred queries on this page instead of two?

42:46 Like that should jump out at you, right?

42:49 Yeah.

42:49 Yeah.

42:50 So this is, I'm guessing like that.

42:52 Yeah.

42:53 I wonder where the output prints out at because like with FastAPI, I usually don't have the server side templating with it.

42:58 So.

42:58 Exactly.

42:59 By default, you don't.

43:00 Is this like just print out to the terminal or.

43:02 Yeah.

43:02 It's worth pointing out that FastAPI does support Jinja.

43:05 Yeah.

43:05 But you got to do a little extra work to make it do it.

43:08 So it says, this is really like a leveraging PI instrument from Joe Rick.

43:12 And if you scroll down over on their repo, on his repo, there's a bunch of cool output.

43:17 I think it might even open up.

43:20 I don't know.

43:21 I'm not sure exactly where it goes.

43:22 It might.

43:22 I think it saves it to like a profile file.

43:24 So you get this like cool little view of like the profile output here.

43:28 Even there's like a terminal version, which is, I don't know, like a rich colored terminal version.

43:33 But there's a bunch of cool graphs and stuff you can get.

43:36 There's a, I think I saw in here somewhere you can open up some kind of like flame graph as well.

43:41 Oh, that's cool.

43:42 Yeah.

43:42 You can dig into it.

43:43 So basically anything you can do with PI instrument.

43:46 I think this is just a middleware wrapper that generates PI instrument stuff for you, which is, that's pretty cool.

43:53 Yeah.

43:53 A lot of stuff is super powerful.

43:54 Like you could probably take some of that stuff and tie it into your integration type test to ensure that, hey, like I built this route.

44:01 This view takes X amount of time.

44:03 And like, you know, now I want to throw junior developer on my code.

44:06 I want to make sure, hey, there's not like any performance loss.

44:09 And you can like use like some stuff like that to make sure that the number of queries don't all of a sudden triple.

44:15 Like the load time doesn't all of a sudden triple stuff like that.

44:19 So tying like that stuff into your test suite is like super powerful.

44:23 I do that with, there's a library called N plus one that does that very same thing.

44:26 Oh, interesting.

44:27 Yeah.

44:27 Yeah.

44:28 Very cool.

44:28 Nice.

44:29 Heard of it.

44:29 I haven't used it.

44:30 Another one I think that stands out is pretty interesting is FastAPI mail.

44:34 I mean, boring, but sending mail is one of those things that can take forever.

44:37 Like I had one of these admin parts of my site.

44:41 I had a way to like send an email to all the people in this class.

44:44 Go 20 seconds, 30 seconds timed out.

44:47 And it was going to like thousands of people.

44:50 And the problem was it had sent hundreds of emails and then it timed out.

44:55 So how do I resend that without sending a duplicate to the first half?

44:59 Right.

45:00 Maintaining the state there.

45:01 Yeah.

45:01 Yeah.

45:02 And like, I don't really, like, it's really hard to go back to figure out everyone who got it, but not.

45:06 Anyway, it was a huge pain.

45:07 And I'm like, okay, sending a lot of emails kind of sucks.

45:09 And so this one FastAPI mail is cool because email is one of those things that's like dreadfully slow.

45:16 And this allows you to asynchronously send email messages in a super simple way.

45:20 So you're not using like SendGrid or SES or anything to?

45:23 At the time, I was using SES at the time.

45:26 Yeah.

45:26 Okay.

45:27 Okay.

45:27 But I was doing it instead of like doing a bulk send.

45:30 Yeah.

45:30 I said, this is a customized email to that person.

45:33 This is a customized email to that person.

45:34 And like, I mean, it's fine if I even just set the timeout limit longer or whatever.

45:38 It would have been fine.

45:39 What I ended up doing is just putting that in a background queue and just let it go.

45:43 Like that's how it should have been.

45:44 It shouldn't have been as part of the request, but I learned the hard way the first time around.

45:48 I use Celery for that same exact thing.

45:50 I mean, that just goes right to queue.

45:51 Yeah.

45:51 Perfect.

45:52 Yeah.

45:52 So this one has an async.

45:54 This makes, I mean, like you said, doing bulk sending on some kind of background thing is

45:59 exactly what you should do.

46:00 But if you're trying to not block your processing and you want to send an email, just one, like,

46:05 Hey, reset my password, right?

46:06 That could be a thing you could just do right away.

46:08 And so here's a way to await sending emails, which is kind of cool.

46:11 Yeah.

46:12 If you don't really care too much about what happens to the email, like if you're not too

46:16 concerned about, Hey, if this doesn't get delivered, it's not a huge deal.

46:18 I'd say like something like this is fine.

46:20 If it's more like, you know, there's like any sort of like workflow based on what could

46:24 happen there, like success, failure, that sort of thing.

46:27 Like if then this, that type stuff.

46:29 Yeah.

46:29 You want to probably look more like towards salary, I would say, but I still think like,

46:33 if you want to send like just a simple one-off email, maybe it's even to yourself or something

46:36 like that.

46:37 I do this like with FastAPI mails.

46:39 I send myself notifications based on events and like, I don't necessarily need them.

46:44 Like, you know, I'm not curing cancer here.

46:46 So if I don't get it, I don't care.

46:47 Yeah.

46:48 I have the same thing.

46:49 I'll just shoot myself messages like, Oh, here's the thing you should probably know about

46:52 that happened.

46:52 Very cool.

46:53 Yeah.

46:53 I have moved to SendGrid last month or two and really like it.

46:57 I don't think that's so big.

46:58 Yeah.

46:58 Come back to normal size.

47:00 So let's see, what else have we got here?

47:02 That's interesting.

47:03 Then we got the obligatory utils.

47:06 The catch all right.

47:07 Everything.

47:08 Yeah.

47:08 Well named helpers.py.

47:10 Exactly.

47:12 So we got socket IO stuff, plugins, pagination.

47:15 One I do, two that I'll call quick attention to that I think is our Nate in here.

47:20 Not, this is not an endorsement or saying I would use it, but I think I can see a real

47:24 interesting use case.

47:24 First, the cache one.

47:25 Yeah.

47:26 Maybe tell us about this cache one here.

47:27 Yeah.

47:28 So I haven't used this one exactly, but it looks like, yeah, it just is probably going

47:32 to probably cache at the route handler level.

47:35 And it looks like it's caching the response based on the request parameters inside of Redis.

47:41 Yeah.

47:41 You know, it's the one thing that's interesting here that it actually does that I haven't

47:45 seen in any of these examples yet, but it's certainly a FastAPI thing is it uses dependency

47:49 injection for the cache.

47:51 Yeah.

47:51 Right.

47:51 So they've got a view method here or API endpoint, I guess, called hello.

47:56 And then one of the parameters is cache of type Redis cache backend equals the default

48:01 values depends on Redis cache.

48:03 So it goes and finds the one instance of that and hands it off.

48:06 And then it's just like standard Redis value type thing.

48:10 Like a wait, get the thing.

48:12 The thing's not there.

48:13 A wait, set the thing, you know, pretty standard, but it's kind of cool.

48:17 It was just the simple integration.

48:18 Yeah.

48:18 Like dependency injection, I think is a, it's a pretty difficult concept if you look at it

48:23 from a theoretical standpoint, but it's just like this object here is just taking this other

48:29 object at runtime, you know, essentially.

48:31 So it's, yeah, yeah.

48:32 It's just a way to like sort of split apart sort of your dependencies and it makes testing

48:36 a whole lot easier.

48:37 So you don't have to have like mocks all over the place.

48:39 So you can just switch out like the Redis cache for like in memory cache or, you know,

48:43 something like that.

48:44 Yeah.

48:44 If you could pass in anything that has a get and a set, you're good.

48:47 Right?

48:48 Yeah.

48:50 I think because of dependency injection, FastAPI, like you don't necessarily have to leverage

48:55 it, but I think that if you are, it does take a little, like you have to be a little bit

48:59 more of a seasoned developer, I'd say than someone that's just picking up Flask.

49:02 Yeah.

49:03 I totally agree about that.

49:04 Dependency injection is one of those things.

49:05 It's like, Oh, this is really cool.

49:06 And it makes things simpler.

49:07 And why is it so complicated?

49:09 What just happened?

49:10 You know?

49:11 And I'm thinking more of like.

49:12 Although I don't know when you start looking at Flask global objects.

49:15 Yeah.

49:15 Yeah.

49:15 Yeah.

49:16 Yeah.

49:16 That's complex.

49:18 That's true.

49:18 I'm thinking more of like the static languages like Java or C#, where you've got an

49:22 I and I and interface one of these, and then a bunch of those registered.

49:26 And then like, which one did it actually like, what concrete type am I even working with?

49:29 Like, like it can get, I don't know.

49:31 People can over pattern it, I guess.

49:33 All right.

49:33 Speaking of not over pattern it, let's check this out.

49:35 So I was talking at the Python at the San Francisco Python meetup last night.

49:40 Someone asked me, Hey, is there a way in FastAPI to just like, no, this was my office hours

49:46 same day though.

49:47 And also video meeting.

49:48 Anyway, somebody said, can I just take a database and make it like an API?

49:52 Yes.

49:53 This FastAPI dash CRUD router.

49:56 It sounds amazing, right?

49:57 So basically what you do is you tell it your models and the schemas, and then it just creates

50:04 all these API endpoints to do restful things to that table through the model.

50:09 So I have a get slash potato, like potato was the model, get slash potato that'll list

50:14 them all.

50:14 Post a potato to slash potato will create one, delete a potato, we'll get rid of all of them,

50:21 delete potato slash ID will delete that one and so on.

50:24 So it just turns this into basically a series of FastAPI endpoints that are all the restful

50:31 behaviors against your schemas.

50:33 What do you think?

50:33 You don't see it delete all very often.

50:35 Nope.

50:36 A little Bobby table.

50:36 I wonder if this is how Gino might be leveraging something similar to this.

50:40 Yeah.

50:40 To me, this feels overexposed.

50:43 But if it's like something simple, something internal, probably, maybe it makes sense to

50:48 just go like, I just need to do that.

50:50 But from JavaScript, we just turn that on.

50:52 But like I said, I probably would not turn that on because it scares me.

50:55 Let's see rate limiting.

50:57 There's a couple of rate limiting things that are cool here.

50:59 Slow API.

51:01 And then what was the other one?

51:03 FastAPI limiter.

51:04 Those are cool.

51:04 And that's pretty much it for the standard docs, right?

51:08 Or standard extensions.

51:09 And we've got the documentation.

51:10 We've got some external resources, like some of the things that you have over at Test Driven.

51:15 The podcasts that you mentioned are somehow someone linked the Python bytes thing I had

51:20 with Sebastian, I believe.

51:21 I'm starting to get to the point with this awesome list where it's like, I'm going to probably

51:25 have to like curate the tutorials a little bit more because there's so many like new tutorials.

51:29 Like when I started this, there were like three or four tutorials.

51:32 And now, you know, there's like hundreds of them just based on the popularity of the framework.

51:37 So getting a little bit smarter with curating the tutorials, like because you don't need 15

51:42 different tutorials, like showing how to build a CRUD app, you know, that sort of thing.

51:45 I did find this FastAPI for Flask users super helpful because what it does, it says, you want

51:51 to do this in Flask.

51:52 Here's the FastAPI version.

51:54 You want to do this in Flask.

51:55 Here's the FastAPI version.

51:56 And it just does like simple stuff.

51:58 Like I want to, let me see if I can find some examples.

52:00 I want to create a method that does post.

52:03 Here's what it looks like there.

52:04 Here's what it looks like in FastAPI and just side by side sort of a cookbook type of thing.

52:09 I like that a lot.

52:10 So yeah, that's a good one.

52:11 All right.

52:12 We're just out a few moments left.

52:14 I don't think we have time to go through all the tutorials.

52:16 And honestly, I haven't researched them enough to talk about it.

52:18 A couple of talks, which is cool.

52:20 A couple of videos.

52:21 Well, I'm sure there's probably some more out there on the internet that could overwhelm your

52:25 list at this point.

52:26 Courses, you and I, we've got to lock on it.

52:28 Yeah, I recognize a few of those names, right?

52:31 Tell us about the courses.

52:32 Exactly, man.

52:34 There's three courses.

52:35 And now let's talk about yours first.

52:37 Yeah.

52:37 So my course focuses on building just a RESTful API.

52:41 It also focuses on heavily, obviously, on test-driven development.

52:45 I also focus on code formatting type tools like Black and Playgate and stuff like that.

52:52 And so I also go into CI, you know, CD with GitHub Actions.

52:55 And then everything is Dockerized.

52:57 And then you also deploy it to Heroku.

52:58 Yeah, super cool.

53:00 And I saw that both you and I are also sponsors of the FastAPI project in GitHub, which is

53:05 pretty cool.

53:05 Yeah, you're gold.

53:06 I'm silver.

53:06 I assume you donate a few more bucks a month then.

53:09 I guess so.

53:10 I guess so.

53:11 But yeah, how does that work?

53:12 Here's the thing.

53:13 I don't call it out to like say, oh, look how cool we are.

53:15 I mean, I do see it on the screen here, which sort of brought it to mind.

53:17 But there's so many companies out there who are building major parts of their businesses

53:22 on top of FastAPI and other projects.

53:25 Like GitHub has such a simple way to go press the sponsor button, support those things and

53:29 make sure they have a nice, vibrant ecosystem, people backing them.

53:34 You know, if we can do it, surely.

53:35 Bank of America, Chase, Microsoft, Google, get in there.

53:40 Anyway, that was more my pitch there.

53:43 Yeah, I think more companies need to like sort of call that just the cost of doing business.

53:48 It's like we're resting on the shoulders of all these giants.

53:50 Like we have this other remote team over here that we know nothing about.

53:54 And yet we're leveraging, you know, this team.

53:56 And not all projects are like curated or maintained by Google and Facebook either.

54:00 And so, yeah, I think it's I'm not trying to like push this in people's face.

54:04 Like, hey, I'm better than you.

54:05 I'm just trying to say, hey, if I can do this, then yeah, I think a lot of companies should

54:10 be thinking more and more about doing stuff like this.

54:12 I totally agree.

54:14 I think they should definitely see.

54:16 We critically depend upon these technologies.

54:18 Let's make sure that we do a little bit to support them.

54:20 Yeah.

54:21 Because a little bit for a lot of these companies would dramatically change it, right?

54:24 If if Flask got two million dollars a year, that would fundamentally change that organization.

54:29 And yet, given how many people use it, it would be nothing to the companies.

54:33 And like it wouldn't even show up almost.

54:35 Right.

54:35 So I know there's a lot of complexity about how companies justify money and where it goes on

54:40 the balance sheet and all that.

54:41 But still, people encourage your companies to do stuff like that.

54:43 All right.

54:44 So this is a really cool course.

54:45 I love the Docker angle of it as well.

54:48 So nice.

54:49 Test driven.

54:49 How's that work?

54:50 What's the story with that part?

54:52 Test driven development?

54:53 Like we're like the site?

54:54 No, I mean, just like, like, how's that plug in with like FastAPI?

54:57 Like, are you doing like this dependency injection type stuff?

54:59 I show I show like I show both like sort of ways how to do tests.

55:03 Like I show like how to mock everything.

55:05 So if you want to like speed like your tests up, but I don't actually go into like all the

55:08 dependency injection type stuff with the ORM.

55:11 It's a little bit too complex, I would say, especially with how Tortoise is set up.

55:15 But yeah, I showed basically two different types of tests.

55:18 Like you can test it sort of like integration, you know, style where it's actually hitting the

55:23 database or like you're using monkey patch to sort of mock out sort of the actual the

55:27 database layer.

55:28 Yeah, that sounds super cool and useful.

55:30 It's also like what differs like between our two courses is like minor text based and yours

55:35 are all video based.

55:36 Yeah, all video based.

55:37 Yes.

55:38 Yeah.

55:38 I mean, there's source code on GitHub that's text, but not really.

55:41 So yours are both then.

55:43 Damn.

55:43 No, no, no, no, no, no.

55:45 Not really.

55:45 It's all video based.

55:46 So I didn't plan this ahead.

55:48 I looked down like, wow, you have my two courses, which is super cool.

55:51 So I have two courses on here, modern APIs with FastAPI.

55:54 And the idea is just like, let's build an API that uses Pydantic, that uses async and await,

56:00 that has real live data, stuff like that.

56:02 And sort of the fundamentals of the FastAPI world.

56:06 And then the other one is full web apps with FastAPI.

56:08 So if you had already a flask app or something like that, and you're like, I'd like to add

56:14 some additional features to it.

56:15 You could just plug in some API type thing to it, some RESTful API extension.

56:20 And it goes.

56:21 But if you're starting from scratch, you might create an API with FastAPI.

56:25 Then you're like, well, I also wanted some HTML stuff.

56:27 Could I actually add like a server side HTML story around this as well?

56:33 So it shows you how to like create users, submit forms, validate data, use templates, all that

56:39 kind of stuff.

56:39 So kind of like you need a little bit more on the server side, a little more on the website,

56:43 not just pure API, then like that would tell you how to do that.

56:46 So you're using server side templating for that?

56:48 Yeah, either Jinja2 or Chameleon, pick your pick.

56:52 Yeah.

56:52 Basically, we recreate IPI.org and FastAPI.

56:55 So you're not doing a single page app and with you and React and Dockerizing and both?

57:00 No, exactly.

57:01 Well, why not?

57:02 I know, I know.

57:04 You're not doing it right.

57:05 I'm totally doing it wrong, though.

57:06 I definitely would not be cool in the JavaScript world.

57:08 You know, it's not that I'm super against that, but I think that there's still a lot of

57:12 value to having some of the stuff on server side.

57:14 And then I don't think everything has to be a spa, right?

57:17 Single page app.

57:18 Yeah, I was being sarcastic because that's definitely like...

57:20 I know you are.

57:20 I know you are.

57:21 Yeah.

57:21 So we were talking right before this.

57:25 We realized we have our three classes here, our courses here, that we wanted to do some

57:29 kind of special for people and a way also to give back to FastAPI.

57:33 I want to tell people what we came up with.

57:35 Like this was not pre-planned until we were like, oh, wait, why don't we, you know, we're

57:37 looking at these three things here.

57:38 Let's do something.

57:40 We decided that we're going to sell these three classes as a bundle, not one off.

57:45 But if you want to take all three of these classes, we'll give you 50% off the price and

57:49 50% of that 50%, 50% of what you pay us will go to support FastAPI directly.

57:56 So we're going to try to do a little fundraiser for FastAPI and do a little awareness for our

58:01 courses.

58:01 Yeah.

58:02 And the courses kind of build into each other too.

58:03 Like your core, your modern API is a FastAPI.

58:06 I would recommend taking that first.

58:08 And then sort of my course takes that to the next level.

58:10 And then if you want to learn how to like, hey, I want to buy routes to have like server

58:15 side templating so I can like serve up something to interact with the API and add the full web

58:19 app course on top of that.

58:20 Yeah, I think so.

58:21 So we don't have, because it's your course and my courses, different platforms, all that,

58:26 we don't have an official way to make this happen.

58:28 So they just send you an email.

58:29 Yeah.

58:30 And say, hey, I'd like to do this bundle thing.

58:32 And we'll just make it happen behind the scenes, right?

58:34 Yeah.

58:35 Just shoot me a quick email, michael.testroom.io.

58:38 And I'll do all the hard work and link all that together and send and put down, probably

58:43 just use Stripe for that.

58:44 Just send out a quick Stripe invoice and then we'll make it work behind the scenes.

58:47 And then Sebastian, the FastAPI creator, 50% of that.

58:50 So help support FastAPI.

58:52 Yeah.

58:53 Fantastic.

58:53 Super cool.

58:54 Yeah.

58:55 Thanks for doing that together, Michael.

58:56 That'd be fun.

58:56 All right.

58:57 Now there's a couple of questions in live chat before we wrap this up.

59:00 I guess let's go with this question from Joe real quick.

59:02 Because I'm really happy with Flask.

59:04 Is there any reason for me to switch to FastAPI?

59:05 I mean, we've covered some of the reasons.

59:07 I would point out before anyone out there listening makes that decision.

59:11 If Flask 2.0 is coming out in a week, wait until that happens.

59:15 And then look at what the modern Flask looks like.

59:17 A lot of major stuff's coming like async and await support and so on.

59:20 And then compare those.

59:22 Yeah.

59:22 I would say that's a hard no.

59:23 Don't switch right away.

59:25 Like spin up an app.

59:27 Like see if you like it.

59:28 See if you enjoy it before like moving your application over to SAPI.

59:32 Yeah.

59:32 And then Teddy has another interesting question.

59:34 Like, are we aware of any CMS like projects building on top of FastAPI similar to say Wagtail

59:39 with Django?

59:40 I don't know of any.

59:41 Yeah.

59:42 I don't know either.

59:42 The closest that I would say is like that thing I described with full web apps with Fast

59:47 API, which you can get the code from the open public GitHub repo.

59:51 You don't have to take the course to check it out.

59:52 That does put like HTML views and stuff on top of it, but you're still there.

59:56 It's more like what Flask does from scratch, not what Wagtail does from like, here's your

01:00:01 CMS.

01:00:01 So that's a very long ways from what you're asking, but it's as close as I know of.

01:00:04 Yeah.

01:00:04 Wagtail is like in between WordPress and sort of Django.

01:00:07 So it adds a lot on top of Django.

01:00:10 So yeah, if you're looking for that sort of functionality, FastAPI is not going to do

01:00:14 that.

01:00:14 I wouldn't even look for an extension out there for that.

01:00:16 It's not the right tool.

01:00:17 Yeah, probably not.

01:00:18 Dominus, what's the best platform to deploy FastAPI?

01:00:22 Yeah.

01:00:22 So you can deploy it really sort of anywhere.

01:00:24 It kind of gets into the hosting section there.

01:00:26 So if you want to scroll down there.

01:00:27 Yeah.

01:00:27 Yeah.

01:00:28 It's kind of, we were like on the cusp of it, but we don't really have time to go too

01:00:31 deep into it.

01:00:31 Yeah.

01:00:32 Yeah.

01:00:32 I mean, if you containerize it, you can obviously deploy it wherever I deploy like to Heroku.

01:00:37 It's very simple to deploy containerize apps there.

01:00:40 EC2, DigitalOcean as an app platform.

01:00:42 That's where a platform is a service.

01:00:44 It's similar to Heroku now.

01:00:46 So yeah, I mean, really wherever you like to do your deployments, you know, FastAPI,

01:00:50 totally fine to deploy it there.

01:00:51 It goes pretty easily.

01:00:52 Yeah.

01:00:53 There's even some serverless stuff that you point out in your list there, right?

01:00:56 Further down.

01:00:56 Certainly on the infrastructure to service, Nginx, G Unicorn, particularly running UVicorn

01:01:05 workers.

01:01:06 So you get the async support, which is like a special flag you can pass to G Unicorn.

01:01:10 And then let's encrypt for SSL and you're golden.

01:01:13 Yeah.

01:01:13 And I run an awesome Flask, you know, repo as well.

01:01:17 And I literally copied and pasted this from Flask.

01:01:19 So it's like, I mean, all of this is just agnostic.

01:01:21 Yeah.

01:01:22 Yeah.

01:01:23 Very cool.

01:01:23 And Joe actually gave a call out to that earlier saying, I just starred your live and realized

01:01:27 you're the same guy that does the awesome Flask list.

01:01:29 Awesome.

01:01:31 Yeah.

01:01:31 There we go.

01:01:32 Fantastic.

01:01:32 All right.

01:01:33 Well, I think we're quite out of time here, Michael, but super fun, super fun stuff to

01:01:39 talk about.

01:01:39 Really helpful.

01:01:40 I just love these awesome lists because not only do you learn about all these cool things

01:01:44 like some of the plugins, like FastAPI, SQLAlchemy, but then also things that those are using.

01:01:50 It's just such a cool exploration of all these different libraries and things that are out

01:01:54 there, right?

01:01:54 Like Beanie, for example.

01:01:56 I didn't know about Beanie, but now I discovered it, even though I wasn't looking for that in

01:01:59 particular.

01:02:00 Yeah.

01:02:00 I don't know how many times I see on Reddit, like people asking, well, hey, what should

01:02:04 I use for auth?

01:02:04 What should I use for this?

01:02:06 And it's like, well, I mean, yeah, I mean, here's a list.

01:02:09 Here's a concise list of all the different things out there.

01:02:11 It might not cover everything because there's obviously other things out there, but it's

01:02:15 definitely nice to like come to something like this versus like, you know, searching PyPI

01:02:19 with FastAPI dash, basically.

01:02:21 Exactly.

01:02:22 Exactly.

01:02:23 One of the big challenges we have in the Python space, which is kind of the opposite

01:02:27 of some places like say the Microsoft world where they're like, here's your ORM, here's

01:02:32 your web framework.

01:02:32 You go build with that.

01:02:33 Have a good time.

01:02:34 Is we have the exact opposite of there's a thousand flowers blooming in each level of the

01:02:40 stack.

01:02:40 And it's a paradox of choice.

01:02:42 Did you notice as a newcomer, I don't think it feels like amazing.

01:02:46 Look at all these choices.

01:02:46 It feels like overwhelming.

01:02:48 I had, what do I do?

01:02:49 Yeah.

01:02:49 Right.

01:02:50 I think awesome lists like the one you created are helpful to really narrow it down to a couple,

01:02:54 go make a pick and just run with it.

01:02:56 A lot of the Ruby and Rails folks, when they come over to the Python space, they're like,

01:02:59 well, there's more than one.

01:03:00 There's more than one ORM.

01:03:01 Well, which one do I use?

01:03:03 Well, I don't know.

01:03:05 Ask DHH, I guess.

01:03:06 Yeah, exactly.

01:03:07 What are you doing?

01:03:07 What are you doing?

01:03:08 Yeah.

01:03:08 Very cool.

01:03:09 All right.

01:03:09 Well, I guess we're down to the final two questions before I let you out of here.

01:03:13 I'll see if this has changed since last time.

01:03:15 So if you're going to write some code, what editor do you use?

01:03:19 Python code, I suspect.

01:03:20 So I approached this question a little different because you asked me favorite editor and I said

01:03:25 idle because I don't use idle, you know, obviously, but it has a special place in my

01:03:29 heart because that's where I learned Python was idle.

01:03:31 And Thani is like sort of like in between like VS Code or a PyCharm and idle sort of like

01:03:38 Interesting.

01:03:38 You're going to learn like idle like today.

01:03:40 Check out Thani.

01:03:41 It like adds like some debugging like type tools and it's like a lot prettier to look at.

01:03:46 Yeah.

01:03:46 Super interesting.

01:03:47 It's like sort of like a notebook, sort of like a proper like autocomplete editor.

01:03:53 And it looks a little bit like idle.

01:03:55 Yeah.

01:03:55 How interesting.

01:03:56 Yeah.

01:03:57 Cool.

01:03:57 Okay.

01:03:57 Yeah.

01:03:57 I haven't thought about that one for a while.

01:03:59 That's cool.

01:03:59 And then.

01:03:59 Yeah.

01:04:00 Don't use this on a daily basis though.

01:04:02 So I definitely use VS Code on a daily basis.

01:04:06 So I'm not coding in the idle.

01:04:08 Like what does idle stand for?

01:04:10 Integrated development and learning environment.

01:04:11 Yeah.

01:04:12 Don't use that on a daily basis.

01:04:13 Exactly.

01:04:15 I use Scratch for my architecture design diagrams.

01:04:17 Yeah.

01:04:17 There you go.

01:04:18 Yeah.

01:04:19 And then notable PyPI package.

01:04:20 So I've been using for doc strings.

01:04:22 I've been using Flake 8 doc strings just to lint my doc strings.

01:04:25 And that has helped me.

01:04:26 You know, I use like the sort of the Google flavor of doc strings.

01:04:30 And that has helped me adhere to that a little bit better.

01:04:32 Yeah.

01:04:33 Also, I want to give a shout out to Hotwire Django.

01:04:36 So Hotwire comes from sort of the Rails sort of world.

01:04:40 But this is essentially HTML served over WebSockets.

01:04:44 So instead of like, you know, doing, you know, all this stuff with Vue or React, what you do

01:04:50 is you serve up basically templates and the templates are pre-rendered.

01:04:53 Yeah.

01:04:53 Hey.com.

01:04:54 That's where Hotwire comes from.

01:04:55 But instead of serving up your JSON and having two forms of state, one on the client,

01:05:00 one on the server, you just like, you simplify it all.

01:05:02 I mean, it does add complexity with WebSockets and you have to deal with that.

01:05:05 But yeah, I like sort of that paradigm and it feels like a little bit more like 2005-ish

01:05:11 than 2020-ish.

01:05:13 But yeah, I mean, it's definitely been working for the Rails folks and Basecamp.

01:05:17 Yeah.

01:05:18 That place is interesting.

01:05:19 All the frameworks that they kick out.

01:05:20 Yeah.

01:05:21 Cool.

01:05:21 All right.

01:05:21 So if you want to, if you want to be like, hey, and DHH, you can go do that.

01:05:24 That's really cool.

01:05:25 Yeah.

01:05:26 I've heard good things about it.

01:05:26 Awesome.

01:05:27 Well, Michael, it's been really fun to talk about.

01:05:29 Your Awesome List.

01:05:30 And I think all the stuff we touched on is going to be super helpful.

01:05:33 Final call to action.

01:05:34 People want to get started with FastAPI and pick some libraries.

01:05:37 What do they do?

01:05:38 You know, obviously, I would definitely say start with the FastAPI documentation.

01:05:42 It is great.

01:05:42 Out of all of like the documentation out there in terms of Flask and Django and whatnot, that

01:05:48 one is by far the best.

01:05:49 Definitely start off there.

01:05:50 After you've built like just a basic app, check out the awesome like FastAPI list to see how

01:05:55 to extend it.

01:05:56 And then if you're looking to like learn more in the testing and Docker type realm, check

01:06:01 out my course and check out, you know, Michael's courses as well.

01:06:04 Yeah.

01:06:04 And you can do that bundle thing.

01:06:06 I'll include the email so they can send it over and help them out.

01:06:10 Very cool.

01:06:10 Awesome.

01:06:10 Yeah.

01:06:11 Yeah.

01:06:11 Awesome.

01:06:12 Yeah.

01:06:12 So thank you so much for being here.

01:06:13 Really appreciate it.

01:06:14 And it's been super fun to talk FastAPI and all the stuff around it.

01:06:18 It's really growing, isn't it?

01:06:19 Yeah.

01:06:19 It's exciting.

01:06:20 It's exciting to see just how much it's grown just in like past like six months.

01:06:24 Yeah, absolutely.

01:06:25 All right.

01:06:26 See you later.

01:06:26 Yeah.

01:06:27 Well, cheers.

01:06:28 Thanks for having me.

01:06:28 Appreciate it.

01:06:29 Yep.

01:06:29 Cheers.

01:06:30 This has been another episode of Talk Python to Me.

01:06:33 Our guest in this episode was Michael Herman, and it's been brought to you by us over at

01:06:38 Talk Python Training.

01:06:39 Want to level up your Python?

01:06:41 We have one of the largest catalogs of Python video courses over at Talk Python.

01:06:45 Our content ranges from true beginners to deeply advanced topics like memory and async.

01:06:50 And best of all, there's not a subscription in sight.

01:06:53 Check it out for yourself at training.talkpython.fm.

01:06:56 Be sure to subscribe to the show, open your favorite podcast app, and search for Python.

01:07:00 We should be right at the top.

01:07:02 You can also find the iTunes feed at /itunes, the Google Play feed at /play,

01:07:07 and the direct RSS feed at /rss on talkpython.fm.

01:07:11 We're live streaming most of our recordings these days.

01:07:15 If you want to be part of the show and have your comments featured on the air,

01:07:18 be sure to subscribe to our YouTube channel at talkpython.fm/youtube.

01:07:22 This is your host, Michael Kennedy.

01:07:24 Thanks so much for listening.

01:07:25 I really appreciate it.

01:07:27 Now get out there and write some Python code.

01:07:44 I'll see you next time.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon