We discuss the major features to expect in Django 3.0, which will be released in December, but the alpha release is available now for testing.
Will Vincent 0:05
Hello, and welcome to Django chat, a weekly podcast on the Django web framework. I'm William Vincent joined as always by Carlton Gibson. Hi, Carlton. Hello, well, how are you? I'm great. And today we have exciting news. We're going to talk about Django 3.0, which is coming out this December. But I believe the feature freeze has just gone into place. So we're going to talk all about what to expect and a little bit about the process that the Django fellows such as yourself go through to make it happen.
Carlton Gibson 0:30
Yeah, so the feature freeze was the ninth of September. And then we put the alpha out on I think, the 10th, or the 11th, maybe the 10th. And so that's available now. So you can go to the website, you can you can download that you can pip install it, and then you can, you can test whether your app is compatible with Django 3.0. And if you can do that, that's super. So the take home message from this podcast is go get the alpha, run it against your test suite, and then please report we've broken it. Because it's this time, what we'd rather have is reports that we broke something now rather than the day after we released the final in December.
Will Vincent 1:07
Right? So let's maybe talk about so what's going to be included, and then we can talk about what you know, missed the cut, and we can have looking forward to in 3.1 3.2.
Carlton Gibson 1:16
Okay, super. So the big headline feature is the ASCII support the HDI support, which is the async support. So this is the first step in the road to making Django async and Django from three point I will speak ASCII, which is the equivalent of whiskey. So, whiskey, what's that? It's the web services gateway interface. It's the standard for Python web servers to communicate with web application frameworks at the back end. And so Django is a whiskey Django is a whiskey framework. flask is a whiskey framework. They're all whiskey frameworks. And up until now, Django is supported whiskey from the the step of what the the evolution of that is towards The asynchronous gateway interface which is ASCII, and channels speaks ag ASCII already and style, it speaks ASCII. And there's a few other frameworks out there that speak that. But j that was now coming into Django core. And so from 3.0, you will be able to run Django your old synchronous your exactly existing Django with an with an ASCII web front, enter Daphne or unicorn or one of these ASCII front ends. But what's kind of what's interesting at that stage is then you can embed that in an ASCII
app. So you could have, I don't know,
a data set application running alongside your Django application. And you could serve those from the same front end, they just sit next to each other. Or you can wrap your, your existing Django application in an ASCII middleware, and then serve that fire and ASCII server, all kinds of interesting
Will Vincent 2:49
things like that. So that's the that's the whole main headline, and this will be opt in so the default will still be whiskey or what's the plan on that? Oh,
Carlton Gibson 2:57
yeah, you just so you'd, you'd configure in So you just start project is exactly the same, you know, nothing changes, you run it with ganache on exactly as you always did. And then if you want to, you can create an A instead of a Ws gi file, you can create an HDI file. And there's Doc's on how to do that and what to include. And basically, the only difference is instead of get whiskey application or whiskey, you import the whiskey get default application function which wraps up the whiskey handler. You there's the same for an ASCII application, which wraps up the ASCII ASCII handler. And it's really the only difference.
Will Vincent 3:33
And can you do this on an app by app basis? Was that what you were saying? No. So that's, so that's the main project level, you decide? Yeah, it's project level. So the the main handler which takes incoming requests and returns back to the server, is either a whiskey handler or an ASIC and you're giving the data set example, which is a Simon Wilson project as if you're used ASCII, you could have that be piping into Django asynchronously, whereas you would need a background worker? Well, you
Carlton Gibson 4:04
do at the moment, you'd route that separately. So you'd have your base as the application, and part of that would go, you'd send to your existing Django app. And part of that you've sent a data set. So you'd have them sort of side by side at this stage.
Will Vincent 4:16
I imagine we'll do a lot of talking and explaining about this going forward. Yeah, with this,
Carlton Gibson 4:20
this is almost going to be every the next two years you know.
Will Vincent 4:24
And so before we get more into it, so who do we have to thank for doing the heavy lifting on this because we've had some guests on but I always like to call out names because I feel like most people there's people in the shadows who do the heavy lifting to make this happen who were the names that come to mind for you.
Carlton Gibson 4:38
Yeah, so this is Andrew Godwin at this stage like he's done all the all the conceptual work on going into this on channels and then on the ASCII ref The, the specification and then the, the sort of core library around ASCII. He's created that one without the inputs from you know, Tom Christie and others. You know, so it's not just him, but he's done that and then he's bought, he pulled this together. It seems almost just out of the blue at the Django con Europe sprints in Copenhagen. We went from all ask he's gonna come we're not quite sure when to Oh, there's a pull request implemented?
Will Vincent 5:17
Well, it makes it easier to say what's what's new and 3.0 it's like, oh, actually, there is something async there.
Carlton Gibson 5:23
Yeah, yeah. Cuz before it was like, well, we're targeting this and you know, but Andy's, you know, he's an absolute superhero. And he's done it. Not all by himself, but largely All right. Yeah.
Will Vincent 5:32
Well, the good news is this episode, we won't have a lag on it. So we'll be releasing it tomorrow. So if you see Andrew at Django con us where you and I will both be starting this weekend. or online, please do send him Tom Christy and others. Thanks, because they don't get much thanks for the work that they do. But we all rely on it. Yeah.
Carlton Gibson 5:52
And they really are pushing the whole ecosystem forward here. So that's super. What can I say? Well, I was gonna say about ASCII. Just say that actual async views, which is kind of where the really the really interesting bit comes will be 3.1 now targeting that, where you'll be able actually to write async these async views which are super for things like proxying to a third party or collating several endpoints into a single response, or, you know, any kind of IO blocking endpoint, you know, people have five to five years ago, you'd have gone to node j s, right? And now you just don't even you don't even have to go to a different Python framework would you have done say, a year ago, 18 months ago, you'll just be able to carry on in Django land as if, you know, nothing changed. And so that's a real that will be a real milestone, that'd be a real step forward.
Will Vincent 6:44
So if you put on your projection hat, how do you think this is going to impact background workers salary? Redis? I mean, I know we don't know. But it has the potential to massively disrupt how you would set that up because right now you have to use a background worker to do async like that. behavior.
Carlton Gibson 7:00
Yeah. So I think us in the short run cues aren't going to go any away. Because they kind of stable and they're mature and they're tested. Whereas this stuff is all new. And it's bleeding edge. And so it won't work as smoothly as you want. But yes, install it. For instance, you can already spin up a background.
Will Vincent 7:22
Can you background? I'll say what starlet is for the listeners.
Carlton Gibson 7:24
So yeah, so sorry. So starlet is Tom Christie's a async. Frame micro framework, I guess you'd call it? I mean, it's
Will Vincent 7:34
the creator of Django rest framework.
Carlton Gibson 7:36
And so he's, he's done a lot of the theoretical work here by laying out started and it was all from a clean plate. So it's not nice, since you know, there's no crusty bits because it's fresh. And it's a lovely little thing, and it's super and it does really show the way forward and so he gave a talk at Django con Europe, about a possible redesign of Django, where basically he was talking about starlet and what he's been doing with, you know, an ORM. There.
Will Vincent 8:05
Yeah, we've linked to that before, but we'll link to that again, cuz it's a fantastic, like 15 minute talk. And he explains async as well as anyone else, what's going on without
Carlton Gibson 8:13
actually saying what's going on with the API? And yeah,
Will Vincent 8:16
and I actually, same with Andrew Godwin, his talk at pi con Australia or Django con Australia. He also lays out the plans for async. So we'll link to those two.
Carlton Gibson 8:26
Yeah, I think he's got his talk at Django con coming up next week. I think he's on the same topic as well.
Will Vincent 8:31
Yeah. So be on the lookout, you know.
Carlton Gibson 8:33
But like, the thing was that when Tom's talk is it was about starlet, but it was supposed to be about Django redesign, but it's exactly how Django is going to end up, you know, it's gonna look very similar to the code that Tom's demonstrating there. And it's, it's much easier to show it with actual code than it is to wave your hands and say, here's some ideas.
Will Vincent 8:49
Right? Well, and this async stuff is really exciting for Django, because I get questions all the time about, you know, Django or some other framework and we've talked in our episode. We've talked about flask and flask is intrinsically tied to whiskey. So it will be interesting to see how it handles a sink. We'd love to get one of the big pools of flask, come on and talk about that. But also, Ruby on Rails, we're going to have David Hannah Meyer Hanson on next week. And I don't believe that Ruby is async or that Rails is. So that'd be interesting question for him. How are they thinking about that? I'm sure he'll have opinions. But this is something in terms of why Django is another feather in the cap of, you know, it's not mature yet, but it will be. And it means that Python has, you know, the ability to do all these node like features there right now, as you said, people say, Oh, I got to use node for this.
Carlton Gibson 9:43
Yeah, you shouldn't, you shouldn't have to change your language just because you need higher throughput. I mean, sure in there will always be some kind of really tight embedded situation where Python is not the language of choice, right? But that shouldn't be the 90% cake that should be the you know, then the one that thousand one in 10,000 case not, you know, 10% of cases where I've got to change frame a language so you don't have to change language and async IO really brings that enables you to stay in Python. And then with Django being at ease, you shouldn't have to change web framework to do these. Yeah,
Will Vincent 10:15
Carlton Gibson 10:16
you know, I need a higher throughput endpoint, you shouldn't have to change your web framework for that. So you won't have to, and that's, for me, it's really super, but we didn't finish talking about background. So install it, you can already spin up a lightweight background task. And yeah, I think we'll bring that in. And then that will, that's not going to be a full queuing solution, you're always going to need, you know, something more robust that but which may be built on top of a thing, but you're gonna, as you scale up, you're always gonna need something more substantial. But for I want to send an email, I want to render a PDF, those kind of basic tasks, web web, out of out of request response web 101, you'll be able to just do in the framework, you know, spinning up a background that's that that that's on the roadmap, but that's how It's gonna be that's, ya know,
Will Vincent 11:01
it's really exciting into the question. So what is there any other major 3.0 features? I mean, that's a pretty big one. Oh ye so the other one other big one is Maria dB, Bertie. So up until now we've supported
Carlton Gibson 11:14
SQL or SQL lite, Postgres, my SQL and Oracle and the my SQL fork, open source fork is Maria dB. And whilst that's kind of has there are compatibility, diff differences and so it's kind of being compatible but not quite and they're out from 3.0 it's officially supported and so all database features will, you know, get the same love and work and attention that they we give to all the right woman in our chat with Adam Johnson. He talked at length about Maria dB, MySQL and yeah, so folks want to learn more about that. So if you're in the if you're in the my SQL, well then Maria DB is the way to go. I think now it's the it's the open source option, and it's I think it's paste if I'm correct. It's paid for pace of development. It's faster. And you know, it's where you want to be. It's where all the mind share. Yes.
Will Vincent 12:05
So what about features that just mess because I saw there's some talk on JSON field. Oh, hang on,
Carlton Gibson 12:10
hang on. Before we know because my other favorite one is that. So this is these are my top three is enums. For choices for model three house. Yeah, you've been you know, you've always been able to Springfield you put the example is school years, right. So you're a freshman sophomore. So that is the canonical example. Right? Well, that's from the doctor. So you've been able to define that using strings. And that's all very well and good. But what you really wanted to always use was a Nina which is a constricted list of specific values, right? So you know, in, it's something that Python didn't have with enums. And then I don't know three point something or other enums came in, but they weren't particularly user friendly and that you couldn't, you had to compare, for instance, the non value with the non value, couldn't compare it with a string and getting the right kind of result the natural API, you It wasn't very good. And so there was. Anyway, that's all been worked around. And you can now use for your model juicy choices, you can use an actual enough. And the nice comparison API's that you want are all been implemented. So it works. It works how you want. So that's a really good feature. I think for most users. That's actually the most significant feature.
Will Vincent 13:21
Yeah. But if you've done anything with choice fields, that's a that's a really big one.
Carlton Gibson 13:25
I mean, Didn't anyone use Jenga braces and it put in a had a choice yessing, which tried to end Yeah. And that was great. But then you've got sort of caught in this. Oh, I've been I've used this Jenga braces field and I can't quite work out how to escape from that because it was it added this whole scaffolding around choices. Well use an enum an enum is is almost always going to be the neck and you there's there's enough special subclasses for string types. So you know if you want to freshman's sophomore senior type enough, there's a special class for that or if you want Introduce the special classes for that. So, you know, 1234 might be your choices. Or you can create a subclass for your own field type, you know? Yeah, you know what you might put in there, because those are the obvious ones. But if you get the most users, that's that's just an awesome addition.
Will Vincent 14:16
Yeah. And who so who do we have to thank? Again, I always like to call out for both both for Maria dB. And then for the Nam, who's who's been leading the charge developmentally? Well, Shay and Nick Pope are the big ones that
Carlton Gibson 14:27
we've been doing. They've yet to Nick push that over the line. Finally, that took a lot of work. It was because there was there was some debates on the mailing list about how it couldn't be this way. And it couldn't be that way. And there was a bit of pushback. So that it's in is awesome. And credit to the
Will Vincent 14:46
three major features for 3.0. There's some symmetry there. Yeah. Oh, well, we won. Speaking of the docs, too. I want to separate from the Google Developers list, because there's also the Django users Google Groups. Which I think most people can agree the format is maybe not ideal. I think Andrew Godwin launched a discourse page that's on I think we'll link to I think it's forums don't tinker with Marcus and Tobias Yeah, a bunch of people. I know. Yeah, I'll link that. And I want to explore him as involved, be pushing that, because I think that's a really welcome addition to the community. Yeah, so that's a discourse forum, right, with discourse being the back end. So yeah, and it's something I've thought about just doing for a long time, because there isn't a great user friendly place for kind of everyone hangs out to answer questions from users.
Carlton Gibson 15:37
Yeah, and I think that's the thing everyone hangs out. I mean, so you know, you're I might start a forum but it's just you know, it's just a forum on our website we know but because it's you know, forum, Django project calm. Hopefully, we can get the critical mass needed to make that into a welcoming and definitive. Yeah, location to get some
Will Vincent 15:55
Exactly, yeah, and we'll put the link but as I typed in forums, that Tango project dot com wasn't working as I was going on, but it's for him. So we should probably redirect on that. So that's exciting news too. So Oh, so I so 3.1. So maybe JSON fields are?
Carlton Gibson 16:14
Yes. So that's that was a Google summer project, some of code project that went on over the summer, and it's so nearly ready. But it was just coming into hot so Sage whose last name escapes me momentarily did that and he's done a brilliant job. And it will be you know, it needs another going over a couple months more and it will be merged in and that will be 3.1. But what that gives us is JSON field for all the supported DBS including Maria dB. Wow. Yeah. And so that's, that's just awesome. Like, so for me, one of the I not always use JSON field, but I use JSON field a lot. And what that has meant for the last few years is that even just spinning up a test project to buy an idea on my laptop, I'm just playing around, I've had to spin up Postgres. Now, I've always got Postgres spin up, but it's just that one extra hurdle was what I really want is to just use SQL. Yeah, I really like SQL lite, I just want to use that. And I want to use that until the point of which I've got concurrent writes, in which case, then I'll, you know, think about switching and haven't been able to do that.
Will Vincent 17:25
Now you can,
Carlton Gibson 17:26
or will, you will be with the JSON with a built in JSON field, I'll be able to do that. And I think that'll be super because people will be able to explore JSON field without this whole extra step of spinning up a
Will Vincent 17:35
separate brain, which there is, I mean, I'm thinking of this in the context of my talk at Django con is gonna be on search, and we're gonna do an episode on that. But to use, Postgres is built in full text search, which is built into Django, you have to spin up Postgres. And that's not an easy task and there isn't. You know, I'll show a way to do it. I like doing it with Docker. And I Show in chapter two of Django for professionals, my new book, you can read that for free online, but there's a lot different ways to do it. And it's a big hurdle. Even for me just going through the examples thinking of the talk, just like kinda like, you know, escape sequel light, start project land and, you know, make a little more real. So it's really nice not to have that hurdle to play with the fields. Yeah,
Carlton Gibson 18:21
but I mean, just out of interest is full text search, supporting SQL like to write
Will Vincent 18:26
so what not we built into we not
Carlton Gibson 18:29
right, okay, so let me just write that down. So you got to get that working. I mean, Simon Wilson has done amazing stuff with such.
Will Vincent 18:36
Yes, he has well, while he's doing
Carlton Gibson 18:39
while we robbing all of that and putting that into jail.
Will Vincent 18:41
Maybe we can ask him at a Django con. Yeah, he's he's started his fellowship at Stanford. So okay, so what? Anything else that was the high point I wanted to, you know, these releases come out it's the version numbers is really scary to beginners. And in practice, it's, you know, Django is quite mature. There aren't Are there any breaking changes? That's actually a good question. I know it'd be a full write up.
Carlton Gibson 19:03
Yeah, there's a list, but they're not that major thing. Like, it's not like when we changed the middleware for one point 10, or something like that, which even that wasn't a big change. You just had to, you know, change the middleware classes to middleware in the settings. And you had three versions in order to do that. So it wasn't the end of the world. But like, there aren't any big structural changes like that is one, right?
Will Vincent 19:23
And we'll, we'll do a full episode. And I'll probably write some tutorials in December when it launches live. But for now, if you're listening, please do. Go get the alpha, try it out.
Carlton Gibson 19:32
Yeah, if you've got continuous integration, and you could run an extra build on your continuous integration with the alpha, then that would be amazing. Because that tells us either that we did break something in which case we can fix it before the final release, or it equally importantly, tells us that we didn't and you know, yeah,
Will Vincent 19:49
that's a win either way. All right, great. Well, this is a shorter one. We want to do some more shorter ones instead of rolling through ones we've been doing recently. So yeah, if you want to give us feedback, we're at chat Django On Twitter, and all the episodes are at Jango chat calm and we have a new newsletter. So if you prefer to get an email telling you about what's happening, there's a link to do that on the website as well. So we'll I'll talk to you next time, Carlton.
Carlton Gibson 20:16
All right. Okay, join us next time. Bye bye