Latest / Talk Python To Me / #316: Flask 2.0
Transcript
- 0:00Flask is one of the most popular Python web frameworks, and they have huge news to share
- 0:04with us. Flask 2.0 just released after a ton of work, and it's as big a deal as the version
- 0:10number suggests. Async changes are coming, Python 3.5 and below, including Python 2 support has been
- 0:17dropped, and much, much more. Join me as I discuss Flask 2.0 with David Lord and Philip Jones.
- 0:23This is Talk Python To Me, episode 316, recorded May 10th, 2021.
- 0:28Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem,
- 0:46and the personalities. This is your host, Michael Kennedy. Follow me on Twitter, where I'm @mkennedy,
- 0:51and keep up with the show and listen to past episodes at talkpython.fm,
- 0:54and follow the show on Twitter via at Talk Python.
- 0:58This episode is brought to you by us over at Talk Python Training. If you want to learn Flask,
- 1:04we built a fantastic course called Building Data-Driven Web Apps with Flask and SQLAlchemy.
- 1:09In this course, we built a PyPI.org clone from scratch using Flask and SQLAlchemy. You'll
- 1:15learn many of the major ingredients needed to build most web apps. If this sounds amazing,
- 1:19just visit talkpython.fm/Flask or email us at sales at talkpython.fm.
- 1:25David, Phil, welcome back both of you to Talk Python To Me.
- 1:29Hello. Hello. Thank you.
- 1:30Yeah, it's great to have you back. David, I've had you on to talk about Flask, and Phil,
- 1:35I've had you on to talk about derivatives of Flask, I suppose, about Quart, your project. And
- 1:41they're both kind of approaching the same type of thing and then sort of zeroing in. So now we have
- 1:46you here together, I suppose, working on Flask 2.0, right?
- 1:50It's all merging into one. Not really. Just our efforts. Still separate libraries.
- 1:56Yeah, but it's really cool to see you working closely together rather than just two disjoint
- 2:01things, right? I think that gives a lot of credibility, especially to Quart, right? Because
- 2:04Quart was kind of this experimental thing. And now it's, if not exact, is it a Palette's project
- 2:08officially or is it just working more closely?
- 2:10It's working more closely. And in addition, it uses VerkZeg now, which it never used before. So
- 2:15it's been quite a lot of work in that project to make that possible.
- 2:19Yeah, that's really cool. And VerkZeg is like one of these foundational bits of Flask.
- 2:23That's what we'll get into, I'm sure.
- 2:24Yeah. So the idea is because Quart was supposed to be API compatible with Flask, we want to get it
- 2:31using as much of what Flask is using as possible. A long-term plan is to get it using even more
- 2:37works in VerkZeg.
- 2:38Yeah, yeah. Super cool. Maybe some, it's dangerous as well. Get in there. Who knows?
- 2:42It's risky, but you guys can make it happen. All right. Now, before we jump into the main topic,
- 2:47Flask 2.0, you both have been on the show before. Often I ask people how they got in programming
- 2:52in Python or whatnot. You've both answered that question previously. People can go back and hear
- 2:56it if they want. So how much is it catch up? What have you been up to since you've been on the show
- 3:00last? Bill, you want to go first?
- 3:02Sure. I think in open source sense, it's been, yeah, working a lot on Quart and working more.
- 3:09At the time, I don't think I was really helping with the Palette's project. So I've been helping with
- 3:12them since. And yeah, just kind of developing those two and doing a lot of work trying to get,
- 3:19well, the async support that's now coming to Flask, which is quite exciting. On a kind of personal note.
- 3:24Yeah, very exciting. Yeah.
- 3:26Yeah, on a personal note, I work in London. So I've just been, I've actually worked for a few
- 3:31companies, tried my own startup. It didn't work, sadly. But yeah, working in London now. So that's good.
- 3:36Nice. I love London. That's a fantastic town. I haven't been there in a year and a half,
- 3:40oddly. I don't know why. And David, how about yourself? Where have you been up to?
- 3:44So I'm trying to remember when we did our podcast last, but it must have been like three years ago.
- 3:49That's been a while.
- 3:50So yeah, after that, I've just been working down the backlog of all the issues on Flask and
- 3:57palettes and all that. And now we're finally at the point where I'm confident about releasing
- 4:01all this stuff. So yeah, it's just been more and more open source work. And then still working for
- 4:08the same company I've been working for for 10 years now. So that hasn't changed at all.
- 4:12Yeah, that's cool. And I suspect they're pretty supportive of Flask.
- 4:15Oh, yeah, we get to use it internally. I actually introduced Python and Flask to the whole company
- 4:20way back in the day now.
- 4:21Yeah. I mean, how much of an advantage is that to have somebody like you?
- 4:24Yeah.
- 4:24We're so familiar with everything, right?
- 4:26Yeah. When we're bidding for contracts and stuff, they definitely get to use that as like,
- 4:31hey, we've got one of the maintainers of the libraries we want to use. What do you bring to
- 4:35this table?
- 4:35Yeah, exactly. What's the advantage you have? Well, have you met David? No, that's fantastic.
- 4:43That's fantastic. And check this out. You were back on episode 177 and the title was Flask
- 4:48goes 1.0.
- 4:49Oh my gosh.
- 4:49I feel like. Yeah, yeah. This is September 15th, 2018. So it's been a while. But also,
- 4:55it's time to have you back because now you guys have incremented the big number in the version.
- 5:00Well, not quite. Almost.
- 5:01One more day.
- 5:02Is it one more day?
- 5:03Yeah, it's tomorrow.
- 5:04Okay. So for people listening on your podcast player, that's like a week ago.
- 5:09Oh, wow.
- 5:10People on the live stream, one more day. Fantastic. Super cool. So I see some really interesting
- 5:14questions from people who are watching the live stream, but let's dive into a little bit of
- 5:18background stuff. And then I think we'll go from there. So I kind of wanted to start with the
- 5:23larger landscape of the web. And maybe also you could tell us about, I just threw that out there
- 5:29as if people would know the Pallets project. We talked about it a little bit with both of you.
- 5:33David, give us an overview of what the Pallets project is because we have Flask and we have
- 5:39Quart and then we have these other libraries as well. What's the relationship of all these things?
- 5:43I know Quart is its own thing, but it uses like Brickzoic, for example.
- 5:46Yeah. Well, Pallets is the organization, like just an open source organization, not an actual
- 5:51company or anything that maintains Flask and the libraries that Flask uses. And so that's Flask,
- 5:58Ferkzoic, Jinja, Click, It's Dangerous and Markup Safe. And it was started, all these libraries used
- 6:04to be maintained by the original author, Armin, and his other group, Poku. And eventually they kind of
- 6:11grew larger than that. And the original team kind of grew to do other things. And so he formed Pallets.
- 6:18And that's about when I joined and started maintaining everything. Although recently I've come to the
- 6:23understanding that as much as I push the name Pallets, I will never have as much name recognition
- 6:29as Flask. And so you can also refer to things as Flask and I will know what you're talking about.
- 6:33Yeah, no doubt. Like the general Flask obviously is made up of the foundational bits as well.
- 6:38Yeah. Yeah. And so Pallets for a very long time was just the GitHub organization that these projects
- 6:45repos were under. And I've been working over time to expand that into an actual open source organization,
- 6:52kind of not nowhere near this yet, but inspired by like how Django software foundation works and those
- 6:58sorts of things where they do things besides just develop. So we've been working on growing the
- 7:03community, getting more maintainers involved, running FlaskCon last July, I think. And another
- 7:09one is coming up, I think, in November is this tentative schedule.
- 7:13Nice. And this is obviously, I would guess, online at this point?
- 7:16Yeah, it'll be online still. It was online last time also, and it worked out pretty well. You can go
- 7:20find all the videos on PyVideo. They're up there.
- 7:23Yeah. Fantastic. Do you have sprints or anything like that around it, or is it just presentations?
- 7:27We didn't do sprints last time because it was just our first time running a conference. We'll see what
- 7:32happens this year. No concrete plans yet.
- 7:34Yeah. Fantastic. All right. I kind of wanted to start off this conversation with a wider view,
- 7:40looking at the Python web space. So I put up here for us to look at the Python developer survey from
- 7:47the PSF and JetBrains for 2020. Obviously, it's 2021. But the results for that was the last survey
- 7:53that have come out. And over there, we've got the web frameworks being used. And these things are never
- 7:59comprehensive. There's 6% of other, whatever that means. But we have Flask now clearly being the most
- 8:06popular one. So first of all, congratulations on that. That's awesome. I wonder if Quart was folded
- 8:11into Flask or if it went into the other, you know, in a person's mind when they clicked the button,
- 8:16which did they click, you know?
- 8:17I imagine it's probably in the other and a small percentage. Very small.
- 8:20Yeah. Nice. Okay. Well, so this is really neat. I guess the big interesting thing here as well,
- 8:26beyond, I think it was you and Django, at least in this previous survey in 2019, were just tied,
- 8:33basically. So now it's, you had talked about how there's a lot of growth and a lot of momentum.
- 8:37And I think it's even more than what you see here on the screen. Like I think a lot of the APIs that
- 8:42Flask embraces in the way of doing web programming has been adopted by many of the other new frameworks
- 8:48as well. So for example, we have FastAPI making a jump up to 12% here, which is probably the biggest
- 8:54difference from the year before as well. What do you think about this picture here? And then like,
- 8:59you know, what do you think about just the Python web space in 2021, both of you?
- 9:04FastAPI is definitely gaining ground. Flask, I'm continually surprised that so many people use
- 9:09Flask. Never. It's hard to wrap your head around like that many people. I was just looking at the
- 9:13downloads this morning and it was 14 million in the last 30 days.
- 9:16In the last 30 days. That's so insane.
- 9:19That's just Flask. Like if you look at like Jinja, because Jinja is used by
- 9:22things besides Flask, like Ansible, we're like the 20 somethings.
- 9:27Very cool. And you can use Jinja just on its own for super interesting things as well. Like
- 9:31I recently did a project where I needed to generate a PDF that was like out of, you know,
- 9:35here's data in a dictionary and I need to make a PDF that looks formatted. And I just use Jinja
- 9:40and a Jinja template to generate the HTML, then feed it off to a PDF library that made it into
- 9:45PDF, right? There's all sorts of little edge cases like that.
- 9:48And same with Click. I mean, people use Click to make actual command line applications,
- 9:51not just to provide a little CLI for Flask. So yeah, when you look at this, like you,
- 9:56like you realize that like, oh, they're also using like all these other libraries,
- 9:59but I never really like think about the numbers. I guess every now and then I remember Flask having
- 10:04more stars than Django on GitHub, but that was because Django joined GitHub late and they've
- 10:08surpassed us now, but that's about the only joke metric I follow really. But yeah, I've seen a lot
- 10:14of interest in FastAPI and I think it's a, it's nice to just see that like none of nothing's
- 10:20stagnating, you know, like everything, like there's, there's new ideas out there. People are developed,
- 10:24like there's stable libraries that continue to develop like us and we were still adding new features.
- 10:28And then there's like completely new ideas or new formulations of libraries.
- 10:33Yeah. I feel like we're in a bit of a Cambrian sort of thousand flowers blooming type of time. And
- 10:38many of them won't survive that, but there's a lot of fresh ideas out there and it's pretty exciting.
- 10:42Yeah. Like having a healthy ecosystem, having choice that you can choose whether a certain
- 10:49framework is more appropriate for, you know, the project you're starting or working on,
- 10:53I think is really powerful for like users and for maintainers.
- 10:56Yeah. And you can borrow ideas too. Like, Oh, I see the way FastAPI is doing types,
- 10:59like mean this, maybe that makes sense to like allow that as an option somewhere else,
- 11:04you know, who knows, right?
- 11:04Well, one thing I quite like to take from this list is Falcon has a really quite exciting router.
- 11:10And I think it might be a little too, too much for Verksug perhaps, but I've been playing around with
- 11:17taking the ideas from Falcon and bringing it to Verksug. So what makes it exciting is it's a very fast
- 11:21matching system and yeah, should outperform the Verksug router if we can get it in by a good fraction.
- 11:29So that'd be exciting.
- 11:30Yeah. There's a lot of interplay here that I think is pretty neat. And while we're on this sort of broad
- 11:33topic, Rohit asks out in the live stream, you know, what are the advantages of using Flask over Django?
- 11:39Maybe that pairs them up a little bit too tight, but you know, looking at this list,
- 11:43these are the ones that probably the trade-offs people are thinking about.
- 11:46Yeah. This gets harder for me to answer over time because I haven't used Django in a long time,
- 11:50but it's hard to compare them one to one. It's like apples and oranges, right?
- 11:53Like I said a couple of minutes ago, like you're choosing the project that's most appropriate or the
- 11:58framework that's more appropriate for your project and the way you want to work. So it's not necessarily
- 12:02that you're going to be losing out or getting any given feature by choosing one or the other. It's
- 12:08about how they feel when you're working on them. You know, like sometimes Django makes more sense to
- 12:14people or FastAPI makes more sense or, and then like they also have different goals, right? Like Flask is
- 12:19deliberately just the web framework and wrapping some other libraries around it. But its goal is that
- 12:27if you want other features, somebody develops an extension that is specific to that and you add
- 12:34that on. And I mean, Django and I don't know about FastAPI yet, but like Django has the same idea. It's
- 12:38just how many batteries they decide to include is different. Yeah. Yeah. Phil, you want to take a
- 12:43shot at this before I give my thoughts as well, maybe? Yeah. I think specifically Flask and Django,
- 12:48I always thought it came down to a kind of a choice about how to do things like Flask doesn't really
- 12:53give you an answer and you can go and choose from the extensions, whereas Django does. And yeah, I think
- 12:58it's like David said, a bit of what your preference is really, what you prefer. Yeah. I mean, Django is
- 13:03making huge strides in like async also, and we're adapting to that too, but they all have different
- 13:09solutions to the same thing and approaching it from different directions. Yeah, definitely. There's a lot of
- 13:13interesting stuff happening in Django around this as well. So the way I see it is, you know, Flask,
- 13:18it's like an empty canvas and it's got just a few really nice little building blocks and then you can
- 13:23build what you want, right? You want to use Postgres and SQLAlchemy? Great. That's totally easy. You
- 13:27want to use MongoDB and MongoEngine? Equally easy. Go have fun, right? Like you, you can pick just the
- 13:33little bits that you really like. You don't have any other bits to worry about and then you're good to go,
- 13:37right? Django, it's like, well, if you want to break from the Django ORM, probably you can do it,
- 13:42but it's, there's a little bit of a mismatch there. You kind of got to work around it. Its advantages
- 13:48kind of become less good, right? Like it's admin tools might not work as well if you try to say
- 13:52switch to Mongo or something along those lines. And if what you want is like, I'm not really sure what
- 13:58I'm doing to build this website. And I just want some guidance, like just show me the main way and I'll
- 14:03just do that. I don't, I just would like to go along for the flow. I think Django is fantastic for that.
- 14:08It gives you like really good prebuilt tools, like the admin stuff and whatnot. But if you really care
- 14:13very much about which little piece you pick and you want to put them together just so, I feel like you're
- 14:17better off with a micro framework of some sort like Flask. That's my, my view. And I know some people
- 14:22love one side and hate the other and vice versa. So it's, you know, it's also a personal challenge or a
- 14:27personal thing you got to work out for. Where, where do you fit on that spectrum?
- 14:31Yeah. I mean, I personally started with Django. Flask was just being started when I was starting
- 14:36to learn Python and web frameworks. And then I eventually ran into something where I wanted to
- 14:42do things that Django wasn't designed to do, obviously. And I started running into a bunch
- 14:49of stuff. And so I switched to Flask.
- 14:50Yeah, that's cool. I know if you come from a, an ecosystem where there's like clearly one choice
- 14:56for a lot of things, you know, if you come from Ruby, you got, you got rails and the Ruby ORM.
- 15:01I'm from Microsoft, you got ASP.NET in a framework, like you don't have decisions. You just do the
- 15:07thing. And then eventually you build your app, right? You come to Python, there's like, you know,
- 15:1220 different choices at each level. And you're like, this is like the paradox of choice. This,
- 15:15even though it's in some ways, it's great. In other ways, you're like, I have no idea what to do.
- 15:19And so I think that can be a challenge for people as well. Yeah. But also an advantage
- 15:23once you get into it. I think your best bet, if you're asking the question, should I use Django
- 15:27or Flask is to just pick one and learn enough, you know, about that framework. And I think you will
- 15:34be better equipped to answer that question for your project next time you have to ask it.
- 15:38Yeah. Yeah.
- 15:39It doesn't really matter what you start with.
- 15:40All right. Before we get into a more specific, so sort of a general Flask question as well.
- 15:46Ivan says, since Flask started as an April Fool's joke, does the core team,
- 15:50David and crew, have any traditions around April Fool's? I haven't thought about that.
- 15:55You know, every time somebody brings up that it was made on April Fool's,
- 15:58I remember that it was made on April Fool's. I always forget that.
- 16:01So I'm guessing not too many ones. Okay.
- 16:06We don't have like a birthday party or anything or celebration. Maybe we should.
- 16:10We'll bring it up to the community team.
- 16:12There you go. There you go.
- 16:13I think you put out a blog for last year, 10 years, didn't you? That was quite a good celebration,
- 16:18but I think that was about it.
- 16:19Oh, maybe it. Yeah. It's been 10 years for a lot of libraries at this point.
- 16:22Yeah. Very cool. So let's talk Flask 2.0. You know, it's been a couple of years. It went to 1.0.
- 16:28It was on the zero-ver train like so many projects were before then, right? That doesn't really mean
- 16:33that it was such a huge transition, but there's a lot of stuff changing, not necessarily in a breaking
- 16:38way, but a lot of new things in Flask 2.0. Give us the exciting news.
- 16:43Well, the biggest one is probably async. I'll let Phil talk about that.
- 16:46Yeah. There's like a async for Flask directly and then like maybe tighter integration with
- 16:53Quart type of next level async, right?
- 16:55Yeah, exactly. So with Flask 2, you'll be able to write async root handlers, depending on what you like
- 17:01to call them, before and after request handlers and teardown functions. So it won't require any
- 17:07special effort other than installing Flask with the extra support, but then you can just write async
- 17:12and await and carry on with your current setup. You don't have to change anything else.
- 17:16Yeah. That's super neat. And you actually gave a talk May 1st or something, 10 days ago.
- 17:21What was it called? It was, why isn't Flask async?
- 17:25And obviously that's like leading into where things are going. You want to tell people a little
- 17:30bit about some of the ideas there? You talked about the history, obviously Flask being a
- 17:34WSGI or WSGI application. Those are all naturally having a hard time moving to async because
- 17:42the server itself needs to know. But then you also talked about some of the things that are
- 17:47happening to allow some async stuff to run directly without any server changes. And then also moving
- 17:55to an ASGI server. Yeah. So what's the story there?
- 17:58So, yeah. So obviously Flask started as a Whisky framework. I think it was probably Whisky from
- 18:04the start, right? So yeah, I know. Yeah. So I couldn't quite remember when Whisky was introduced.
- 18:09So yeah. And obviously before Async await is introduced.
- 18:12Yeah. We have all these different servers and I don't want to have just this framework run on
- 18:16that server. So Whisky is born, right? But born in a world where async was less common.
- 18:20Yes. But what it has supported the whole time, and I think what's good to point out is Flask has
- 18:26been async the entire time just using greenlets. And a lot of people use that very effectively. I think
- 18:32it's absolutely fine. And that for us, I think was one of the key things to bear in mind that
- 18:37Flask works async. And if we introduce async await, we can't be breaking that at the same time.
- 18:41So that was one of the big constraints really. And then, so for the one side, it's keeping support
- 18:48with those existing async solutions. And the other is introducing the async await keywords,
- 18:52which I think everyone has heard of the color problem and the virality associated with that,
- 18:57which makes it actually really hard to get a little bit deep into the call stack, if you will,
- 19:02async without really having to change the whole call stack to async in one sweep.
- 19:06Yeah. The challenge, maybe I'll try to give a little bit of background just for people listening
- 19:10is if I've got some low level data access library or service access library for like using HTTPX
- 19:17or something, in order to await the thing at the bottom, that has to be an async method.
- 19:21The next level up in order to call that method, it's got to be async. Then you got to await it.
- 19:25So it's method's got to be async. And it just, it goes up the entire call stack in a lot of cases,
- 19:31right? Yeah. So what it came down to and what we, what we did was follow Django,
- 19:35what Django have already done really. And what they, they figured out is that you can run the
- 19:40async event loop in one thread and the greenlet based one or whatever you were doing previously
- 19:46in the main thread. And then everything coexists nicely. You just need these wrappers to,
- 19:51to move things from one thread to another. And that library, if you're interested, is called
- 19:56ASCII ref, but using that allows us to have this async code in the, in the view handler,
- 20:01but keep flash synchronous in the rest and keep support with, with greenlet, which is really
- 20:06nice. Yeah, that's really nice. And in production in a lot of the servers, it has threaded modes
- 20:12already that if like you're awaiting something and then that something talks to a network, like a
- 20:16database call or a web service call or something, it's going to release the GIL anyway. And the other
- 20:22threads can run. So that can probably push out pretty far just on its own, right?
- 20:26Yeah. It's, I think it's been very effective to a lot of companies. I know companies that use it.
- 20:31I think it's been really nice. So that's what we've, we've got to, and I think you were talking about
- 20:35where can we go? Can we go fully async and ASCII with Flask? And, this is possibly more of my
- 20:42personal opinion, right? I'm not sure it is possible to go there with Flask. Cause I think if you do so,
- 20:46you end up breaking extension support because it's quite common for extensions to extend the Flask
- 20:52Clask and change the methods, but of course they won't be async. So how are they going to deal with
- 20:57that? Yeah. There's the compatibility problem. And then there's also just the problem of having
- 21:02mark everything as async await, if you mark one thing and we might discover, I'm a little more
- 21:08optimistic than Phil, but I'm also not as experienced with it, but I would like it to be possible. Like
- 21:13at some point for us, you know, we're focusing on like making a Verixoy sans IO. So it doesn't
- 21:19require blocking IO operations when you make requests and stuff so that you can use it in ASGI
- 21:25situations. And that's going to be a slow process. We're not like a hundred percent done with it or
- 21:30anything like that. But my hope is that as we make Verixoy completely like IO agnostic, we might
- 21:38discover some ways to adopt Flask. Yeah. But it's also not a hundred percent necessary because
- 21:44cord exists also. That's an interesting point. Maybe there's a way to implement some of those
- 21:51extension. So the problem is the extensions override certain functions that are part of the life cycle
- 21:56of requests. And those are expected to be synchronous functions because they had been for all of time.
- 22:02You can't just make those async and have those extensions still work. You know, at best,
- 22:06they're going to be kicking out unstarted co-routines. You know, maybe it's probably worse
- 22:11than that, but maybe, maybe that's what they do. I don't know. Something is not going to go super well,
- 22:16but maybe you can create synchronous wrappers around the async stuff that can grab a, an event loop and run
- 22:23it or something. I don't know. Like some, there could be some sort of an adaptation thing where just the
- 22:27sync version maybe it's not quite as fast or something. I'm not sure as much experience you
- 22:32guys have. I have a way less than that. So as a caveat, I was going to say, I think with Flask
- 22:38too, I think this is, in my opinion, where you want to be because the motivation in my mind is you want
- 22:44to use some async based library and there's, there's some exciting ones out there. So I can fully understand
- 22:49that. And you can now in Flask and it will work, will work with your existing setups. I think the only
- 22:54reason you could want to go fully async is, because you're only using async libraries perhaps,
- 23:00or perhaps you might see a bit of performance improvement there, which isn't necessarily
- 23:05guaranteed by the way for that though. I think there's court. So I kind of think all the users
- 23:10motivations might be covered now, which I think is really exciting. That is very exciting. Yeah. And
- 23:15our goal is just to get court and Flask as API compatible as possible. And they're already very,
- 23:20very close, but you know, moving, very exciting that. And so like, ideally it should just be a
- 23:25drop in like name replace for everything to keep working. Yeah. And you could probably pull it off
- 23:29with just the right import statement, import court as Flask or something potentially almost.
- 23:35Possibly. I don't know how Phil feels about that.
- 23:37No, well, there's a, there's some monkey patching in court where you can tell everything else that
- 23:43court is Flask. So you can use some of Flask extensions with court by allowing court to be there.
- 23:48And it is Flask. It's just kind of, kind of fun.
- 23:50Yeah. Yeah. That is quite, quite wild.
- 23:53I did see a question. Will Flask break current extensions? No. Our goal was still compatibility
- 23:59and stability. We are, we are making major releases and we are adding new features, but it shouldn't break,
- 24:05shouldn't permanently break anything. You know, there might be some unforeseen incompatibility that
- 24:09a library needs to update for, but it's not like they will suddenly have to rewrite their whole
- 24:13thing async or something like that.
- 24:15It's not, if it breaks it, it's not on purpose.
- 24:17Yeah. That makes it sound bad too, but.
- 24:20No, no. I mean, like your intention is to have it be compatible, right?
- 24:23Yeah. Yeah. That's always the intention of these libraries. They're meant to be very stable.
- 24:28And it's actually one of the things I've been working on as a maintainer, as I've been maintaining
- 24:34these over the years, is when I do make releases or when I make changes, I try to make everything
- 24:40show a deprecation warning first and then only remove it in the version after that. So I do
- 24:45want to evolve things and refactor things or, you know, identify patterns that weren't great
- 24:51or that don't, aren't needed anymore since we're dropping Python 2. I do want to evolve the libraries,
- 24:56but I don't want to break anybody without warning them first. And so there's a ton of deprecation
- 25:02warnings in all the libraries this time that you'll see if you're running tests.
- 25:05That's cool. So speaking of that, yeah, I saw this really nice Flask 2.0 is coming. Please help us test
- 25:11by Stetio. I don't know who this is. If you know, maybe you can give him a shout out.
- 25:15Oh, that's me. Yeah.
- 25:16Oh, is that you?
- 25:17Okay.
- 25:17Perfect. All right. Yeah. So from you, Phil, and he said from the changelog, one of the things coming,
- 25:23well, first of all, one of the things coming is Python 3 plus, sorry, 3.6 plus only dropping 2 for
- 25:30sure. And even 3.5. That's pretty interesting.
- 25:32Well, 3.5 is end of life now. Yeah. Yeah. It seems so new in my mind, but it's clearly,
- 25:39clearly not that new anymore.
- 25:40When I first made the announcement of dropping Python 2, 3.5 wasn't going to go end of life
- 25:45until like nine months later, but I decided to, I was going to drop 3.5 anyway. We won't usually,
- 25:50usually we're going to, our plan is to try to wait for the actual official end of lives for Pythons
- 25:57from now on, but 3.5 just, it was so much more convenient to drop it at the same time. And 3.6
- 26:02is still supported, but the next versions after these will be 3.7 only because 3.6 will have gone
- 26:07end of life probably by the time we make new releases. Right. Right. Okay. Very cool. And how
- 26:12much the five versus six, was it just that 3.5 is going out or versus f-strings? We do use f-strings all
- 26:18over the place now, but that wasn't the reason. I mean, since we were doing 3.6 plus, I decided to
- 26:23like use f-strings in a lot of places. I don't remember what was inconvenient about 3.5, but there,
- 26:30I mean, I do remember there was something, this was a year and a half ago now when I made this decision.
- 26:34I think async was slightly different. I mean, look, if you're switching to two, it's a chance for a nice
- 26:40break from some of these things, even if they've got a few months left. Exactly. Yeah. I was originally like,
- 26:44originally 2.0 was just going to be like dropping Python 2 and making maybe a few minor changes. And
- 26:52then I got anxiety about making releases and breaking everybody's stuff. And so I just kept
- 26:58working on more and more stuff into 2.0 instead of releasing it. But because it's 2.0, that also kind
- 27:05of gave me the opportunity to like identify more stuff that I wanted to deprecate than normal maybe,
- 27:10or make more bigger features to add. Yeah. But it's a perfect time to do it with
- 27:14such a big version number change. I want to pull out a few more things from now that I know it's
- 27:19Phil's Reddit post here, which got 1.3, 1,300 upvotes. That's pretty awesome. Short form of decorators.
- 27:26So instead of for routes or routes for you in London, instead of app.route, you know,
- 27:33specifying get or post, you can just do app.get, app.post. That's easy, but nice.
- 27:37Yeah. It's just a bit of a synthetic sugar really. It's a, yeah, should make it a little nicer.
- 27:43Going back to the ecosystem, it's something the other frameworks will seem to adopt
- 27:48Yeah. Yeah. Yeah. That's one of the big differences I've been seeing from the other
- 27:52frameworks that they're very much like Flask, but they kind of put the verbs on the decorators a
- 27:57little bit more. So why not take it back? Have you inspired them in the first place? Also,
- 28:01you know, blueprints, man, blueprints are something I think do not get enough attention and love because
- 28:09they're so nice for organizing your code into little bits and little categories of functionality
- 28:15instead of, you know, trying to associate them all with the main app, the at app.
- 28:20So there's some news around that for updates as well, right?
- 28:22Yeah.
- 28:22One of the oldest standing open issues, Phil decided to just like, oh, I can solve this. And he like
- 28:27wrote something over a weekend, I think.
- 28:29It felt like that.
- 28:30Way to go, Phil. Now it's blueprints all the way down.
- 28:33Well, I'll let Phil describe it.
- 28:35Yeah. It's exactly like you can nest blueprints in blueprints. So I think the kind of code structure
- 28:42is really helpful because now it doesn't have to be all in that one blueprint, right? You can split
- 28:46over a few files and bring them in, which helps a lot. And there's other structures where maybe you
- 28:50want to reuse some part of something in another blueprint. So you just bring in parts, but yeah,
- 28:55you can just use that. And you can use the command register blueprint on a blueprint to register the
- 29:00blueprint and carry on.
- 29:02Yeah. You used to have to say app.registerblueprint and you would give it the blueprint and that would
- 29:06help you build up the various pieces. But now you can nest them and they can be more hierarchical,
- 29:11which is great.
- 29:12Right. Before it was just one layer. You had the Flask app and then the blueprints. And so like each
- 29:17blueprint could have a prefix, but people haven't actually asked for it for a while, but it's still
- 29:22been an open issue and it doesn't seem unreasonable. People have wanted to like have prefixes for
- 29:28prefixes. And so then you get nested blueprints and now it's possible.
- 29:31Yeah. Awesome. Let me take a couple of the questions out of life.
- 29:33Sure.
- 29:33First, Doug Farrell out there. Hey, Doug says, Hey, I'm working on a book that uses Python
- 29:38Flask as a primary example application. When might Flask 2.0 be released? And should I plan on updating
- 29:44the book to use it? I'm guessing Doug didn't catch the very first opening bit because you said tomorrow.
- 29:49Tomorrow. If you're interested in following Pallets news in general, there's at Pallets team on
- 29:55Twitter and there's also palletsprojects.com slash blog, which has an RSS feed. And so we actually
- 30:00have announced this already, but yeah, it's May 11th tomorrow.
- 30:04Fantastic. And then John Sheehan says, you're right. We don't hear enough about blueprints.
- 30:09I love blueprints. Yes, absolutely.
- 30:11Right.
- 30:12So I says, in our Talk Python Training web training course, which is a Flask covers,
- 30:17it says Flask basically rebuild pypi.org with Flask. Is it used as a safe to use Flask 2.0? I think so.
- 30:23Like David said, there shouldn't be any breaking changes, maybe deprecations. If you see them,
- 30:27let me know. I can update that, but I think it should be fine. Right. Same reason that production
- 30:31apps work. The, the like example apps should work.
- 30:34This is the first time we've tried to do release candidates before we've made releases.
- 30:38And so we actually have had release candidates up for about a month now for all the libraries
- 30:42where you could test your existing code with the new versions. But I think in the future,
- 30:48when we do this, we need to do a better job at advertising that. So something we'll get better
- 30:52at over time, but yeah, cool. Wow. People listening now know. Then also I think interestingly related to
- 30:58both the micro framework side of the story, but also the new features like, especially the async stuff,
- 31:04Rohit asks, which will be the most compatible database to supporting framework for Flask.io on
- 31:10one hand, like just do whatever you want. Right. But on the other, you've got Flask SQL
- 31:14Alchemy as an extension. You've got the ability to use like tortoise ORM because of the async support.
- 31:21Like there are new options, right? What do you think? Yeah. I mean, Flask makes no requirement.
- 31:25It doesn't affect what database you use. Flask SQLAlchemy that will have a 3.0 release
- 31:31similar to these soon-ish. I think I'm going to take a little break after this release first,
- 31:37but it should continue to work. What's the, you know, SQLAlchemy 1.4
- 31:42just released with the first async API and they're moving towards 2.0 as well
- 31:47with a new API. What's the story around their new
- 31:51API and the SQLAlchemy async support with Flask SQLAlchemy?
- 31:55Is there anything overlapping there? So Flask SQLAlchemy is compatible with 1.4 right now. I did make a
- 32:01little bug fix release recently for that. 2.0 is just deprecating things. So, and nothing that Flask SQL
- 32:08Alchemy uses is going away. So it'll work with SQLAlchemy 2.0 when that happens. In terms of the async
- 32:15stuff, we might, Flask SQLAlchemy, like the extension might have to do something if we want to enable using
- 32:21that pattern. But we might also not because it's using a pretty clever use of greenlets to enable
- 32:29compatibility between sync and async code. And Flask's async support should support that out of the box,
- 32:36or not out of the box, but it's possible to extend it to do that.
- 32:40Yeah, super cool. All right. Another thing I saw in the release notes was that around Werkzeug,
- 32:45there's performance improvements coming in Flask and Werkzeug. Want to just give people a little
- 32:51insight into what's coming there?
- 32:52Yeah. One of the things I think the one that got the most attention, got some interest on the Python
- 32:57subreddit, was an improvement we did to the form parsing. So I think there's this issue that's about
- 33:03five years old saying it was a bit slow, especially for large files. And as David mentioned earlier,
- 33:08we were looking at moving that to be Sans.io. And in the work to do that, the original author of that
- 33:14issue actually came back and said, Oh, if you do this, you'll make it a lot quicker as well. And when
- 33:18we did that, he pointed out, we've made it about 10 to 15 times quicker than the previous form parser.
- 33:24So yeah, so if you're being sent files to your Flask server, it should be a lot quicker.
- 33:29Yeah. Form data in general is faster. And then if you're uploading large files, that's way,
- 33:35faster than what it used to be. Oh, wow. Like multi-part form upload type of files.
- 33:40Yeah. So if you were uploading even like hundreds of megabytes, it could be really slow in some cases.
- 33:45And so now you can just upload gigabytes of ISOs if you want. It should work fine.
- 33:51Nice. Just like streams in or something.
- 33:53I mean, it'll still take as long as it takes to upload.
- 33:55Yeah. It doesn't make it worse. I see. Cool.
- 34:00But I don't know. I think I'm trying to think if there were any other performance improvements in
- 34:04Varick Swag. I know a couple of releases ago, we made a pretty big one where to our URL building,
- 34:10which made it like 10 times faster or something that's already released. So, but it has been
- 34:14getting faster. Yeah. Okay.
- 34:15We haven't measured it. I think the work taking out all the compatibility shims and just going pure Python 3 should be noticeable.
- 34:24Yeah. Since we removed all the compatibility code for Python 2 stuff, like literally the .compat.py files are gone
- 34:32and all the code that was calling that. There's still some more work to be done on that in terms of like
- 34:37accepting both bytes and strings in a lot of places where it doesn't really make sense anymore.
- 34:40So there's still some overhead, but there's a lot less compatibility overhead than there was before.
- 34:45But yeah, it hasn't been measured, but I expect that to be noticeable because when Virk Swag and Flask first added support for Python 3,
- 34:53you know, going the other direction. So it was Python 2 only, and then it became Python 3.
- 34:58Some people stuck with like really old versions of Virk Swag and Flask because there was a noticeable performance degradation by adding all that compatibility code.
- 35:06So now that it's gone, it should be better.
- 35:09Yeah, fantastic. I know the NumPy people, they actually got a lot better. They shrunk their code a bunch by dropping 2.0 or Python 2, 2.7. And similar for you all?
- 35:21Yeah, it's just, I mean, besides the performance improvements, it's just more maintainable now.
- 35:26I pushed really hard to drop Python 2.0 even before it went end of life. I started thinking about how to do it because I never used Python 2.0 back then, and I still don't know.
- 35:36So every time I had to fix something, I had to like, oh gosh, now I got to run the Python 2.0 version of the tests and figure out how to like make some weird compatibility shim, you know, between the two.
- 35:47So it was a nightmare maintenance for like maintainers and contributors.
- 35:50Yeah, I was going to say it's probably easier for contributors as well now to come in because they don't have to, you know, a lot of people these days, they don't know Python 2, right?
- 35:58Right, exactly.
- 35:59They don't want to come in and like learn, you know, something from 10 years ago so they can keep it compatible. They just want to add the new feature.
- 36:05Yeah. If you somehow have like a Python 3.5 application still, you can stick with Flask 1.1. You'll still get your application working just fine. I mean, we're not going to be supporting it because we just don't have that capacity.
- 36:18But the libraries are fairly stable, you know, like we almost never get bug reports asking us to backport something, for example.
- 36:26You know, I use Dependabot like pretty much anybody who uses GitHub does, at least for security.
- 36:31Right. I think people have become a lot more aware overall of that they should be pinning dependencies and how to do that and how to upgrade intentionally.
- 36:39And so hopefully over time that, you know, less people will be surprised by updates and their applications will continue working with the versions they work with.
- 36:47Right, exactly. And if you're worried about these changes, just pin it to 1.11 or whatever it is and just let it be until you're really ready.
- 36:54But also you'll get notified of any security issues that you might need to jump in and fix, right?
- 36:59So I know what I was going to say is I don't remember seeing any around Flask and Rixzoig almost ever.
- 37:05So they're pretty stable, it seems.
- 37:07It's pretty rare for there to be like critical bugs or security related bugs reported.
- 37:12We get stuff every now and then, but we just make a point release.
- 37:15Yeah. And Rohit asked previously about like, why would I use something like Flask over say something like Django?
- 37:20I noticed security releases for Django more often. And I think it's because they just have so much more going on.
- 37:26Like they have a whole admin section with forms and input and you guys just, if it's not there, it can't have a vulnerability in it.
- 37:33There's a much larger attack surface. Yeah.
- 37:35Yes, exactly.
- 37:36But it's not that Django is less secure overall though. I mean, first of all, they're releasing all these security updates.
- 37:42So they're staying secure, but I think they have a much larger team. And so they have the capacity to do these sorts of analysis that maybe we don't.
- 37:51I'm not saying like, I think Flask is insecure, but it could be that, you know, they're just, they've just got more eyeballs on these things.
- 37:58Fuck like noticing like, oh yeah, we shouldn't do this. We can make it safer or something like that.
- 38:05Yeah. Yeah. And I just think the surface area is so much larger.
- 38:08Yeah.
- 38:08It's bound to happen.
- 38:10Maybe someday we'll be in that position for Flask too.
- 38:12Doug says, oh man, trying to get in Django, my new job, so much magic, too much magic happening there for me.
- 38:19But he also has a question that I think maybe, you know, Phil, you spoke about in your presentation.
- 38:25Like does this release change how you run in production?
- 38:29Like Unicorn versus Micro Whiskey versus who knows what? Hypercorn.
- 38:34The good thing to say is that, no, it doesn't change it at all. It still works the same and you can still use Unicorn
- 38:40and use the async capabilities now in Flask. If you wish to use an ASGI server, you can as well. You need some middleware and adapter to do it.
- 38:49And there's some examples in the Flask docs if you want to see which one we recommend.
- 38:53So you can choose any server.
- 38:55But yeah, very important for me to point out that you don't have to change anything. You can just carry on as before.
- 39:00Yeah. So if you want, how would you categorize? You actually in your talk spoke about a spectrum of async capability.
- 39:06On one hand, you have Flask with its decent async support, but not full AGSI server capabilities.
- 39:15And then you've got Court, which can be 100% ASGI. And so you kind of thought of it as a spectrum, right?
- 39:20Yeah. So my idea is that if your code base is mostly sync, as it may have started, then Flask is a great choice.
- 39:27If you want to add a bit of async here and there, it's still a great choice.
- 39:30It's only when perhaps you want to go fully async or you've mostly async with maybe a few sync pieces of code that you actually would choose Court.
- 39:39But I think the really nice thing for the user is you can hopefully just go across that spectrum, eventually change the name, but then just continue.
- 39:46And it's a pleasant experience is my hope.
- 39:49Yeah. Awesome.
- 39:50You should still be able to use the same WSGI servers, basically.
- 39:53Like we've said a couple of times, like we're not breaking anything.
- 39:56We're not changing how Flask works or anything like that.
- 39:59So you still deploy it the same way.
- 40:01And if you do want to use an ASGI framework or server for some reason, you can always use an adapter to serve a WSGI app over ASGI too.
- 40:09You just don't get any of the benefits, really.
- 40:11Yeah.
- 40:11And Doug makes a good point out there that Flask for the Wind is still making GUnicorn a good solution.
- 40:15With GUnicorn, you can change the worker type, right?
- 40:20You can let it be the regular one, or you can say, I think it's dash K for the option.
- 40:24Change the worker type to uvicorn workers, which would switch it to be an ASGI version.
- 40:31So you don't even necessarily have to change anything, but like part of your command line for your startup of your GUnicorn.
- 40:37And that could be the total change you have to do.
- 40:40And going back to a point that Phil made earlier, in the same way, you could change the worker to use like G-Event or something and already have an ASYNC Flask, just, you know, with an older version of ASYNC code or an older implementation.
- 40:55Yeah. And Joe out there says, I had to look at the new ASYNC I-O features, but it seems from the docs that it's early days and maybe later versions will get more ASYNC I-O adoptions.
- 41:06I guess that's a good direction to have a quick chat about.
- 41:09So what's the, so this is 2.0.
- 41:11Is this where you see it sort of landing or do you see this as a progression?
- 41:15I think it's fair to say it's a, it's a progression.
- 41:17Definitely.
- 41:18I mean, the ideal outcome in the end would be to somehow merge Flask and Quart users, be able to use any amount of ASYNC and, or Biaski or Whiskey and everything just, just works nicely for them.
- 41:29Really.
- 41:29Again, as I said earlier, I'm a bit skeptical about whether that could be the one namespace I just call Flask or whether you need to split it up as it is now.
- 41:36But yeah, I think it's the start.
- 41:38Hopefully we can, we can keep going.
- 41:39Yeah.
- 41:40Like the ASYNC stuff we've gotten there so far is for supporting the most important thing that we thought people were needing ASYNC for, which is I have some ASYNC code or like I'm using discord.py, for example, to write a discord bot or something.
- 41:56That's all ASYNC, right?
- 41:57So if you want to write that code, you need to type ASYNC def and put your code in there.
- 42:02Right.
- 42:02So we're enabling that.
- 42:04We've got extension points to change, you know, what ASYNC IO loop you're using, like ASYNC IO versus Trio versus Greenback.
- 42:12Or uvloop or something maybe.
- 42:13Or you, I'm not sure if that would tie in.
- 42:16Phil might be able to answer that.
- 42:17And then like, you know, addressing things like being able to do web sockets and that sort of thing.
- 42:21We might be able to do that in Flask eventually, or that might be the place where you switch over to the Quart namespace.
- 42:26And, but you're using the same API.
- 42:28It's just a different name.
- 42:29Yeah, Phil, that's something I wanted to ask you about it.
- 42:31Just to let you give a quick shout out about is the web socket support that you all have in Quart.
- 42:36Oh, yeah.
- 42:37I mean, I don't know if there's much more to say than it.
- 42:39It's definitely supported.
- 42:40And you just go ahead and use it.
- 42:42It supports web sockets.
- 42:44You did bring some of that stuff back to Verksoig, though.
- 42:47Because you're using Verksoig in Quart, you needed to be able to route to web socket URLs as opposed to HTTP URLs.
- 42:54And so we now have a way to identify in our Verksoig router whether something is intended to be a web socket or not.
- 43:01So it'll change based on the scheme you're using.
- 43:04I think it's good to point out that Miguel has a kind of experimental support, I think, in Flask as well for web sockets, which is good to keep an eye on.
- 43:12We'll have to see how that goes.
- 43:13Oh, yeah, that was really cool.
- 43:14I don't remember what it was called or anything, but there's a way that GUnicorn will let you take control of the HTTP socket from an endpoint.
- 43:24And so within your Flask view, you could take over controlling the socket and start treating it like a web socket instead.
- 43:31Like an upgrade type thing?
- 43:32Yeah.
- 43:32So you still are in Flask and WSGI mode.
- 43:35So you're still like sync in terms of one worker is blocked handling that one thing.
- 43:38But it's pretty clever.
- 43:40Yeah.
- 43:40And Joe out there throws out that it's Miguel Grinberg.
- 43:43Justin is the Miguel you're talking about.
- 43:45Yeah.
- 43:46There's also Flask socket IO, but this is like a more native thing where you can just do this directly in Flask instead of needing an extension.
- 43:52So cool stuff.
- 43:54Yeah.
- 43:54Super cool.
- 43:55All right.
- 43:55We're getting sort of short on time.
- 43:58So I want to ask a couple of questions.
- 44:00Hit on some high notes as well here.
- 44:02One of the things that I think is pretty exciting that GitHub has done, you know, GitHub, I think, continues to be pretty neat.
- 44:09And one of the things they've done is they've added sponsor support for projects.
- 44:13Has that been helpful to you all?
- 44:15Yeah.
- 44:15We've gotten quite a lot of support.
- 44:18We're part of the PSF.
- 44:19And so we take donations through them.
- 44:22If you go to palletsprojects.com slash donate, you get the PSF donation page.
- 44:26We've got lots of people, you know, making one-time donations or scheduled, you know, monthly donations.
- 44:31And we're also part of Tidelift, which is a commercial sort of open source support service that we're getting funding through.
- 44:40And we're also, I mean, this isn't really a sponsor link, but since we host all our docs on Read the Docs, we're partnered with Ethical Ads, which is their advertising platform to share the advertising revenue on all our docs.
- 44:52So we're getting quite a bit of funding.
- 44:54We're going to put it towards Flask conferences.
- 44:56Yeah, that's fantastic.
- 44:57That's good to hear.
- 44:57I do feel like there's probably a handful of billion-dollar companies that are using Flask at the core that maybe could click that link and do a little more.
- 45:05But, you know, shout out to them.
- 45:07If you're using Flask at your company, take a look at the sponsor links.
- 45:11Yeah.
- 45:12We have lots of plans for what to do with it.
- 45:13Yeah.
- 45:13I was really happy to see GitHub put this in here because, like, just having, like, a little, you know, buy me a coffee link on the side of a homepage, that didn't seem like it worked.
- 45:22But I think this sort of central way, and what's interesting is I didn't realize that you could link to external sponsors.
- 45:28Like, my thought was that that sponsor button really was going through the GitHub sponsor channel or framework or whatever.
- 45:36People recommend that we use GitHub sponsors as well because a lot of companies who are already in GitHub's ecosystem have an easier time clicking that button than something external.
- 45:46So that's something I will be looking into.
- 45:49Kind of like App Store versus not App Store.
- 45:51Like, first go to our site to buy a type of integration, right?
- 45:55I feel like it's almost like that.
- 45:56I would definitely recommend it.
- 45:57I've sponsored some things through the sponsor button there, and it's super easy.
- 46:02Okay.
- 46:03Mars.
- 46:04How about that?
- 46:05Yeah.
- 46:05Flask is on Mars or help the lander get to Mars.
- 46:09And I bet if I pull this up, let me see if I can find your user profile here.
- 46:13I just have to hack the URL.
- 46:14It's going to have to be that way.
- 46:15And I go down here.
- 46:17Here you go.
- 46:18You have the official achievement, Mars 2020 helicopter contributor.
- 46:23How awesome is that?
- 46:25Phil, do you have one of these as well?
- 46:27Yeah, I think so.
- 46:28Yeah, yeah.
- 46:28I'm so jealous.
- 46:29I want one of these.
- 46:30Everybody who's gotten a code contribution to the repositories should have that badge.
- 46:37And there's been plenty more people who have contributed in other ways that should have that badge, but don't.
- 46:43Yeah.
- 46:43Yeah.
- 46:43Yeah.
- 46:43Yeah.
- 46:44You should also have the Arctic vault contributor.
- 46:47Oh, I have the Arctic one, but I turned it off a while ago because I thought it was kind of silly.
- 46:50Yeah.
- 46:51This one is way more.
- 46:53I don't know how that whole system works, but if they had archived Flask 2.0 after all my work was done, I'd be much happier.
- 47:01But they archived it like two years ago now.
- 47:04Yeah.
- 47:05So there's a lot of ways in which Python is being used on Mars.
- 47:10When the lander first landed there and, you know, people said, oh, look, there's the F prime library that was used to power the Ingenuity helicopter.
- 47:21That means Python's there.
- 47:23I'm like, ah, it looks like maybe Python just trained the model and C++ was there.
- 47:27But it turned out in the lander that went down, actually the cameras, all the different angles were controlled by Python.
- 47:32And then getting those images back to JPL was part of Python.
- 47:37And yeah, what's the story of the Flask and Mars?
- 47:41This is so cool.
- 47:41Yeah.
- 47:42So Flask is actually part of F prime.
- 47:44So F prime is like their, I'm not an expert on this, but it's like their flight control software, I think.
- 47:49So it's like a monitoring dashboard for everything.
- 47:51So they're using Flask to provide like all this information about the launches and flights and landings and get updates in real time.
- 47:59So I think that's where our stuff came in.
- 48:01But I'm sure other parts of their code are using Jinja or click in other ways, not necessarily through Flask.
- 48:07Yeah.
- 48:08Wow, that's so cool.
- 48:09What did you all think when you heard this?
- 48:11Every now and then I'll see like a, you know, some big thing like this F prime and I'll, they won't have mentioned Flask or anything, but I'll have to like, somehow I'll have like this intuition that it was used.
- 48:22And so like, I went and just looked at F prime and I like, I'm like, oh, it's Python requirements.txt.
- 48:28Flask.
- 48:30I went and announced it on GitHub.
- 48:31I'm like, wow, check this out.
- 48:33Yeah, that's super cool.
- 48:34Go to the dependency graph.
- 48:35I'm sure we'll see.
- 48:36Yeah.
- 48:36Look what number one dependency right there.
- 48:38There we are.
- 48:39In Flask or RESTful.
- 48:40Yeah.
- 48:40Something to do with APIs here, right?
- 48:41Yeah.
- 48:42Cool.
- 48:42All right.
- 48:43Let's, I guess, round this out with two things, actually.
- 48:47Real quick, though.
- 48:47I want to take a question, I think, or follow up comment from Ikivu.
- 48:51Might be off topic.
- 48:52They say they would love to know more about how to convince a large employer to spend money sponsoring an open source project.
- 49:00I wish I had a good answer for this.
- 49:01I know there has been thought on this.
- 49:04I'm just not the best person to talk about it.
- 49:06I'm not an expert yet.
- 49:07I would say, look at Tidelift.
- 49:10Their company and their whole job is to be that in-between between open source who doesn't know how to convince companies to do this and companies who are using a lot of open source but don't know how to analyze their dependencies and divide up their support.
- 49:24And so if you go look at Tidelift, their whole goal is to enable that sort of thing and discuss it with management and all that.
- 49:32That's not good.
- 49:32Tidelift.
- 49:33Is it?
- 49:33Maybe Tidelift.
- 49:34That's not good.
- 49:35They might be down temporarily.
- 49:37Never seen that before.
- 49:38Maybe HTTP versus HTTPS.
- 49:40Yeah, so that place.
- 49:41I do think this is a good option as well.
- 49:44You know, they sponsored TalkByThon for a little while.
- 49:46And I think they're definitely trying to be creative in this, right?
- 49:48They're trying to offer something to employers that's not just put it on your charity column in the balance sheet.
- 49:55They're like, we don't have a charity column in the balance sheet.
- 49:57What are you talking about, right?
- 49:58So doing something a little bit different there.
- 50:01You can look at it, I think, as a company as part of your recruiting spend.
- 50:05I think every company knows how competitive the market is.
- 50:07And I do think engineers do like what interests and what you do in the open source community and look at it in a positive light.
- 50:15So I think that might help.
- 50:17I totally agree.
- 50:17A couple other quick follow-up questions.
- 50:19Olga asks, can F Prime connect to APIs on Earth?
- 50:24Like, do you guys know anything about this?
- 50:26I think it is used on Earth as well.
- 50:27I mean, like I said, it's like a monitoring dashboard.
- 50:29So it's not something that's actively running on the rover, I think, from what I understand.
- 50:35I think it is accepting data from sources like the rover and other systems and then displaying that and coordinating it.
- 50:43Very, very cool.
- 50:43And then Joe asks if Armin Roeneker's still involved with the project, any?
- 50:48Armin is not.
- 50:51He's still part of the GitHub organization and he's like in our maintainer channel on Discord, but he's moved on to other things.
- 50:58You know, he's working in Rust a lot and other things.
- 51:01My impression is he's kind of moved on to Rust and is just enjoying his time there, which is totally fine.
- 51:06Like people don't have to stick with one technology their whole life, right?
- 51:09Right, right.
- 51:09They make big contributions.
- 51:10That's one of the things I've been trying to do, too, since I became a maintainer was get more maintainers, right?
- 51:17So it's not just Armin and then after Armin, it's not just me.
- 51:21You know, I'm trying to expand it so it doesn't matter if Armin or I are still involved.
- 51:26Yeah.
- 51:26And Box of Ninjas out there says, I need the Mars endpoint.
- 51:29Yeah, I don't think they just let that out to anybody.
- 51:33Yeah, there's probably...
- 51:34They don't put auth in there.
- 51:36It's hard to find the endpoint.
- 51:39Next to the right satellite at the right time.
- 51:41Exactly.
- 51:41You can just tunnel over there.
- 51:43All right.
- 51:44So I think that's probably all the stuff we got time for.
- 51:48But, you know, thank you guys for covering this.
- 51:50Let me ask you the last two questions before you get out of here.
- 51:52If you're going to work on Flask or Quark, what editor do you use these days?
- 51:56I've been using PyCharm for almost a decade now, I feel like.
- 52:00Pretty much since I started using Python.
- 52:02So PyCharm, all the way.
- 52:04Right on.
- 52:05Bill?
- 52:05I use Emacs, although I've used VS Code a few times.
- 52:08If I ever record something, I use VS Code.
- 52:10But yeah, Emacs is where I do the work.
- 52:11I do it right down the bare metal.
- 52:13Cool.
- 52:15And then recommend some library package you all have come across recently that you're like,
- 52:20oh, this is super cool.
- 52:20People should know about X.
- 52:22Any ideas?
- 52:23I'm really enjoying using Pydantic to validate the incoming requests, like just as a data
- 52:28class setup.
- 52:29I know you can do it with different ones as well, but the syntax seems so clean just to
- 52:33say this looks exactly like a data class and I just use it to validate my incoming.
- 52:38It's great.
- 52:39That's fantastic.
- 52:39Yeah.
- 52:39One of the things I've started to do as like the first line in my Flask API endpoints
- 52:44is to say Pydantic model equals, you know, class star star.
- 52:49What is it?
- 52:50Request dot JSON.
- 52:51Something like that.
- 52:52Like just immediately try to convert it to invalidate it with Pydantic.
- 52:56Something I learned recently, I had Samuel on the show who creates and maintains Pydantic
- 53:01is, although I didn't learn about it on the show, someone else pointed out to me, there's
- 53:04a, like a secrets capability built right into Pydantic that like works with like .env files
- 53:11and all sorts of stuff.
- 53:12It's got this whole mechanism.
- 53:13So yeah, that library does a bunch of cool stuff.
- 53:15I don't have a good answer for this because I've been just dealing with Flask itself for
- 53:21so long and getting those ready that I haven't really been exploring new stuff for myself.
- 53:25Does this mean I get another?
- 53:26You can have another, but yeah.
- 53:28So like hopefully I get to learn about some new libraries as soon after, you know, Flask
- 53:332.0 goes stable.
- 53:34I will say at work, and this isn't official yet because we're going to, we need to write
- 53:39documentation.
- 53:40It's totally unusable right now because it's not documented, but we've been working on a
- 53:44open source library called AutoInvent, which takes a data model, like such as your SQL
- 53:50Alchemy models and produces an entire GraphQL API and React front end.
- 53:55From just the data model, plus like customizations to some metadata.
- 53:58Oh, that's cool.
- 53:59It's super handy.
- 54:00It's really cool.
- 54:01It's completely undocumented.
- 54:03So I will at some point, maybe half a year from now, announce the actual project.
- 54:08But if you go to an autoinvent.dev, you can see all our messy code right now.
- 54:12Nice.
- 54:13Bill, you got one more.
- 54:14Go for it.
- 54:14Oh, yeah.
- 54:15So Trio, if you've not heard of it, is a different Async Await-based event loop implementation.
- 54:21And I think I really like it because the structured concurrency it introduces is the way, I think,
- 54:27the most Pythonic way to do Async Await.
- 54:30Yeah.
- 54:30Trio is neat.
- 54:30I had the, I don't remember the maintainer's name, but I had him on the show.
- 54:34Nathan?
- 54:34Nathaniel, that's right.
- 54:35I had Nathaniel on the show.
- 54:38And yeah, it's super cool, like how you can have dependencies between, you know, this
- 54:42task, created those tasks, and you cancel one, you cancel them all.
- 54:45There's a lot of interesting patterns that come out of there.
- 54:47Very neat.
- 54:48All right.
- 54:49I think that's it.
- 54:50David, Phil, thank you.
- 54:52Quick shout out or a quick final call to action.
- 54:54People want to get into Flask 2.0.
- 54:56They want to upgrade their stuff.
- 54:58Maybe they want to take advantage of the Async stuff or whatever.
- 55:00What do you tell them?
- 55:01Where do they go from here?
- 55:02Well, look for that new version releasing tomorrow or a week ago, depending on where you listen
- 55:07to this.
- 55:08Follow Palette's team on Twitter if you want to see announcements for new things.
- 55:13And also, if you're interested in like contributing to these projects, I would encourage more people
- 55:19to go on GitHub, you know, at least star the projects you're using, but also watch them,
- 55:24you know, watch for new issues coming in.
- 55:26Anybody can pick up one of these things and help out.
- 55:28Yeah, you know, I think star and fork are the ones that get all the attention.
- 55:33You know, one thing that GitHub just recently added, I know I said that, but I just want to
- 55:37give a little quick awareness to people.
- 55:39I think it's super cool.
- 55:40If you forked a repo, it used to be you'd have to go to CLI and, you know, add an upstream
- 55:47origin.
- 55:48And then you have to kind of keep that in sync.
- 55:49Now they've added a button that if you go to a fork and it's yours, you can just click
- 55:52a button and go sync my fork with the original now.
- 55:56And I think that, you know, encourage people to fork it and just stay up to date a little
- 55:59bit easier.
- 56:00So that's pretty cool as well.
- 56:01Phil, final call to action.
- 56:04What do you say to folks?
- 56:05Maybe something core focused?
- 56:06I think it would be go out and use it and let us know if it solves your needs, if it does
- 56:11what you want.
- 56:11Yeah.
- 56:12Yeah.
- 56:12Awesome.
- 56:12All right.
- 56:13Thank you both for being here.
- 56:14Thanks, Michael.
- 56:15See you later.
- 56:16Yep.
- 56:16Bye.
- 56:17Bye.
- 56:17Bye.
- 56:17This has been another episode of Talk Python To Me.
- 56:21Our guests on this episode were David Lord and Philip Jones, and it's been brought to you
- 56:25by us over at Talk Python Training.
- 56:27Want to level up your Python?
- 56:29We have one of the largest catalogs of Python video courses over at Talk Python.
- 56:33Our content ranges from true beginners to deeply advanced topics like memory and async.
- 56:38And best of all, there's not a subscription in sight.
- 56:41Check it out for yourself at training.talkpython.fm.
- 56:44Be sure to subscribe to the show.
- 56:46Open your favorite podcast app and search for Python.
- 56:48We should be right at the top.
- 56:50You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 56:55and the direct RSS feed at /rss on talkpython.fm.
- 56:59We're live streaming most of our recordings these days.
- 57:02If you want to be part of the show and have your comments featured on the air, be sure to
- 57:07subscribe to our YouTube channel at talkpython.fm/youtube.
- 57:10This is your host, Michael Kennedy.
- 57:12Thanks so much for listening.
- 57:13I really appreciate it.
- 57:15Now get out there and write some Python code.
- 57:16Bye.
- 57:17Bye.
- 57:17Bye.
- 57:17We'll see you next time.