Latest / Talk Python To Me / #147: Quart: Flask, but 3x faster
Transcript
- 0:00There have been a bunch of new Python web frameworks coming out in the past few years.
- 0:03Generally, these have been focused solely on Python 3 and have tried to leverage Python's
- 0:08new async and await features.
- 0:09However, these frameworks have come with their own new APIs.
- 0:13They may be amazing, but it's still something new to learn and a barrier to migrating over
- 0:18to them and between them.
- 0:20That's why when I learned about Cort from Philip Jones, I was excited.
- 0:24It's an async-enabled web framework that attempts to be 100% compatible with Flask,
- 0:29including the extensions.
- 0:30This is Talk Python To Me, episode 147, recorded January 18th, 2018.
- 0:37Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the
- 0:55ecosystem, and the personalities.
- 0:57This is your host, Michael Kennedy.
- 0:59Follow me on Twitter, where I'm @mkennedy.
- 1:01Keep up with the show and listen to past episodes at talkpython.fm.
- 1:05And follow the show on Twitter via at Talk Python.
- 1:08This episode is brought to you by SmartKets and Rollbar.
- 1:11Be sure to check out what they're offering during their segments.
- 1:13It really helps support the show.
- 1:15It's that conference time of year, everyone.
- 1:18There's actually a bunch of interesting things happening around Python conferences.
- 1:22So let's do a quick update.
- 1:24First, we'll do this chronologically.
- 1:26First, Pi Cascades is happening in Vancouver, BC, January 22nd and 23rd.
- 1:31I'm going to be there.
- 1:32So if you are one of the lucky people to have actually gotten a ticket before they sold out,
- 1:36hope to see you there in Vancouver.
- 1:40Next, we have Pi Colombia in Medellin, Colombia.
- 1:42This is February 9th, 10th, and 11th.
- 1:45So if you're in South America or want to go to South America and would love to go to this conference,
- 1:49please check out the Pi Colombia conference.
- 1:52Those guys are doing cool stuff down there.
- 1:53Next up, PiCon Slovakia.
- 1:56This is March 9th to 11th in Bratislava.
- 1:59And I'm actually going to be speaking there and doing a workshop.
- 2:03If you're in Europe and you can make it to Bratislava in March, that would be awesome.
- 2:07Please come say hello or attend one of my talk show workshops.
- 2:10And finally, the big one, PiCon US in Cleveland, Ohio, May 10th.
- 2:15I personally just finalized all my travel plans.
- 2:17I hope to see you there.
- 2:18There's still tickets available.
- 2:20They're not yet sold out as far as I know.
- 2:22So hurry, hurry, because just like Vancouver, they will sell out.
- 2:26We're also going to have a booth with lots of cool giveaway stuff there.
- 2:28So please stop by our booth and say hello if you make it to PiCon US.
- 2:32All of these conferences are amazing.
- 2:34And I hope you can make at least one of them.
- 2:36Now let's get to the interview.
- 2:37Phil, welcome to Talk Python.
- 2:39Thank you.
- 2:40Hello.
- 2:40It's great to have you here.
- 2:42I'm a big fan of asynchronous programming.
- 2:44And I consider myself really a web developer at heart.
- 2:48And so this project that you are creating is really, really interesting to me.
- 2:54Port, kind of an asynchronous version of Flask.
- 2:57And we're going to get into all the details in that and really dig into it.
- 3:00But before we do, let's start with your story.
- 3:02How did you get into programming in Python?
- 3:03So I got into programming to really to make games when I was a teenager.
- 3:08The first one was specifically was to try and make my own version of Cannon Fodder, which
- 3:13I quite enjoy playing around my friend's house.
- 3:15So that's how I got into it.
- 3:16And it was VB originally for me.
- 3:18VB, like VB6 type of thing?
- 3:20Yeah, I think it must have been.
- 3:22Yeah.
- 3:22Or like the Microsoft Visual Basic, right?
- 3:24Yeah.
- 3:25Oh, yeah.
- 3:26Very interesting.
- 3:27That's a long ways from the web.
- 3:28Yeah, definitely.
- 3:29It is cool.
- 3:31So you started out in Visual Basic and created that.
- 3:34And that sounds really fun.
- 3:35Where'd you go from there?
- 3:36Originally figured of doing computer science at university, but I did physics instead.
- 3:40But over the time, I got more and more into coding.
- 3:43And by the time I did my PhD, that was quite heavy on the simulation parts.
- 3:47And later on in the postdoc, I switched, roughly speaking, from C++ to Python.
- 3:53So I'm reasonably new to Python.
- 3:55But that's the kind of overview of how I progressed in the languages.
- 3:59Oh, yeah.
- 4:00Really cool.
- 4:00What was your PhD focus?
- 4:02It was background rejection in neutrino experiments in Canada.
- 4:05And the simulation of the experiment itself.
- 4:09So a lot of physics simulation.
- 4:10Oh, yeah.
- 4:10That's cool.
- 4:11And of course, computation is really front and center in that kind of stuff, right?
- 4:15You can't really explain it anymore without the Monte Carlo simulation.
- 4:19It's too complex.
- 4:20Yeah.
- 4:20Monte Carlo simulations are really amazing.
- 4:23They seem like magic to me.
- 4:24Here's the thing that'll take a month.
- 4:25Oh, but we can do it in five minutes.
- 4:27Very cool.
- 4:28If you're willing to accept a little uncertainty, we can do it really quick.
- 4:30All right.
- 4:31That's cool.
- 4:31So what do you do day to day?
- 4:33Not still physics simulations, right?
- 4:35No.
- 4:35I left physics about three years ago now.
- 4:38I work for a company called Smartkits in London.
- 4:40And they're a betting exchange or event trading exchange.
- 4:44So ideally, we become like the prediction market.
- 4:47So you go to figure out who's going to win an election, for example.
- 4:51That's what we want to be.
- 4:52Oh, that's really cool.
- 4:53So probably a lot of website traffic.
- 4:55Do you have APIs and stuff people can consume?
- 4:58Exactly.
- 4:59So we build the website and the API to interact with the exchange to allow people to trade.
- 5:03So yeah, it's quite heavy on Python.
- 5:06There's some JavaScript and some Erlang as well.
- 5:08Erlang.
- 5:08Okay.
- 5:08Very cool.
- 5:09That sounds like a fun thing to do day to day.
- 5:11And it's not that far removed from this project we're going to talk about.
- 5:14So I kind of want to start the conversation and set the stage by just talking about
- 5:21asyncio in general.
- 5:23So this was introduced in what?
- 5:26Python 3.4, right?
- 5:27I think so.
- 5:28Yeah.
- 5:28I think it was the Tulip project before then, which you could use with Python 3, I think.
- 5:32So yeah, I think it came in the standard library in 3.4.
- 5:36All right.
- 5:36So what's the main idea behind Async IO?
- 5:38I think it's about trying to utilize the CPU as much as you can.
- 5:43So instead of just being idle while you're waiting for IO, you've switched to something
- 5:47else.
- 5:47You gain the concurrency that way.
- 5:49To me, that's what it's about.
- 5:51Yeah.
- 5:51I think one of the real interesting things is web requests are so often waiting on other
- 5:58things.
- 5:59Like at the web server level, at the web framework level, a request comes in and it says, hey,
- 6:05I'm this user.
- 6:06I care about this data.
- 6:07What's the very next thing you do?
- 6:09You either call a microservice.
- 6:11You maybe find it on disk or you go talk to a database.
- 6:14Regardless, that whole process is just going, and I'll just be here for when you need me
- 6:20waiting for you to get back to me on that data so I can give it to the user, right?
- 6:24Yeah, exactly.
- 6:24And so if you could somehow say, well, let's pause that until that bit of work has an answer
- 6:31back from the Async IO, from the IO conversation, right, to the database or whatever, and let some
- 6:40other part of code that's going to run, run, so it can then begin to wait, you know, a lot
- 6:45of hurry up and wait on the web server.
- 6:46And so the Async IO basically means if you're waiting on IO, that same thread can be processing,
- 6:52can release the GIL and be processing other things, which I think is especially important
- 6:57in the web world.
- 6:58I think it goes a bit further as well.
- 7:00Like if you compare it to say threading, which is another way to achieve the same thing in that
- 7:06it's obviously a coroutines are much more lightweight.
- 7:09So you can handle many more of these requests at any point in time than you can with threads.
- 7:15So that's the other part of it that makes it really useful for web servers.
- 7:19Yeah.
- 7:20The lightweight part is really, really interesting.
- 7:22I mean, anyone who's sort of worked with a generator, it's kind of, kind of like that.
- 7:27And threads themselves have all sorts of overhead that comes with them, creating a thread, destroying
- 7:32a thread.
- 7:32So maybe you put them into a thread pool, but threads themselves, they have context switches
- 7:37at the kernel CPU level.
- 7:39They may mess up the cache, right?
- 7:42The L1, L2 cache.
- 7:44And so then they kind of can wreck performance as you cycle between the threads.
- 7:48You know, the cost of a thread varies by operating system, but they can have like a meg of stack
- 7:55space allocated to them.
- 7:56There's all sorts of things that limit how many you can have.
- 7:59So you can have a 10, no problem.
- 8:01A hundred, no problem.
- 8:02A thousand starts to, you know, maybe push the actual memory limits of your computer.
- 8:06With these, the sort of asyncio stuff, you can have many thousands, which is, I think, really
- 8:12awesome.
- 8:12So maybe give us a quick comparison to this concept with like Eventlet or GeoVent.
- 8:18How are they similar or different?
- 8:19So I think Eventlet and GeoVent are the ones you typically use with Flask at the moment.
- 8:25And I think Eventlet is roughly started out as a fork of GeoVent.
- 8:31So they're similar in principle, those two.
- 8:33And they're all three, including AsyncIO, are very similar in principle.
- 8:38They're an event loop that runs tasks or greenlets or coroutines and allow yielding when there's
- 8:45IO.
- 8:45But I think the crucial difference and what AsyncIO, I think, does differently to all the
- 8:51choices I've seen so far is that it makes the yielding explicit.
- 8:54You have to write the await keyword.
- 8:57And that fits the Python philosophy a lot better.
- 9:01Obviously, explicit being better than implicit.
- 9:04And I think it makes it a lot clearer to the user because you now know when these changes
- 9:10are going to happen.
- 9:10And you get a feeling that you're actually writing these yields in your code rather than
- 9:15there's some magic in the background making it happen.
- 9:17Right.
- 9:17Exactly.
- 9:18That's very cool.
- 9:19So basically, anytime you're going to call one of these Async methods, you say await.
- 9:24And that signals to the runtime to say, now we're going to give up this execution and pause
- 9:31until this IO or this event completes.
- 9:34Go on.
- 9:35And you sort of really clearly know and call out where things are going to sort of pause,
- 9:41at least for that request, but also yield the execution.
- 9:44Right.
- 9:44I think it was probably a little clearer before they introduced the Async and await keywords
- 9:49because you'd write an explicit yield to actually yield and a yield front to just switch control
- 9:55to your next coroutine.
- 9:56Whereas just with the await keywords, you could await a coroutine or await something that does
- 10:01yield, but it's not quite clear as much.
- 10:04But still, you know that that line could possibly yield, which makes it a lot clearer.
- 10:09Yeah.
- 10:10Yeah.
- 10:10That's really cool.
- 10:11So one thing that you've talked about is this AsyncIO color problem.
- 10:15What's that?
- 10:15I can't remember who termed it as such.
- 10:18Yeah.
- 10:19I certainly copied their choice because you could imagine coloring certain colors red and the
- 10:25red functions call other red functions and other functions black and the same applies.
- 10:30And the red functions would be coroutines asynchronous functions and the black ones just use synchronous
- 10:35ones.
- 10:35So I think that's where the naming comes from.
- 10:38But the basic problem part of it is that the explicit design forces you to only be able
- 10:44to trigger coroutines asynchronous code from coroutines.
- 10:48So if you have a synchronous function, your standard Python function, it's quite hard to run a coroutine.
- 10:54Right.
- 10:54And that's one of the hearts of the problems of why so many popular web frameworks don't
- 11:01just enable async.
- 11:03Right.
- 11:04Because it comes in through this WSGI interface.
- 11:06It calls, you know, the one function that is in that API and it starts out synchronous.
- 11:12And so there's really no layer, no place where you can sort of inject that easily.
- 11:18Right.
- 11:19Not only is it viral in nature, as soon as you want to await something, you need to be in a
- 11:24asynchronous in a coroutine to do so.
- 11:26To also call that coroutine, you need to be in a coroutine again.
- 11:30So you go all the way up to the event loop that inevitably runs your coroutines.
- 11:34And WSGI, at least in its current form, doesn't have a concept of event loop.
- 11:39So it's not having that.
- 11:41It's also not going to do the IO necessarily in a way that's going to yield to any event loop
- 11:47for you.
- 11:47So even if you introduce it later on, you're not necessarily getting the full advantage
- 11:52of yielding on the IO.
- 11:54You basically have to block and wait to give the request back at some point, or you're going
- 11:59to get ahead of yourself.
- 12:00And that pretty much cancels out all the benefits that you had.
- 12:03So your project says, we're going to take this and we're going to start from this asynchronous
- 12:09level.
- 12:10One thing I do want to call out, and I can't quickly look up where it is, but there's this
- 12:16great article by Christian Medina that says, it's titled something like Controlling Async
- 12:22Creep.
- 12:23And he talks about this problem, this asyncio coloring problem, and different techniques
- 12:29you can have to sort of create boundaries or whatnot.
- 12:32Very, very interesting article around this idea.
- 12:34But let's stay focused on this.
- 12:36So maybe before we get into how people work with Flask, I feel like the Flask API is showing
- 12:44up everywhere.
- 12:45For example, I just recently did a show on Flask Ask, which is like a Flask API for writing,
- 12:51say, Echo Dot type voice interactions.
- 12:55And you just write it as a Flask app, and it just magically plugs into that whole framework
- 13:02from Amazon, which is really cool.
- 13:03So why do you think Flask is so popular?
- 13:05That does sound really cool.
- 13:07I think it's a very clear and concise API to use.
- 13:15I think if you're a very simple example that hello world with the decorator saying this
- 13:21is the root and this is the view function, I think you couldn't get an API clearer than
- 13:25that for a web framework.
- 13:27It's so concise and nice.
- 13:29And I think the design choices Flask has made as a whole just really kind of emphasize this
- 13:35usability.
- 13:36So it might be the request object being a global, for example, just because you're going
- 13:42to use it that way, it makes life so much easier.
- 13:44And so I think this and the familiarity of that API is what kicked it off.
- 13:50And then I think that enabled the really strong community around Flask that probably makes it
- 13:56really popular today.
- 13:57So the great blog posts you can find, especially effectively the large blog post I think everyone
- 14:04starts with from, I think, Michael Grinberg and the extensions on Miguel.
- 14:10Yeah, Miguel Grinberg.
- 14:11And he just, he's actually redoing that one for Python 3 and modern Flask and all that.
- 14:16So like he's halfway through redoing that, which is really exciting as well.
- 14:20Yeah, I'll be sure to link to that.
- 14:21I agree.
- 14:22I think there's also so many plugins you can get to sort of extend Flask, right?
- 14:26There's extensions for almost anything you could want to do.
- 14:29Let's talk about this for a second.
- 14:30What if I have a Flask app, standard Flask, not Quart or anything, frequency like that, and
- 14:36I want to do something asynchronous in it?
- 14:38Like, let's say I want to do WebSockets, which are basically permanent connections, right?
- 14:43That can't easily be done synchronously in sort of a request response style.
- 14:48So how would that go?
- 14:49Can you do it?
- 14:50Yeah.
- 14:51I think typically at the moment you'd use Gevent, at least the two popular ones, which
- 14:55is Flask Sockets, the popular extensions, and Flask Socket.io, I believe use Gevent under
- 15:00the HUD.
- 15:01And you do need the event loop really to make it possible.
- 15:05And with those, it's actually quite easy.
- 15:08I think you just add that extension.
- 15:11It takes care of the rest for you.
- 15:12And you can just decorate a function that you say is a WebSocket root and deal with the WebSocket
- 15:19directly.
- 15:19It's very easy.
- 15:20I see.
- 15:21So does it basically like hand it off to that processing to just run asynchronously on its
- 15:27own?
- 15:27Well, if we take the Flask Socket example, what that does is it'll wrap your Flask app
- 15:32in a Gevent wsgi server and introduce the WebSocket at that level.
- 15:37So a WebSocket request coming in would be handled before it gets to Flask, although it looks like
- 15:43it's going to Flask, but it would be handled beforehand.
- 15:45And then everything else would just go straight through to Flask with the whiskey interface.
- 15:49So yeah, it would work that way.
- 15:52Yeah.
- 15:52Nice.
- 15:52This portion of Talk Python is brought to you by SmartKits.
- 15:56And they're looking to hire someone to write some really awesome Python code.
- 16:00SmartKits operates a world-leading exchange for peer-to-peer trading on sports, politics,
- 16:05and current affairs.
- 16:05As a business, SmartKits is widely recognized as one of the fastest-growing tech companies
- 16:10in Europe and has won a roster of awards for its success over the past few years.
- 16:14Headquartered in London with a new tech hub in downtown LA, the company is pioneering a
- 16:20self-managed organizational structure.
- 16:22This breaks down the traditional pyramid of hierarchical silos into a more fluid and
- 16:26flat network of interlinked teams who are engineers of the driving force.
- 16:30They're no formal bosses.
- 16:31Staff are allowed to set their own salary, have unlimited holiday, and work where they like
- 16:36within the company.
- 16:37Over 60% of the staff are engineers who work on a modern tech stack predominantly based on
- 16:43Python, complemented with Erlang and JavaScript.
- 16:45SmartKits uses Python 3.6 throughout and deploys dockerized microservices multiple times a day.
- 16:52Apply to work at SmartKits by visiting talkpython.fm/SmartKits or just click the link in
- 16:58the episode notes.
- 16:59Suppose I want to have some Flask view method and it's going to say call a web service.
- 17:07It's going to talk to a Postgres database, for example.
- 17:10There are asynchronous ways to do those things, right?
- 17:15If I have aiohttp client, that's a really nice AsyncIO friendly way to call remote services.
- 17:22And I could use the Async Postgres driver there and call that.
- 17:28But with straight Flask, I can't put like Async on my methods, right?
- 17:33Or await in it and really get it to honor that, could I?
- 17:36I don't think so.
- 17:37There was an extension called Flask aiohttp, which I think is no longer maintained.
- 17:43But that, I believe, used the WSGI interface that aiohttp provided, which I think is also
- 17:49deprecated now, sadly.
- 17:50But that would allow you to fairly easily, I think, make your Flask view functions async.
- 17:56But it wasn't, I think it had some issues whereby the locals, the requests, gee, those request
- 18:04locals would get corrupted or could get corrupted.
- 18:07So I think that kind of ruled it out.
- 18:09Yeah, that doesn't sound amazing, right?
- 18:12No, no, you certainly don't want that.
- 18:13There was also a fork, a Flask I found that did make the view functions async.
- 18:20It was designed around async AO for 3.4.
- 18:24But I haven't quite tried to figure out how it worked or if it worked, but it hasn't been
- 18:29touched for about three years.
- 18:31So I don't think that's maintained either.
- 18:33Right.
- 18:33And so this maybe brings us to your project, Quart.
- 18:37All right.
- 18:37What is Quart?
- 18:38So Quart is a web micro framework, much like Flask, based on async AO and the Flask API.
- 18:44So the aim really is to provide the easiest stepping stone from someone who has a Flask
- 18:50app or Flask knowledge to use async in that app or in a new app with that knowledge, basically.
- 18:56So yeah, it's just a web framework, web micro framework.
- 19:00Nice.
- 19:00So you decided instead of, because there are other asyncio frameworks that have come
- 19:06around, Sanic, Chepronto, others that we can talk about later.
- 19:09But generally they said, we're going to come up with a new way to program the web and we're
- 19:15going to sort of do it around this asyncio thing.
- 19:17And you said, look, Flask is super popular.
- 19:20It has this API that people already know.
- 19:23People can go and take Miguel's tutorial and learn about it already.
- 19:28But you just want to have it work with asyncio, right?
- 19:33And so we're going to start from there, right?
- 19:35How much did you borrow from Flask and how much did you have to start from scratch here?
- 19:39I've tried to borrow the entire Flask API and quite a bit of the Verkser API, which is
- 19:45the part under Flask that powers most of the HTTP stuff.
- 19:49I've tried to borrow most of that as well.
- 19:51So yeah, a great deal, hopefully.
- 19:53What I'd really quite like is if you have a Flask app that doesn't use any extensions, you
- 19:59can just find, replace Flask with Quart and then add the async and await keywords and it
- 20:03just runs.
- 20:04That's what I'm kind of aiming for.
- 20:05That's great.
- 20:06And how close is it to that goal?
- 20:08I think it's quite close.
- 20:09I think it's really the details now.
- 20:12So for example, I need to work on the e-tag handling, how they're applied to static files
- 20:18and stuff like that.
- 20:19And subdomain handling in the routing system.
- 20:22I think those are real details that I think most of the use cases, it should be possible
- 20:27to just do that now.
- 20:27To just, as in, find, replace.
- 20:30Oh, that's awesome.
- 20:31You could go like grab Miguel's tutorial and just, I don't know, what's the verb of making
- 20:35it run on Quart?
- 20:36Quartify?
- 20:37Add Quart capabilities to it, right?
- 20:39That'd be cool.
- 20:40Very cool.
- 20:41I guess one of the first questions is why not just fork Flask and just tack on the little
- 20:47bits of asyncio handling that you need?
- 20:50That would be ideal.
- 20:51Well, but at the moment, at least, it's beyond what I'm able to do.
- 20:56And I think it goes back to the Whiskey interface, which really isn't asynchronous.
- 21:01So, again, like if you really want the event loop to be able to get the yield on the request
- 21:06IO and the response IO, you need to be controlling that part.
- 21:09And so I think you have to go start from Flask, go up to VerkSug, and then almost go up to the
- 21:17WSGI servers themselves and make them asynchronous to really, well, I think IO compatible to really
- 21:23make it possible.
- 21:24And, yeah, I could really make that work.
- 21:28It was quite hard.
- 21:30I know a lot of people have tried and they've talked about adding like a Whiskey 2 or various
- 21:39acronyms with A involving in there to basically asyncify that API.
- 21:44But there's really not a lot of flexibility in there.
- 21:47And the actual Whiskey API, which is what all the web frameworks use to plug into the
- 21:53various web servers, right?
- 21:54I want to run on MicroWSGI.
- 21:56I want to run on Gunicorn or whatever.
- 21:58They all speak Whiskey.
- 21:59So you can just plug Pyramid, Flask, Django, whatever in there, right?
- 22:03One of them I was looking at is ASCII, which I think Django is pushing.
- 22:07So I think the idea there is you just push out the messages to a queue and then you have loads
- 22:13of things consuming it in an asynchronous fashion and then returning the results.
- 22:18I don't think it would quite work for Quart either, but they seem to want to.
- 22:22I think they're trying to suggest that as the next step for Whiskey.
- 22:25Like it becomes ASCII.
- 22:26Yeah, yeah.
- 22:27That's one of the acronyms I was thinking of.
- 22:29So how do you add on things like WebSocket support or HTTP2 pipelining where you can make
- 22:37a request and actually through that in single network request punch like three CSS, a JavaScript,
- 22:43an image, an HTML file response as one.
- 22:46Do you think they could make that work there?
- 22:48I think so.
- 22:49Yeah, because each request could just be a separate message on their queue and then something can
- 22:54consume and produce the output and send it back.
- 22:57So I'm sure it would work for them.
- 22:59Maybe you could somehow bundle up the multiple responses or something at the framework level
- 23:04and then send it over to the network.
- 23:06I don't know.
- 23:07It's yeah, it's going to it's going to be pretty interesting with all the HTTP2 stuff coming
- 23:11along and whatnot.
- 23:12Oh, definitely.
- 23:13I think HTTP2 is one of the most more exciting things I'm interested in.
- 23:17And I'm very pleased that Quart can do it.
- 23:20So it's very good to play with.
- 23:22It can.
- 23:22That's really cool.
- 23:23So how much of that is the framework and how much of that is, say, just the server it's
- 23:27running on?
- 23:28Say if you run on Gunicorn, right?
- 23:30How much is Gunicorn doing versus how much of is Quart actually doing to make the HTTP2
- 23:35supported?
- 23:36In a traditional sense, the WSGI server does all the HTTP passing and just passes through
- 23:40the environment.
- 23:41But for Quart, how it works with Gunicorn is we just use the socket.
- 23:46So Gunicorn doesn't actually do any HTTP passing.
- 23:50It all goes through to Quart.
- 23:51So all the HTTP2, the HTTP1, it's all taken care of in Quart.
- 23:55And we just pipe it back out through the socket that Gunicorn's provided.
- 23:59Give us a sense around the kind of performance differences that people could expect.
- 24:04If they, say, have a standard Flask app running on Gunicorn now, if they flip to using Quart
- 24:10also on Gunicorn, what do you think happens?
- 24:13I actually did a, I think you're going to link an article I did to look at this.
- 24:17And I looked at a kind of production use case where you have a simple CRUD app with a database
- 24:24in the background.
- 24:25I used Gunicorn with eventlet.
- 24:27So it was asynchronous, fairly similar type of work load pattern and the way it approaches
- 24:34the problem.
- 24:35And I compared it against Quart.
- 24:36And I think with Quart, I got something like a free time throughput speed up.
- 24:41So the latency or the request time itself didn't really make too much of a difference.
- 24:47But the amount of requests it could handle at once really increased.
- 24:50Yeah, that's really cool.
- 24:51And I would guess that you're probably were not working with like a super slow database
- 24:57or a tremendous amount of data in your simple test.
- 25:00But it seems to me like the worse the database performs, the more beneficial having this asynchronous
- 25:07thing could be to sort of free up the waiting.
- 25:11The waiting, the worse the waiting is, the more beneficial is to have async methods.
- 25:16Although that should apply to both sides of the test because eventlet would do the same
- 25:21in the flask sense.
- 25:22Right.
- 25:23OK, yeah.
- 25:23So if you're already switching to eventlet, then it would.
- 25:27Have you thought about this relative to a non-async flask, like just a standard flask, if you're
- 25:34not using eventlet?
- 25:35Yeah, it makes a huge difference then because your requests effectively become synchronous.
- 25:39You have to do one at a time.
- 25:41So unless I suppose you used threading.
- 25:43I haven't tried threading, but assuming you've got no asynchronous aspect at all, then it would
- 25:48make a very large difference because you would have to finish the one request before you could
- 25:52even start the next.
- 25:52That's for sure.
- 25:53How interesting.
- 25:54OK, so you talked about flask and I said one of the benefits of it is these flask extensions,
- 26:01right?
- 26:01There's a bunch of stuff you can plug in.
- 26:03Does Quart support flask extensions?
- 26:06Supports a good fraction of them, I think it's fair to say.
- 26:10So this goes back to that color problem we mentioned earlier, because, of course, all the
- 26:15extensions are synchronous.
- 26:16They have synchronous functions.
- 26:18And inevitably, they're going to try and call some code that's now asynchronous in Quart.
- 26:23And that's where it becomes a problem.
- 26:25So I can go in the details of how it gets around that.
- 26:29But that's why some of them work.
- 26:31Yeah, that'd be kind of interesting, right?
- 26:33Because people are going to pip install these extensions and generally not change the code.
- 26:37And until your framework is popular enough that people are creating sort of async equivalents
- 26:44of their extensions, you have to make these, you have to blend the colors, right?
- 26:48So how are you doing that?
- 26:49It's quite fun to look at.
- 26:50It took quite a bit of time.
- 26:51So if I go back to how you run a coroutine, you need to run it in the event loop.
- 26:56And if you're outside of the event loop, it's quite easy.
- 26:58You just either create or get an event loop and tell it to run a coroutine.
- 27:02And it's all very good.
- 27:03But if you're in a function that's been called by something within the event loop, you can't
- 27:08do that.
- 27:08The actual async arrow function run until complete, for example, will refuse to run because you're
- 27:14inside the event loop.
- 27:15And it turns out this was known back during the tulip days.
- 27:20And someone proposed a solution to this, which was to actually run the event loop again within
- 27:26the event loop to run this particular coroutine.
- 27:29And I think it was rejected because it just made things quite complicated and wasn't a particularly
- 27:35useful use case.
- 27:36But in this case where you've got legacy, well, you have synchronous code, trying to call
- 27:41asynchronous code is exactly what you need to do.
- 27:44So what Quart will do if you want to go down this route is monkey patch the event loop to
- 27:49add a method to run the event loop, if you like, manually for a coroutine that you specify.
- 27:56So it will suspend the event loop it's already in, run it itself, and then restore everything
- 28:01after it's complete.
- 28:02So it probably sounds a bit messy.
- 28:04So it probably is.
- 28:07It sounds like it could create this cascading chain of nested event loops going down and
- 28:12down and down.
- 28:13Yeah, probably so.
- 28:14But it does allow like these extensions with a synchronous call to another function to be
- 28:21able to call an asynchronous function without them being able to tell.
- 28:24There's just a layer in between that does this kind of mapping from sync to async.
- 28:28That's really cool.
- 28:29I'm very creative.
- 28:30So you said it works for most of them.
- 28:33When it fails, what happens?
- 28:34Like, why does it not work?
- 28:35Do you remember?
- 28:36So Flask has these request locals, like the request object or the G object.
- 28:41And when you try and do anything with them or access any attribute of them, it effectively
- 28:46proxies that action to an instance that's local to the thread or greenlit that you're on.
- 28:53And I hope that makes sense.
- 28:54It's proxying, basically.
- 28:56So what I can do in Quart is I can, during that proxy, also take it from a synchronous call to an
- 29:02asynchronous call.
- 29:03So that works really well for these local proxy objects.
- 29:07The problem is when an extension uses the Flask class itself, like the app, because I haven't
- 29:13figured out a way yet to effectively proxy the call and convert it from synchronous to asynchronous.
- 29:18So if the extension just uses these globals, it's good.
- 29:23If it uses the app, I need to be a bit more clever.
- 29:25Hopefully you get that puzzle figured out, because it'd be really cool to have that supported
- 29:29there.
- 29:29Very nice.
- 29:30So what template languages are supported?
- 29:33You have Jinja 2?
- 29:35It follows the Flask design in that respect and just does Jinja 2.
- 29:38But I'm sure like the, I think there's an extension called Flask Maco.
- 29:42It's quite popular.
- 29:43I think that may work as well.
- 29:46The question becomes whether that template in engine is asynchronous itself.
- 29:50So if it isn't, you just get a bit of a performance hit.
- 29:53Right.
- 29:53I see.
- 29:54So the Jinja 2 one supports asynchronous behaviors in directly?
- 29:59It does.
- 29:59It's actually, if you look at the code, it's kind of amazing how they do it.
- 30:03So if you're running Python 3.6 and you ask it to be asynchronous, it will patch itself to
- 30:08add the asynchronous methods.
- 30:10It's, yeah, it's really quite good to look at.
- 30:12Wow, that's quite awesome, actually.
- 30:14I didn't realize it did that.
- 30:15So I'm guessing you don't support Python 2 in this.
- 30:19Is it Python 3 only?
- 30:20It is.
- 30:21It's even more restrictive than that, actually.
- 30:23It's Python 3.6 only because I use asynchronous generators.
- 30:27One of the uses being if you want to stream a response, you want to yield data back whilst
- 30:32being asynchronous.
- 30:33So because of that, you can't use anything other than Python 3.6 where they were introduced.
- 30:37Yeah, that's really interesting.
- 30:39So I feel like a few years ago, the story was, well, people can't move to Python 3 because
- 30:44there's all this cool stuff that we're using that only supports Python 2.
- 30:48And now I think more and more we're ending up in a situation where it's
- 30:52there's all these amazing new things.
- 30:54But they're only accessible to you if you're using the latest versions of Python 3, which
- 30:58I think that's a good move.
- 31:00The other thing it does as well, which really constrains it to Python 3 or I've used is I
- 31:04type into everything, including the variables, which the syntax, well, the nicest syntax was
- 31:09only introduced in Python 3.6.
- 31:10So yeah, I quite like that as well.
- 31:13I really do as well.
- 31:14I find it makes the editors much smarter about the types of things you're actually working
- 31:18with.
- 31:19You can run tools and say, no, no, you're passing an answer.
- 31:21You're supposed to pass the whole object, not the ID of the object here.
- 31:24Things like that.
- 31:25It's great.
- 31:26This portion of Talk Python To Me has been brought to you by Rollbar.
- 31:30One of the frustrating things about being a developer is dealing with errors.
- 31:33Relying on users to report errors, digging through log files, trying to debug issues, or getting
- 31:39millions of alerts just flooding your inbox and ruining your day.
- 31:42With Rollbar's full stack error monitoring, you get the context, insight, and control you need
- 31:47to find and fix bugs faster.
- 31:49Adding Rollbar to your Python app is as easy as pip install Rollbar.
- 31:53You can start tracking production errors and deployments in eight minutes or less.
- 31:57Are you considering self-hosting tools for security or compliance reasons?
- 32:01Then you should really check out Rollbar's compliant SaaS option.
- 32:05Get advanced security features and meet compliance without the hassle of self-hosting, including
- 32:10HIPAA, ISO 27001, Privacy Shield, and more.
- 32:14They'd love to give you a demo.
- 32:16Give Rollbar a try today.
- 32:17Go to talkpython.fm/Rollbar and check them out.
- 32:21Yeah, so actually converting your Flask methods to Quart methods is quite easy, right?
- 32:32You just, you have your, let's say, like a review function.
- 32:35I think this is an example you have on your website.
- 32:36You can say def add review data equals request.getJSON.
- 32:40Or you can just say async def add review data equals await request.getJSON.
- 32:46And you just add the async and await keywords and off it goes, right?
- 32:50Yeah.
- 32:50So I think it wouldn't be that hard to convert a small to medium-sized Flask app to Quart.
- 32:57What do you think?
- 32:57How much effort and testing has to be done?
- 32:59I think you're right.
- 33:00I think small ones should be quite easy.
- 33:03What probably make it hard for people is that they're probably going to call something else,
- 33:08like you were saying earlier.
- 33:09If you're going to do a web request to a, or a PHP request to a microservice or something
- 33:14to a database or something like that.
- 33:16And those libraries are likely to be synchronous rather than async.
- 33:20And while this comes back to the color problem, you're going to have to switch from, say,
- 33:24psycopg to asyncpg or your py Redis to like aioredis or requests to aiohttp.
- 33:32And that's probably going to be more work because those APIs are suddenly different usually.
- 33:37I would think probably the Redis wouldn't be that hard.
- 33:40Probably the aiohttp client, not such a big deal.
- 33:43But I feel like when you get down to database stuff, that's where the complexity lives a lot
- 33:49of times.
- 33:49So maybe upgrading the database driver or package to be the async one is probably where it's
- 33:56most challenging.
- 33:57I don't know.
- 33:57Have you tried?
- 33:58Have you got some experience?
- 33:59Yeah, I've played along with myself.
- 34:03And yeah, it's because I typically use psycopg directly.
- 34:07I don't use SQLAlchemy on top of it usually.
- 34:10And that's not too bad.
- 34:12It's fairly easy to change.
- 34:13And it has a big bonus.
- 34:16Like there's an asyncpg.
- 34:17If you look at how MagicStack report the benchmarking for it looks much, much quicker, which is excellent.
- 34:24But yes, if you have a lot of ORM stuff, I think you're almost stuck.
- 34:28I'm not sure I've seen an ORM that's async yet.
- 34:31I know that SQLAlchemy hasn't done it.
- 34:35I feel like there is one out there.
- 34:39And I'm hesitant to say which one I'm guessing it is because if it's wrong, I'll try to put
- 34:46some notes in the show notes or something.
- 34:47I've seen one that I thought allowed it.
- 34:50But yeah, certainly SQLAlchemy doesn't.
- 34:52And that's unfortunate, right?
- 34:55So it kind of says, look, if you're going to do the async stuff, then you're kind of stuck.
- 35:00I guess there's a few things you could do.
- 35:04You could move your requests out, say like another thread that you wrap up and you await
- 35:10that thing's response or something.
- 35:12But it definitely makes it not easy, right?
- 35:15Yeah.
- 35:15So asyncio makes that bit reasonably easy.
- 35:19I think there's a function called running executor, which will do almost exactly what you just said.
- 35:23So yeah, that's probably what you'd have to do.
- 35:25Okay.
- 35:25So I found what I was looking for and it's actually not the ORM itself.
- 35:29It's an add-on.
- 35:29It's called P.
- 35:31So the ORM is PeeWee, which is a sort of a small ORM type of thing.
- 35:36Right.
- 35:36It's, it's pretty popular.
- 35:37It's got close to 5,000 stars, but there's PeeWee dash async, which is an asyncio interface
- 35:44for PeeWee.
- 35:45So that one, that one you can do it.
- 35:48So you can basically say await objects.create or things like that, where you basically do
- 35:55the queries and then you can await the response, which is kind of cool.
- 35:58Oh, that is cool.
- 35:58Yeah.
- 35:58I didn't come across that.
- 35:59Yeah.
- 36:00But it's unfortunate that it's not like the most popular one, like SQLAlchemy or say the
- 36:05Django one or something like this, right?
- 36:07Like it's, yeah.
- 36:09But if people are looking for it, like maybe you'd have to switch to PeeWee async if right
- 36:13now it's written in say SQLAlchemy.
- 36:14I don't know.
- 36:15So what do you think?
- 36:16I'm thinking about this database problem.
- 36:17Like, can you take a SQLAlchemy Flask app or a MongoDB Flask app and somehow shoehorn
- 36:25it in so you can still do these queries?
- 36:27You don't have to completely rewrite your data access layer, but make it async friendly.
- 36:32Easy?
- 36:33Not easy?
- 36:33I think it, in all honesty, it requires a bit of effort.
- 36:36Yes.
- 36:36You'd have to, you'd probably want to choose a different driver.
- 36:40So you need to spend some time looking into it.
- 36:42And then you'd probably have to rewrite a bit to actually make it work.
- 36:45So yeah, I don't think it's all that easy.
- 36:47It doesn't sound easy to me either.
- 36:49Although it may be worth it.
- 36:50It's definitely not going to be just a throw an async and a wait keyword here and there and
- 36:55just go with it, right?
- 36:56Indeed.
- 36:56I think it is.
- 36:58It does look to be worth it.
- 36:59If you, there's some articles by Magic Stack and the way they talk of the performance they
- 37:05can get through the async stuff.
- 37:06It looks really, really good.
- 37:08Really very fast.
- 37:09Yeah.
- 37:09I think it's really quite powerful, but it also probably depends, right?
- 37:13Like you guys, I suspect have a lot of traffic.
- 37:15If you do 10 requests a second on your server or one, maybe just leave it alone, right?
- 37:24Pay $5 more and get a bigger server and just be done with it.
- 37:27There's probably some threshold where below that it's not worth rewriting it until there's
- 37:32enough demand.
- 37:33What do you think?
- 37:34Certainly, yeah.
- 37:34It's, even for us, it's not necessarily worth it to wholesale replace our services with core.
- 37:42I think we're only really kind of experimenting with async O systems at the moment.
- 37:47Cool.
- 37:48So let's compare this a little bit with some of the other, what I consider the Python 3 async
- 37:53web frameworks.
- 37:54So we've got Sanic.
- 37:57We have Jepronto.
- 37:59aiohttp.
- 38:01Like, how do you see your work similar or different to these?
- 38:07There's kind of two approaches have been taken here.
- 38:10And most of the Python 3 async ones I've seen have been more the micro framework style than
- 38:16the Django style.
- 38:17I think there's the ones that are Flask-like, which are Sanic and Jepronto, I think.
- 38:24And then there's aiohttp that I think for very legitimate reasons by design doesn't want
- 38:30to go down the Flask approach.
- 38:31So I think that's basically the first choice.
- 38:34And then I think Quart fits in because it's not Flask-like.
- 38:38Hopefully, it is the Flask API.
- 38:40So I think that sets it aside and it's kind of the motivation for it.
- 38:45So then I think there's kind of that scale.
- 38:47And then there's the what is the aim of the project in that scale.
- 38:50So Sanic and Jepronto, I think, are all about speed as far as I can understand what they're
- 38:56aiming for.
- 38:56They're really about trying to get performance out of it.
- 38:59And I think aiohttp is meant to be kind of like an all-encompassing HTTP library, right?
- 39:06So it does the client side as well as the server.
- 39:08So I think there's these varying kind of aims for the projects.
- 39:12Right.
- 39:12And I think it is a massive advantage to say we're not going to create something Flask-like.
- 39:17We're going to create Flask effectively, but async-enabled natively.
- 39:22And one of the main benefits there is obviously people can migrate more easily to it.
- 39:27You already talked about the Flask extensions, all those kinds of things, right?
- 39:30To me, it's mostly about not having to learn something new.
- 39:33So I did play with Sanic.
- 39:35I quite like Sanic, but I didn't want to have to learn how Sanic did things.
- 39:38Yeah, exactly.
- 39:41And if you want to go on Stack Overflow and ask, how do I do this with my web framework X?
- 39:46You'll have way more answers if X equals Flask.
- 39:49It's true.
- 39:49Definitely.
- 39:50Yeah.
- 39:50Just the more tutorials, more courses, et cetera, et cetera.
- 39:53Although I suspect there's minor differences.
- 39:55The majority of it is kind of still the Flask API, the Flask story, right?
- 39:59Certainly, there is differences in the details and obviously async.
- 40:04Yeah.
- 40:04So what are the hangups people might get trying to switch to court?
- 40:07Are there things they have to be on the lookout for just due to the async nature or how careful
- 40:14they got to be?
- 40:15I think one of the most annoying parts is if you have a coroutine.
- 40:21Say you want the example you said where you await the request.getJSON.
- 40:24If you forget to write the await word, then the data, let me start again.
- 40:29If you have data equals request.getJSON in your Flask and you change it to Quartz, that line
- 40:35of code will still run.
- 40:36It's just that data would now hold a coroutine object instead of the data you're expecting.
- 40:41And that could probably catch you up quite easily because until you try and use it, you
- 40:46don't know that it's going to be something different.
- 40:48What do you mean status code doesn't exist anymore on this thing?
- 40:52Like, why did this start failing?
- 40:54Why are the attributes missing, right?
- 40:55Of course, because you didn't await it.
- 40:56Yeah.
- 40:58Interesting.
- 40:58So let's talk about the deployment story.
- 41:01You talk a lot about using GUnicorn.
- 41:03Is it, you said you can basically run both Quartz and Flask apps on top of that in more or
- 41:08less the same way, but just different config settings, right?
- 41:10Yeah.
- 41:11You just change the worker and that should be enough.
- 41:15Nice.
- 41:15Yeah.
- 41:15So you say eventlet is the one to use for Flask and Quart-UVloop for Quart.
- 41:22UVloop's pretty interesting.
- 41:24Why don't you tell people about that?
- 41:25My understanding, which I think is wrong, is that the kind of history goes from libEvent
- 41:29to libEvent, which is what eventlet and gvent, I think, are based on, to libUV.
- 41:34And they're all improvements on the previous iteration.
- 41:38And UVloop is the kind of Python bindings to change the async loop policy to use UVloop
- 41:46instead of the default one.
- 41:47And the reason you'd want to do this is because it looks like, from all the stuff that's been
- 41:52published, that UVloop really does make things run a lot quicker.
- 41:55And if I understand it correctly, it's the same kind of base event loop that Node.js uses.
- 42:03So it's got some proven track record of being very good.
- 42:07So yeah, if you switch it to the UVloop worker, you can really get some performance boosts.
- 42:13I get the same impression reading around that UVloop definitely speeds that up.
- 42:17And it's cool that it's the same one that Node.js runs on because Node.js, for all of its flaws
- 42:22and challenges, is definitely good at handling lots of requests based on IO completion waiting
- 42:29behaviors, right?
- 42:30Yeah, definitely.
- 42:30I find it kind of amusing if I've understood the history right, is that UVloop is a rewrite
- 42:35of EV, LibEV, LibUV is a rewrite to work on Windows.
- 42:40At least that was the original motivation.
- 42:42But as I understand it, the UVloop kind of bindings doesn't work on Windows.
- 42:46So I find that kind of like sad irony.
- 42:49That is very ironic.
- 42:51It's turned its back on its origin.
- 42:54How interesting.
- 42:56So have you talked with Armin Roedeker, the guy who maintains Creative Flask, about what
- 43:02you've done, how it maybe could be contributed back to Flask, what those guys are up to, things
- 43:08like that?
- 43:08I haven't, no.
- 43:09I was actually hoping, because I think you've spoke to him on this program.
- 43:12I was going to ask if you could introduce me, which would be excellent.
- 43:15Yeah, I'd be happy to.
- 43:16Sure.
- 43:17Yeah, I don't really know what's going on in official Flask around all this stuff.
- 43:22So it seems like you've got a really nice head start.
- 43:25So that's cool.
- 43:26I don't know what's going on officially for Flask either, but it doesn't look like they're
- 43:29actively pursuing AsyncIO at the moment.
- 43:31It looks like they're pursuing the release one of Flask, as far as I can tell, which would
- 43:37be great as well.
- 43:38Yeah, it would be great.
- 43:38I suspect making major changes to Flask in terms of APIs and stuff is a slow, tedious,
- 43:46careful process.
- 43:48Same thing for Django and for Pyramid.
- 43:50These are well-established, long-living web frameworks.
- 43:54Compatibility is probably a top concern.
- 43:57And I think you probably have to make some difficult changes to introduce AsyncIO as well.
- 44:02So I guess my hope would be that Quart proves that this is desired and useful.
- 44:07And then there's more kind of desire to actually make some Flask changes and to be able to
- 44:13merge the two.
- 44:13Yeah, then you'll push a major, major pull request over to Flask.
- 44:17Well, it would have to be Flask and Virgisk, I think, if it's ever going to be possible.
- 44:22Yeah, yeah, for sure.
- 44:23Yeah, very cool.
- 44:25All right.
- 44:25So where are you going in terms of the future for Quart?
- 44:29What's next?
- 44:30I said earlier, there's details about the API that don't fully match at the moment, which
- 44:35obviously I need to get correct.
- 44:37So like little details about how e-tags are used and how static files are served, that
- 44:42kind of thing.
- 44:42After that, I want to kind of like really demonstrate the robustness of the HTTP2 handling and the
- 44:49WebSocket handling.
- 44:50So luckily, there's some compliance testing projects out there, which I can use for that.
- 44:56And then it's also about the development process.
- 44:59So Flask and Virgisk have this really nice kind of debug web page that tells you what's
- 45:03going wrong when you try and do something.
- 45:05I think Quart needs something like that as well.
- 45:06Sounds very cool.
- 45:07One of the areas of performance that we spoke about was with Async and Await and sort of
- 45:13the asynchronous view.
- 45:15We also talked about HTTP2.
- 45:18How do you see that affecting performance?
- 45:20Do you see like the ability to have HTTP2 also adding like another layer of speedups?
- 45:25I do see that it makes things quicker when I test it.
- 45:29I haven't published anything yet because I haven't really figured out what a kind of safe
- 45:34comparison benchmark is because the cost of opening connections is quite high.
- 45:38Maybe you should include that.
- 45:40But you could effectively pipeline your maybe 20 connections down one and get a big difference.
- 45:47But whether that's fair or not, I'm not sure.
- 45:49So I don't know how to talk about it in a fair way.
- 45:52It's really precarious to publish benchmarks.
- 45:56Yeah, definitely.
- 45:57No matter what you do, there's always someone that's going to show you how you're wrong.
- 46:02And usually what that means is you're wrong because I use it this way and you're measuring
- 46:09it that way.
- 46:10And if I used it the way I use it, it wouldn't give you the same results as the way that you
- 46:15use it.
- 46:15And so your results are misleading or whatever, right?
- 46:18And it's just really hard to get something truly representative of what people are doing
- 46:22when they're doing all these different things, I think.
- 46:24One thing I'd really like to do if I could convince my colleagues is change one of our edge
- 46:28servers to be HTTP2.
- 46:30And then you'd be able to see quite a big difference in real use cases.
- 46:34So that'd be excellent.
- 46:35Yeah, well, let us know when it's out.
- 46:37I'll definitely point people at it.
- 46:39That'd be awesome.
- 46:39It would be.
- 46:40Yeah, yeah.
- 46:40Very cool.
- 46:40So one thing I noticed is you have your project on GitLab and a lot of people have their projects
- 46:46on GitHub.
- 46:47And you've talked about this a little bit.
- 46:49So why GitLab over say GitHub?
- 46:51Initially, it looks a bit silly because GitHub is way more popular than GitLab.
- 46:57And projects tend to be judged by, I think, at least superficially to begin with, by the
- 47:02kind of stars and forks they have, which is always going to be low on GitLab.
- 47:06But for me, GitLab is open source, which sways a lot of it in my mind.
- 47:12It certainly made a difference to the company I worked for when we were starting up, like
- 47:16to have such a great open source project we could just use to begin with.
- 47:20And the other thing I kind of like is its CI system is really nicely integrated.
- 47:24And that works very well for Cort at the moment.
- 47:27So it's very easy.
- 47:28So Phil, if you want to work on Cort, what editor do you open up?
- 47:31I use Emacs, although I think I use Emacs really badly.
- 47:35I don't really add any plugins.
- 47:37I tend to use it just in the terminal.
- 47:39Very vanilla.
- 47:41I went through a stage of having it reasonably optimized.
- 47:44And I just reverted it all back to plain.
- 47:47So yeah, I don't put too much in my editor.
- 47:49I probably should.
- 47:50But yeah, I just open Emacs and go from there.
- 47:53All right, cool.
- 47:53And in addition to Cort, which is pip install Cort, right?
- 47:58What other notable high-PI packages are out there that you want to recommend?
- 48:03I think I'll recommend two that I use in Cort.
- 48:05I recommend Flacate, which has certainly caught loads of silly bugs and style issues.
- 48:11I think mostly I use it to take away any discussion or uncertainty about the style.
- 48:17And my-PI for the same reason of catching the bugs and to make sure the documentation is right.
- 48:24Yeah, my-PI is very cool.
- 48:25There's a lot of activity around my-PI right now.
- 48:27It's really nice.
- 48:28For sure.
- 48:28All right, so final call to action.
- 48:31People are interested in Cort.
- 48:32How do they get started?
- 48:33Are you looking for contributors to the project?
- 48:36Things like that?
- 48:37Absolutely, yes.
- 48:38It would be great if people could give it a go.
- 48:40Open issues or pull requests, merge requests of changes.
- 48:44That would be absolutely excellent.
- 48:45And hopefully it's easy.
- 48:47It's just pip install Cort and give it a go.
- 48:49Hopefully it's as easy as Flask.
- 48:51It's like basically five-line quick start.
- 48:54Yeah, that's really cool.
- 48:55And you have a video that's now on YouTube from one of the PyCons, which I'll link to.
- 49:01That's PyCon UK, right?
- 49:032017?
- 49:03Yep, that's the one, yeah.
- 49:04All right, so if people want to watch your video presentation as well, I'll be sure to link to that.
- 49:09So yeah, it looks like a really cool project.
- 49:11Thanks for creating it and coming on the show to share it with everyone.
- 49:14Thank you for the insight.
- 49:15Of course.
- 49:15Talk to you later.
- 49:16Okay, bye.
- 49:18This has been another episode of Talk Python To Me.
- 49:21Today's guest was Philip Jones, and this episode has been brought to you by SmartKits and Rollbar.
- 49:26SmartKits is looking for talented Python developers to build amazing Python 3-based microservices.
- 49:32Apply at talkpython.fm/SmartKits and level up your career.
- 49:37Rollbar takes the pain out of errors.
- 49:40They give you the context and insight you need to quickly locate and fix errors that might have gone unnoticed until your users complain, of course.
- 49:48As Talk Python To Me listeners, track a ridiculous number of errors for free at rollbar.com slash Talk Python To Me.
- 49:56Are you or a colleague trying to learn Python?
- 49:58Have you tried books and videos that just left you bored by covering topics point by point?
- 50:02Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm/course to experience a more engaging way to learn Python.
- 50:11And if you're looking for something a little more advanced, try my WritePythonic code course at talkpython.fm/pythonic.
- 50:18Be sure to subscribe to the show.
- 50:21Open your favorite podcatcher and search for Python.
- 50:23We should be right at the top.
- 50:24You can also find the iTunes feed at /itunes, Google Play feed at /play, and direct RSS feed at /rss on talkpython.fm.
- 50:34This is your host, Michael Kennedy.
- 50:35Thanks so much for listening.
- 50:37I really appreciate it.
- 50:38Now, get out there and write some Python code.
- 50:40I'll see you next time.