Django Chat

Git and Django 5.0 - Adam Johnson

Episode Summary

Adam is a prolific figure in the Django community and the author of a new book, Boost Your Git DX. We discuss the latest Django 5.0 alpha release, how to use aliases, managing third-party packages, and a plethora of tips and tricks with Git to improve your developer workflow.

Episode Notes

Support the Show

Episode Transcription

Will Vincent 0:06
Hi, welcome to another episode of Django Chat, a podcast on the Django web framework. I'm Will Vincent joined by Carlton Gibson. Hello, Carlton.

Carlton Gibson 0:12
Hello Will.

Will Vincent 0:13
We're very pleased to welcome back Adam Johnson, who is well known to many in the Django community and we're gonna talk about his new book on Git. Welcome, Adam.

Adam Johnson 0:20
Hello. Thank you for inviting me on. And I got to say snap. Colton and I are both wearing Django dot social T shirts. You

Will Vincent 0:29
are you are represent what is that? Tell tell people would tell people what that is.

Adam Johnson 0:33
It says series of social meetups held globally. I guess now I think there was there's gonna be one at Django con us. Or my? I'm guessing here, I think but yeah. John Gould recruiter here in the UK for Django specific, who's just a great member of the community giving back a lot hosting these events giving back to the DSF. So Django social says project for running meetups socially everywhere. And he's also ready to help anyone who, who wants to jump on and start a meetup in their city for socializing with Django developers. I've

Carlton Gibson 1:10
thought about doing one they may but I don't know if there are any Django developers near me. So if you if you're a Django developer near me on because Roberts, let me know. And then we'll do a Django social.

Adam Johnson 1:21
Person, Django social.

Will Vincent 1:22
I've been emailing with John, because I'm looking forward to seeing him at Django con us. Are you attending Adam? or you're not? Right.

Adam Johnson 1:28
Only remotely this year? Okay,

Will Vincent 1:31
one Fair enough. Fair enough. Yeah, yeah. All right. So let's talk about Git and may actually, since we have you on Adam, with all your many hats, steering Council, maybe this could also be an opportunity to talk about 5.0. Because we just as we were recording, the feature feature for us just went into effect, I believe,

Adam Johnson 1:48
and the alpha release went out. Yes. 15.

Will Vincent 1:52
So let me let me let me defer to the two of you. What what are what are you all excited about? That's coming out in five, I'm

Carlton Gibson 1:59
gonna unmute other guests, you go first. Okay.

Adam Johnson 2:03
I, I've listed three features that I wanted to highlight. The first would be generated field, which Lily and others push through and Mayas got in at the last minute, this last week. This is a database field that is computed in the database from some calculation across other database fields. So classic example would be you have a user with a first name and a last name. But for some reason, you want to be able to search across their full name, you can create a virtual field there, that is a combination of those two, and then you can write a query set that query is against people's full names. So like, if you've got a type ahead search, you might be able to let someone type part of any part of that name, and it will search across all of it. Without query set tricks. It's all just done once in the model. So be aware of

Carlton Gibson 2:59
how to say, removing some of those annotations that you might have sprinkled about various types, you know, gone, that was one there was two. Okay.

Adam Johnson 3:07
The DB default, yes, which is for defaults computed in the database, rather than by Django, which is, I think, was the oldest open ticket when it got much like number 470, when new tickets are in the 30 3000s. This is big, because having your database as a single source of truth for things like timestamps is, is very useful. It also means Jango doesn't need to do anything extra before saving such fields, you can get the database to do the computation, if necessary.

Carlton Gibson 3:45
Like it ties in for me, we're not with the constraints works that has gone on. So we have constraints. Instead of just having say validation at the form layer, you're able to make the database have loads, and then that feeds back up to the formula now, which is super cool. But then to have constraints and then database DBS database defaults as well. That's like, yeah, brilliant. It's

Adam Johnson 4:06
just great to see Django like expanding to like, cover everything that databases can do and have been able to do for years or decades. In some cases, like database default.

Carlton Gibson 4:17
The related one that didn't quite make it, but I'm thinking might 5.1 is cascades, which is or, you know, the on the lease clauses to have those at the database level. There's a PR open for that, but I think it needs a bit more work to get it over the life.

Adam Johnson 4:32
Yeah. Yeah, I had a look at it. But yeah, that would be cool as well, because of its save, like this giant costs that we often pay winter leading and Django because Django pulls everything in itself before it deletes it. Whereas just letting the database do that work and clean out the disk. It's a lot nicer.

Carlton Gibson 4:52
Okay. And then your third exciting one.

Adam Johnson 4:56
It's a bit more niche, but it's the dash dash durations flag for Well, the test runner in python three point 12. Python 312 added this and now Django five zero exposes it through its wrapper. That's just a great way of seeing like, what are your slowest tests, you can say dash dash durations 10 or show you your 10 slowest tests, and then you know where to work. If you're trying to speed up your Django test,

Carlton Gibson 5:21
dear listener, you might not know Adam has a book on speeding up the Django test. So you should check it out if you haven't seen it already.

Will Vincent 5:32
I was actually just looking through that last week because I was stuck on something. And I was like, wait a minute, I have a book on this. I've read and you know, you had some good advice. So it's worth rereading. Oh, cool. Thanks,

Carlton Gibson 5:42
is there and I guess you're working on the Get book that we're going to talk about. But if you started working on the update there, or that's later on,

Adam Johnson 5:51
I've, I've done some bits as I go, like when I see something has changed in the Django ecosystem, and it's just a few paragraphs to change. I do that, but I haven't pushed those updates yet. Because I'd like to compile with the latest Sphinx and whatever. So that ePubs and come out in the best way they can. That has been an issue in the past with older versions. Okay.

Will Vincent 6:14
Yeah, I can relate. Yeah. It's hard. Like, it's sort of like a chore to put an actual book out. And so there's all these updates that if it were just a website, you could just kind of do. Yeah, yeah. It's even worse when you have a paperback books. But you, you, you smartly, avoid all that. So yeah, lazily

Adam Johnson 6:37
avoid all that.

Will Vincent 6:40
Yeah. So yeah, so.

Carlton Gibson 6:43
But just before we move on from 500, I just went through them. One extra feature, though, which is the field, the form rendering has grown this new attribute, which is field group. So you know how, when you render of a form field, it's got like the feet that the actual input, like, you know, the text input, where you enter your data, it'll have a label, and then it'll have errors. And then it'll have help text and all those things. And that's all great. But when you if you need to customize your form template, having to do all those for each one is a kind of bit of a pain. So bound fields now has this Add Field group helper, which will render that a specific template for groups them all together, which means if you want to customize your form layout, you kind of just do field as field group field is very good. And you do the surrounding market, maybe you want to use a field set, or whatever, it just makes writing those custom forms that much smoother, or that much quicker. I'm really, I'm excited about that. And

Will Vincent 7:37
I'll just shout out, David's David Smith gave a really great talk at Django con Europe, about that transition and what to expect that you can find on the Django con Europe YouTube channel. But I would recommend that if the docs aren't fully sufficient, as they were not for me, but his talk made it very clear. Yeah,

Adam Johnson 7:55
Stella talk stuff.

Will Vincent 7:56
Okay, so get

Carlton Gibson 8:01
it so now we'll cover and easy.

Will Vincent 8:07
Get it together? Yeah, let's make the puns. Well, so it's hard to know, the level of people listening to this podcast, but good is a big deal. Maybe what's the quick Why is it worth its own book of performance enhancements? Short experience enhancements, right? We all use it but what what more can there be beyond you know, get status get add get change?

Adam Johnson 8:32
I mean, that's exactly like the story of where this book came from. I think, for a lot of us, like, I mean, get is good is not the work, right? The work is like building your website. And it's the thing that's there, that's useful, but it's also like in the way of each time you make a change. So I think it naturally becomes something you learn enough to get going and then everyone stops. I think that's also probably a problem from the get Doc's perspective, their docs are incredibly dry, low level use a lot of terms, they mix up terms, because there's like three different names for a commit. So it's quite hard.

Will Vincent 9:13
I meant to say commit, not change. But

Adam Johnson 9:16
it is also called a change, a change set of revision and various other names in the Git Docs is super confusing. So like, I found that like, there's this kind of genre of hit tweet where a developer shares like change this one thing and you'll get conflict and then it gets 10,000 likes because like, oh, wow, that just fixes this thing where I had to annoyingly type a command every time and I just kind of like kept seeing these and I like I changed my own conflict over the last nine years I've used git 1010 years but there's no like central place I found that would explain all these to a new person like you can throw them at your get conflict but that's not really a help. Like, what does this actually do? So this book is basically my attempt to compile all of that stuff that I've seen into one series of logical, short explanations.

Will Vincent 10:11
Lovely. Yeah. What, what, what maybe what's, what's an, what's one example of something that you now use all the time that, like, saves you time improves performance? Like, what are some of the, like, what are we doing wrong, right? We're just using the main, the main big three, and like, that's enough,

Adam Johnson 10:28
like one, one small thing is AutoCorrect. So if you've ever type git commit with one M, it by default just says, I don't know what you're talking about. Maybe you meant commit with two M's, but try again. But the AutoCorrect feature, you can actually switch it. So it like goes, Did you mean commit? And usually those press Yes. Or you can actually have it go immediately. Like, there's only one thing close enough it's commit, let's just do that. So that's like one simple tweak. And that'll actually save you maybe an hour a year, an hour a month, I don't know how well you type.

Carlton Gibson 11:05
That's a bit you know, see the pants isn't it automatically correcting your type I think

Adam Johnson 11:12
I haven't had

Will Vincent 11:15
well, I liked that, you know, we can dive in one of your chapters is on aliases, because this is something I find that you know, beginners have no idea about. And if you see someone do a YouTube video or something, everyone has a slightly different alias, and they just go the speed, they just blast through and it's completely incomprehensible for a beginner. So those are very exciting. And like, maybe you can tell us about that chapter. Because you know, like for me, like I just do GS forget status. You know, all these little things to your point, they still save you real time, but it's just like, how do you learn about them other than peering over the shoulder of someone doing it or seeing some random video? Yeah,

Adam Johnson 11:52
aliases are a great one because they shorten your typing significantly, which also reduces the chance for typos. There's like two kinds of aliases I cover in the book. There's the shell aliases, and the get aliases. So shell aliases are set up in your bash, or Zed sh config. And they can map to any command you can easily say for this, when I type this series of characters actually do this. And that can be five commands in a chain or, or just one command with a bunch of arguments or something like that. In the book, I actually recommend pulling in Oh, my as I chose aliases, even if you don't use a miser shell, because they're a curated standard bunch of aliases. And I've, I've helped actually contribute to those in the writing of the book.

Carlton Gibson 12:44
How Why does that not surprise me a

Adam Johnson 12:49
few things as I was writing just kind of annoyed me better. Yeah, they've got about 300 aliases, you probably only need 20 to 30 of them on a day to day basis. But if you spend the time just to learn those, then you could go way faster, you'll be typing like GC instead of Git commit, GC exclamation mark for Git commit, dash dash amend, and so on. The other kind of alias is the Git alias. That's something you put in your git config. And that's where you have to type git space, and then your alias. That's more useful for wrapping up slightly larger commands with a single word. So I have one in the book that's like Git switch recent, which helps you switch to recent branches that you've committed to it lists them all in order and shows us a

Carlton Gibson 13:44
Git alias to check out a PR, check out the branch for the PR that like basically, I just couldn't work without it. And it's like, get PR and then the number of the PR and it just goes and fetches the branch and, and whatnot. And without that you have to do well, what's the URL? What's the, you know, what's the remote? It's just a lot of faff. Whereas, you know, get PR number down. And yeah, I literally could.

Will Vincent 14:10
Yeah, that sounds like it sounds like a mastodon tweet, Carlos.

Carlton Gibson 14:13
I don't like him tweet, tweets. Just giving life to aliases. Yeah.

Will Vincent 14:21
Well, yeah. And it's, it's, I I've been mentoring someone recently and it's been good for me to just re see. I'm like, well don't you know about this tension about that? And you know, I just you just forget what's what we know. And it's like, well, how would they actually learn that right? There's no and aliases are one of the ones that huge time saver that you may not know about. And as you said also very accident prone like you just that's the thing that when I first got into coding a while ago now, I thought that coders had like perfect typing skills. And now I realize they're like the worst. It's just hit Tab and have all these linting and tools and you know, it's it's almost worse than then writers with a grammar. Yeah. But now you have Grammarly and stuff but you know it's not yet you gotta you gotta do it. Perfect. Perfect. Yeah, there's all these

Adam Johnson 15:14
thanks for the Grammarly recommendation that like it's really helped this book I was finding I wasn't putting commas in the right places.

Will Vincent 15:21
Oh my god, well don't comment Nazis. The cod the comments, the comments thing is really, you know, that's the one area where I consistently I'm like, no, no, no, no, no, I don't need a comment around every every comma single comma word. But anyways, well maybe that ties in so one of your sections is book driven development. I think you've talked about this before, but what is this concept? How does that manifest for you because not how I write my books, but maybe I should? Well,

Adam Johnson 15:52
for me book is a bit more of a broad project that I just try and have fun with. And all the things I'm talking about are open source. So it means I can dive in and improve them in some way. If I spot something on the way. I this is how I've become a contributor through this book, which is a bit of a gauntlet to get a patch actually into get, it's not done on GitHub, it's done on the mailing list, it goes through your email inbox only.

Will Vincent 16:25
So Django is not so bad then.

Carlton Gibson 16:29
And compare it out. Okay, just on that, how does that email flow would get worse? Because that was the original workflow, right? It was designed to send patches to Linus basically. And how did that go? I mean, how, what's that like?

Adam Johnson 16:41
So the the tooling built into Git for this is that it can actually send an email, it has a command to format a patch, and then you attach your text to that, and it sends us an email using the SMTP setup on your laptop or on your computer. I didn't use that. I didn't want to like, set up all that. So I use this thing they added a few years ago for making a pull request on GitHub and converting that to an email. So I still had to chase up my comments on email, but at least I got to submit it, that kind of normal way to begin with. It's alright, like receiving comments over email is pretty much how I'd use GitHub initially, anyway. It's a bit all over the place. reading an email that's like got strips of your text, you have your patch with comments underneath. It's a little bit harder to go through. You can't just check the box done that, okay, resolve conflicts. But functionally, it's all similar. GitHub, just a much better UI for doing that than plain text email. That's the other thing getting an email until this it has to be plain text. So you've got to go check a box on Gmail or whatever. And if you don't send it plain text, you don't really get an error message like UPS. Yeah, cuz he just goes into the work to know.

Carlton Gibson 18:08
Okay, Kara. I just wanted to know, because I did I, I was, how did that come up? Somebody tweeted at me about how this was the this was the one true way and I was like, Okay, I've never done it. Maybe it is.

Adam Johnson 18:21
I think the Git community has often discussed that it's slowing down contribution quite a bit. And this kind of halfway house is where they've managed to get everyone to agree to because a lot of people who do it are very happy with their command line email client and their command line, Git and everything. It's okay. It's it. It's functional. And that's all it needs to be. I think it's good for the Git project long term that it isn't tied on to GitHub or any other provider. Yeah.

Carlton Gibson 18:55
I mean, that's my muscle. One concern is that GitHub slowly gets more and more dominant, more and more areas are sort of what is the alternative? What happens if GitHub becomes somewhere we need to leave? Are we able to?

Adam Johnson 19:09
Yeah, and every year they do something that causes another wave of people to decry that this is the final straw, but it hasn't actually been yet. Yeah, I think it'd be interesting what the future is for Git and Git hosts. I think Git will outlast GitHub, by some margin still. I think whatever comes next in terms of source control, will be one of these get compatible tools that still use it as good as the backend for storing it and just presents a nicer command line interface. And whatever. There are a few in the, in the works out there.

Will Vincent 19:49
Yeah, so that I mean, that's maybe a fun question to think, you know, put your tinfoil hat on, like how does get get replaced or something, you know, like, what, what, what could it do that it can't or what's true Actually, are there any obvious things structurally that if they're going to redo it now from scratch, you would be changed about its architecture, or just how it's used.

Adam Johnson 20:08
I think the big thing with Git is that it tried to be very, very simple with its object database, everything stored in files, and scaling that has turned out to be very hard. I've dived into, like recent changes in Git, they're all about like modifying these file based data structures to scale better. Whereas fossile, which is a competitor, that's the sequel, light source control, that stores everything in SQL light. And so scaling, that would be a matter of optimizing a few SQL queries, you don't need to rewrite all the data structures, maybe optimize some tables, but it's very well known kind of space of like, how do we get SQL databases going faster, whereas gets to a lot of low level, okay, now, we need to build a special index file for this particular use case, now I need to build a special thing. And then absolutely never take on a dependency like SQLite, either, because they want to work on every platform that only has a C compiler. So well,

Will Vincent 21:11
let's you know, since we have you want to talk about Git, let's talk about, you know, get reset, keep that's a little tip, you have like, what what can we say about that? Okay,

Adam Johnson 21:20
so do you know what git reset? Keep is? No,

Will Vincent 21:24
no, no, no, no, no.

Carlton Gibson 21:26
So git reset will take your take your working tree and reset it back to where it was before, you made some horrible mistakes, but I don't know the keep flag.

Adam Johnson 21:37
Yeah, well get reset kind of does two things is the way I would talk about it. One is it can unstaged your file. So you've clicked you've done git add on a file, it's the opposite of that. But the other thing is, if you posit a flag, and a commit, ID or Name, like a branch name, it will move the current branch to point to that one. And then people typically learn about the dash dash soft and the dash dash hard options, the soft one, it keeps the changes. So you can like get reset software previous commit. But that will keep the files in the current state. So you're ready to re commit those changes. Perhaps you meant to put them on a different branch, perhaps he meant to make some tweaks. So you can redo the commit you just did, or the last three commits you just did in wine or something like that. And then hard is for when you want to like throw away changes, it moves the current branch and doesn't keep the changes. The problem, remember, oh, yeah, I

Will Vincent 22:33
just see how hard is the one where I'm like, Oh, my God, like I get all nervous whenever I do, or try not to use it. But sometimes you just get lazy, right?

Adam Johnson 22:40
Like, it's this thing, can throw away everything. So git reset keep is like a better version of hard. Because what hard does is it not only moves the current branch to point to some other commit, it also throws away everything that you haven't committed yet. It's like a side effect that you don't really want most of the time. So like, if you use dash dash keep, then like, you can have some like test file you've modified, and then reset to like say you're resetting to origin slash the current branch to undo whatever fixes you've attempted locally to go again. So you can do that and keep the working changes. And I think this is quite important, because the only data that Git doesn't let you recover is stuff that you haven't committed yet. So if you have local changes you haven't committed, keep keeps them around, whereas hard, throws them away.

Carlton Gibson 23:35
That's quite early, because sometimes you've got, for instance, made those changes in order to bisect an error. And then you try and check out the bisector. And you're like, Ah, I've now got to in between each to get change, you have to take the take the changes out, like change the repo, and then put them back in. And that's a pain. Whereas if you could do this, exactly, that's

Will Vincent 23:56
what one of the things about Git, and maybe there's maybe there's a solution to this, is if you if there's nothing in it, get won't track it. So if you create a folder for like static files, like images, and you don't have any images yet, and then you try to track it or, or do anything with it, you have to do this like dot keep or just put in a dummy file. Right? Like that's, that's something that tripped me up in the past. And I get questions about that. People. Yeah, if it's not, if it doesn't have anything in it gets not going to automatically track it if it's empty. Right,

Adam Johnson 24:27
like gets gets data model only tracks files. And that kind of makes sense if you think about it, because you wouldn't want it to, like, keep around empty folders that have had all their files deleted. You wouldn't want to have to worry about file folder permissions, as well as file permissions. Things like that. You Yeah, so I did write a blog post about this. I guess that's why I ask you question. No,

Will Vincent 24:54
to be honest, I don't recall the blog post. I just read a book on this and it causes problems for people So that's why I added one of the updates like dot key for blank files, because it was just a common thing. Oh, yes. No, that would have been, that would have been smart of me. All right,

Adam Johnson 25:16
yeah, there is this practice of adding a blank file called dot Git keep or something. But that still requires you to,

Will Vincent 25:24
oh, my god, yeah, I swear to God I didn't see.

Adam Johnson 25:31
It requires you to still add like a Git ignore rule for everything else in that folder. But you can actually do this by just dropping a Git ignore file in the folder, you want to keep it around. And writing a couple rules. The first rule is staff, meaning ignore everything in this folder. And the second rule is exclamation mark dot Git ignore to say, but don't ignore this dot Git ignore file, right?

Will Vincent 25:53
Yeah, I actually, I was thinking of an older, like an older dot keep not not not get keep, but actually, something you promoted, which I was like, oh, yeah, it's important is the work that Brett cannon just did on Python 312. Right, we're gonna have automatic get ignores for the virtual environment, I believe. Oh,

Adam Johnson 26:14
yeah, that's, that's a good feature. I'm very happy to see that got accepted and merged. Yeah, pythons virtual environments. If you use the virtual em package, which is was the original, the way to create a virtual environment, that added at some point, this feature that drops a dot Git ignore file with just the roll star, meaning ignore everything in this directory, into each virtual environment. So you can't commit those virtual environments and push them to GitHub, which is a classic beginner way of duplicating code. And now that's been added for Python 330. And in the event module, the built in version of virtual M. So that will save a lot of good environment, virtual environments getting committed, and will also mean we can all remove a rule from our Git ignore files from that point on. I

Will Vincent 27:06
know I hate just copying, I don't like to cop just copy over the Python one from from GitHub, because so long, but is there's always like 10 different things, every new project I need to just put in by default, like, and maybe Jenko.

Carlton Gibson 27:21
Cool, that's controversial. Is

Will Vincent 27:23
there any debate on that? Is it if you

Carlton Gibson 27:26
want to have because if it can't, like someone will mention it? And then it's just like, not a conversation that ever goes well, so?

Will Vincent 27:35
Okay, well, you you too, would know you, too, would No, I haven't. I haven't said no. But like, I assume is, I assume is

Carlton Gibson 27:41
what happens with sort of esoteric conversation with jangles. Because there's so many users with such diverse requirements, that what works for that 50% case, it's going to upset an awful lot of people. And it's like, and so these kinds of little changes we've looked at, and they should you think, Oh, that doesn't matter, we just do that, that actually, a lot of people get upset about it's like, no, okay, we just won't do that. So Django has default. Git ignore is quite minimal. And I don't even have one in the default template. And, you know, and but even in, like in the repo, we don't put every possible Git ignore in there. So you know, you might use PI charm, and I might use VS code, and you might use, you know, some other one. And so we don't put like the Git ignores in the Django repo for every different IDE, we say, look, use the local Git exclude option or Adams, you've got different take on the good exclude you, you saw, I saw a post you did a few weeks ago. And now

Adam Johnson 28:40
you've you can create a global ignore file for all of the repos you work on. So if you're using PI charm, ignore pi charm across every repo you ever work on. And then don't bother any adding stuff to every repo, welcome. That's in the book, but it's also a blog post.

Carlton Gibson 28:58
So I mean, the with the blogging, I mean, you because you blog quite a lot, right. And I swear, I thought you were gonna do a book on typewriter and typing because you just, you know, the whole series of blog posts on typing is going to do a book on this and you didn't at the top and get you know, whatever reasons, but you blog quite a lot to what first draft day or two, to think through your ideas. Clarify your ideas. Just for fun,

Adam Johnson 29:26
I guess. It's because I think I'm quite forget

Will Vincent 29:32
you trying to Google yourself, you're like, What is this thing and then you phrase it exactly as the title of your blog post? Because that's how you think, right? I find that right. Even if it's a topic with lots of stuff, like I always, you know, future me phrases that like past me, and then I'm like, oh,

Adam Johnson 29:48
yeah, I think that's for me. It's also a way of like, gaining confidence and what I'm doing like if I'm about to make some project wide change on a client project Um, I was like, I should write up exactly what I think I'm about to do. And then by the end of it, I've got a blog post because I've like, found all the potential flaws. And I'm like, Okay, here's how you use this tool and Django. Here's the problems that I found doing it. So it's

Carlton Gibson 30:14
like, a way of tricking yourself into writing a spec.

Will Vincent 30:21
I wanted to ask you, because like Carlton, and maybe even actually more than Carlton, maybe you have so many third party packages that you both maintain and new ones that you work on? Like, I mean, let me just pick one, I think that you took over chorus headers, like, you can't really do. Most API's without this. Like, what I talked to, I guess, talk to me about like, what? How do you manage all that? How do you how big a burden is it for you to manage things like that, that are just core pieces of the infrastructure of Django, and then I know you have some newer, some newer ones as well.

Adam Johnson 30:56
I guess I just like collecting them. And one issue that always frustrated me coming into the Django ecosystem, and working with it for a few years was that these packages were sitting there, they had a lot of stars, they had a lot of downloads, but the maintainer wasn't around anymore. The pull requests were piling up, the uncertainty added to like, am I going to be safe upgrading to the next version of Django with this package? Oh, it seems to throw a warning. Maybe it has a problem? How will we ever fix this, I just decided to, like carve out my own little niche of like, the packages I own, I'm always gonna try and keep them up to date for Python and Django. And maybe I'm not like super active on adding features, or making them like more modern in some way or another, but I want to keep them working. That's like my baseline. And to reach that goal, I've, I've like, normalized them all to like a single, uniform template. And then I can script editing them. So with the Django five, zero, alpha, I decided to test them all. It took me about 60 minutes of work this morning to actually add that to the 16 packages that I have. Yeah,

Will Vincent 32:12
I just looked through and it said you updated them all. Like what? Yeah, this morning. I was like, yeah, now you've mentioned before, like, I think maybe the conference how you did that, because otherwise you just couldn't like it's just such right. It's too much.

Adam Johnson 32:23
And every other project maintainers have picked something slightly different tooling. They've gone for poetry in Ireland setup tools, they've gone for testing with Travis there, we're still using Travis when Travis has stopped working, or they're all in this kind of like, landscape of different tooling that is very hard to navigate. And I do go and make new Django version and pull requests to packages that my client projects depend on. But it's a lot more work figuring out where all the pieces are. Like, where do I write Django? Five, zero, where do I write the update on the docks? So keeping them uniform is like my secret weapon then

Carlton Gibson 33:08
my experience. It's very similar to come Django filter. Why? Because I was using it. It was basically unmaintained, I knew I needed to know it was going to work. Same with crispy forms. I was using it in projects. It was basically uncontained, it was going to break. And, you know, somebody had to take out so I took that, you know, it's I want you know, that was how I did it. I look at you and what you do with the number of projects you maintain? I'm like, Yes, that's, that's the way so slowly, you know, it's not something I'm going to do on the weekend at slowly. Okay, can I assist them a tie slightly more so that those small differences between the packages slowly go away? And then this what's the store? All repose is that all of us, right? Is it

Adam Johnson 33:48
I use one called My repos, there is repos. Okay. I wouldn't necessarily recommend my repos. That's right. Okay. It's just a way of running shell commands in each of many directories. But

Carlton Gibson 33:57
like you've used this, the basic idea is that you can run the same commands on multiple repos. And that's, you know, that's an awesome thing. So I need to get to that I'm not there yet. But uh, you know, mostly, it's like, okay, we're going to use talks, we're going to use GitHub actions. We're gonna declare the TOC file this way, you know, that sort of thing?

Will Vincent 34:18
Well, I was just working on a new project. And it was I got everything is so slow and buggy. And it's because I hadn't added browser reload one of the packages you have. And there's just so many, I mean, you know, you wrote a book on improving your Django developer experience, but, you know, when you just don't have all the tools that we we haven't set up, it's just like, you know, it's like, one hand behind your back, just, you know, don't having pre commit, like, I mean, it's just hard because there's, yeah, there's, there's your book, right? It's just like, a bunch of setup that takes time and like, why am I doing this? And same with, you know, optimizing your get right, but once you do, you just don't realize how much faster you can go right. With these tools,

Adam Johnson 35:00
yeah, like the defaults are good. But if you're spending hours a week doing this, then it's always worth committing some small percentage to improving how fast you go in the actual work hours.

Carlton Gibson 35:17
So I'll go, why I just wanted to ask you in the show notes about the gait belt, you've, you've got this. You mentioned pigments get no height, that's for highlighting, right. So tell us about like sets tweaks, my sort of

Adam Johnson 35:31
pigments is the popular Python based code formatter. I think GitHub used it even until they made a Ruby version of the same thing. But yeah, pigments is like, got a lot of highlighting rules that can highlight Python code shell code, like 100 Other languages built in. But there's nothing for like git related files. And so it's finding that my blog posts and my book were very dreary, it's all black and white, or the editor already. Yeah, already. So I wrote something that tries to restore some of the color that you would see when using Git or using Git syntax highlighters in your editor for things like the commit message file. So it makes the book a little bit more realistic and hopefully, easier on the eyeballs.

Will Vincent 36:26
What editor, editor, or IDE Do you like, these days, I forget, I'm not sure I've ever seen Sublime

Adam Johnson 36:31
Text since 2012. And no plans on changing. There you go. For me, the big selling point is, it's got Python that you can extend it with. So I've written a few small extensions that do what I want. And sometimes I've got some large refactoring, I'll write an extension that does a few different editor commands for me. So it's not quite the same as like, just regex replacing everything in your code you're stepping through still, maybe you have to type something at each step. But that's a cool middle ground, I think,

Will Vincent 37:04
pre commit, I think I read a blog post on this because I was fiddling around with it. For a reason. You've written a bunch on this, I think there's some stuff on getting pre commit, like, what would be your little sound bite on, on that? Like, what maybe for people listening? What is pre commit? And why is it you know, worth mentioned in your book?

Adam Johnson 37:23
Yeah, pretty much is an awesome tool for running all your code quality tools. I've actually written a chapter on it in both the Django DX book, and now they get the x book, which is much less Python Django, specific. The cool thing about it is that it's it's not just a way of running tools, it is also a kind of package manager. So you can throw in a tool that uses the rust or go, or JavaScript or Python tool chains, and the user does not need to have those installed, it knows how to bootstrap entirely each of these programming languages, package managers and then the tools from scratch. So very easy to throw in one extra tool that is maybe not something that is not using a language that anyone on your team is using. But it just works. And yeah, it's stability and flexibility. The sheer number of tools it all adds up to like a pretty good developer experience.

Will Vincent 38:22
Do you you mentioned Russ Do you like rough Are you still on the flake eight bandwagon I know you have some new flake eight packages you've been working on?

Adam Johnson 38:31
I think rough is a cool tool. I use flake eight still I've never had the need for like extra speed. I think then unification aspects is very interesting. And probably will help a lot of projects especially if you're getting to a larger scale. Just keeping everything managed. We'll see where it goes because I'm more of a fan of like open source community managed than open source company managed Yeah.

Will Vincent 39:04
Yeah, so for those listening rough is written in rust and pulls in flake eight and that yeah, that's the big selling point is that it's much faster than flake eight and tools like that

Carlton Gibson 39:14
can ask you about inertia so I put my hand up I'm you know front line for I'm quite slow to change my tooling choices you know, I'll be second last off the boat quite happily every time. And that's fine. How do you because basically, I'm just not interested in taking on the church. You know, if you get into every new tool you're changing tools three times a year and it's just the time saving is never worth it for me that's that's kind of my natural my reaction there. How do you handle that kind of tool change yourself? How do you how do you balance between the considerations of haven't spent a lot of time looking at tools and oh, this is actually a better this is a step

Adam Johnson 39:54
forward? Yeah, I think I'd be conservative like you with some hoping. But I'm also very happy to go add new tools, I guess part of what I do is, is helping companies add tools. So I've added flaky contracts this year. So I might as well like, if I'm gonna go through it, I'm gonna research new plugins or whatever that could help out people.

Carlton Gibson 40:21
If you're selling apples, it's happy to have fresher, it's helpful to have fresh apples.

Adam Johnson 40:25

Will Vincent 40:29
So is that I mean, it's I know you're you do consulting work? Is there a typical type of project you get brought into? Is it like, everything's on fire is like, everything's slow? Like, is there? Is there a kind of a bread and butter? Or is it, you know, hey, we need someone who really knows this stuff.

Adam Johnson 40:43
I guess more of the latter. I've helped a few companies this year, like just improve their DX tooling in some way. So that might be setting up pre commit and all the tools for the first time. Or it might be like updating things and writing a flaky plugin for logging. After I was auditing, the logging setup for my clients silver, it's

Carlton Gibson 41:07
gonna ask from a sales perspective, do you have, are you able to have any kind of metrics being so low that you know, had this kind of improvement in productivity? Or, you know, this company said, you know, are you able to gather that kind of data so that you can present that in a sales

Adam Johnson 41:24
call? It depends on the problem. And one client, this he asked me to improve their startup time, because I'd written a blog post on how to improve a project startup time, the time it takes to import everything before Django actually does run server or shows you the shell or whatever. So I could show very obvious improvements that are like, doing this thing saved a second during this thing, you say, five seconds, if you do this thing, you know, that's the classic consultant move if you do this thing.

Carlton Gibson 41:57
I've just, I've just had the molecule. Fair enough. Good. Well, I

Will Vincent 42:04
think I mean, even just, for anyone to have someone who's trusted, just come in and take a peek, because that is one of the things about code is that often you're no one outside of your team is seeing anything so. Right? Like I mean, if we all look to each other's code, well, maybe I wouldn't help as much. But you too, would definitely, like add a lot of insight. But it's not often done. Unless it's like a new team member, or you have that external gaze, and there's just stuff littered everywhere. I mean, there's just not always such hard stuff that is just unawares, because you're busy doing the thing that you're doing. Yeah, I just want always wonder if there's any way to improve that or, I mean, even something as simple as like, I'm in Boston, there's all these doctors, like surgeons, you get trained in surgery for forever, and then you just solo for until you retire. And a handful have like, brought in like retired surgeons to just like, watch them operate. And like, you know, everyone needs a coach, basically, in any field. And in coding, you don't always, you definitely don't have that. I have a vague thing I've thought about like, is there a way? To do that? I guess the answer is you hire a knowledgeable consultant periodically to come in and be like, hey, like, this is what's changed. And also, here's these obvious things you're doing that could be improved?

Adam Johnson 43:19
Yeah, I think there's definitely a model where there's like a list of things to go through. If I look back through all the things that are fixed in all the projects, there's a bunch that didn't quite make it into a blog posts or a bit nebulous, but definitely something to check when reading code.

Will Vincent 43:41
If that's your retainer, you should have an AI AI of yourself atom, you know, Atom code pilot.

Adam Johnson 43:47
And just maybe,

Carlton Gibson 43:50
I think was was well, like the the DX tooling that you put in place and things like pre commit and whatnot, especially if you've got in a team environment where you can't, you can't expect a junior developer to come on and be able to master all these tools. Whereas if they're already set up to run automatically, and that's, yeah, that's got to have visible gains for a company that implements that.

Adam Johnson 44:11
Yeah, definitely. Well,

Will Vincent 44:13
we have a little bit of time. What what, what else? Can we talk about? Adam? What like, what are you working on? What do we are Carlton, you have flow? No, I

Carlton Gibson 44:20
would also got Adam in the room. I want to ask Come on. So Django 5.0. She's out the door. What's on your steering council member? What's on the what's on your roadmap? Now? What are your exciting things that you want to look for us to do over the next five point X series say, Well, if we could wave a magic wand and change one thing, what would that be?

Adam Johnson 44:40
That makes it easier.

Carlton Gibson 44:43
Same thing. You're on the record here, boy. There's

Adam Johnson 44:46
this package that Gordon rectly my previous boss made, that's called Django auto prefetch. And that changes the prefetch behavior from prefetch and When you access a field that wasn't fetched in your query like a foreign key, Django by default, fetches a single one, and changes that to fetch that field for all of the instances that were in that query set. It's a clear performance win for nearly every situation. Nearly all the times that you fetch a query set, you're going to do something with everything in that query set. And last year, had a discussion about a way that we could get this in with Simon charrette.

Carlton Gibson 45:31
Also that to ask is you have your chat go on about

Adam Johnson 45:37
just didn't manage to take a look at it. It's a big one, because the idea is not just to like add this one behavior. But to add at least one other which would be, you know, anytime you access an unfettered field, like just error, which is necessary in the async case, because you can't do this query on attribute access. But it's also something that several packages have created. In third party cases, Django, SEO, Django Zen queries, they're both it yeah, those

Carlton Gibson 46:10
are the two I want to talk, I just wanted to be a bit of added

Adam Johnson 46:14
or something. So in call, it would be nice to have it that you could tell the RM actually do this, and maybe be a context manager or just an option that gets changed.

Carlton Gibson 46:27
We have We do some, some sort of Kickstarter to get like you and Simon and Marish locked away in a lodge somewhere. And

Will Vincent 46:38
speaking of that, I've had some people, I've had a couple of people email, you email me about, like new projects. And, you know, Kickstarter is because that's happened in the past. And when I was on the board, as always, like, none of them the board can do it. Like, let's like, we can raise the money. And I have to say, I've gone full circle to like, you know, what, like, the DSF has enough to do and the, you know, if people want it, maybe a Kickstarter or something like that isn't the worst way to do it, because it's just to have it within the the meat grinder of Django machinery is it's probably too much. It probably gets in the way of things. But at one point, I thought, Oh, wait, what the DSF can raise money more easily than a Kickstarter or something. Could and yes, but then you have all the friction of a community, I guess, as opposed to just doing a great new feature. And

Adam Johnson 47:24
what about the issue you've discussed before about the DSF? Being a foundation not paying for coding? I think you've softened on that, since that you had the PSF pays for coding, right? Well, I'm

Will Vincent 47:36
not in the board anymore. But yeah, I mean, I've maybe I'm, yeah, I mean, they have lawyers, they looked into it, they said it's fine. So, you know, if there were any problem, we could just point whomever at PSF. And they could do it. Yeah, I don't I don't think it's a restraint. I don't I don't think that's the I think that was often used as a reason why not to and at least I'm pretty sure the current board now certainly knows that. The PSF is doing it so

Carlton Gibson 48:03
well. When I was when I started as a fellow it was explicit. It was like, No, we've had legal advice such that you are a community manager. You can you can volunteer contribute to Django as a volunteer, but you're not your fellow role is not that. Now that, you know, since that, that discussion with Python and divide,

Will Vincent 48:24
we talked to we in the board, talk to Eva, who was running PSF. And, you know, I've looked at the history of where that legal advice came from. And I, I would trust the Python, the PSF, you know, both in terms of who they asked, and perhaps the landscape has shifted, but PSF has lawyers who focus on tech stuff, who said, it's fine. Okay. I think that advice was a very conservative take by someone at the time who wasn't actually in the tech space. And then it was treated as gospel. You know, we want to be conservative.

Carlton Gibson 48:54
We don't You don't pay a lawyer for advice. And in this regard, the advice? That's pretty fine. Oh, no, we wish we didn't like that answer. Let's just go with this one. But remember,

Will Vincent 49:06
this was like, someone who was, you know, emailing me saying, like, why doesn't Jenga do to done? And I was like, Well, you know, you could you could do something? And yeah, I think kick starters or something like that. Like, I mean, the question is, should do we need to vote in any way, like, just send around like, Hey, here's like five ideas or be it but the problem really is, how do we get the time of Adam and some people

Carlton Gibson 49:25
this problem? Well, no, no, Kevin, I wasn't I was putting the finger up. Yeah,

Will Vincent 49:29
it's, it's we need both. I mean, the money to me is easier than the community agreement and the people who can actually do it the time to do it. The

Carlton Gibson 49:37
other thing that's been mentioned is sort of, you know, community sprint like Django sprint. It's like, you know, to get to get together and have an event. But without without the conference bit and just do the sprint split for three, three days or so. And could we arrange that and there's keenness, I've seen it. It's not just Paulo that I've seen other people who are involved. We've sort of said, Oh, is there an idea for this? Oh, yeah, I might, you know, two weeks would organize that and get in a space together that would be an amazing

Will Vincent 50:03
I mean the Sprint's are amazing what they do and a handful of hours right? Like, and yeah, they don't have to be attached to the conference. So

Carlton Gibson 50:10
any come anyone at a big company listening to this who wants to sponsor a Django development sprint?

Will Vincent 50:17
Yeah, this new feature is brought to you by Microsoft. Yeah. Well, I think unfortunately, we're coming up on time, Adam, we're gonna have links to everything. Is there anything else you want to add? Currently, you can preorder the book, right and get a discount. Is that right? Is there an official,

Adam Johnson 50:34
it's not preorder, it's an early access, you get 80% of the book. And then you open up some pages and they say to do. I've written up to 90%. Now I covered the two big bits that were left, which are get blame and Git bisect, as more advanced commands are taught them from scratch rather than just being like, you know, get blamed, right. Well, why don't you just turn on this thing?

Will Vincent 50:59
A guide. Yeah. So it will be done. There's no reason not to go get the book. Now. Now. There's

Adam Johnson 51:05
not I mean, you'll save 10 bucks. And it'll be out probably in a couple of weeks. Four weeks? I don't know. I'm not going to commit to any timeline with a young baby in the house, but it's coming together.

Will Vincent 51:21
Well, thank you so much, Adam. It's always a pleasure. We'll have links to everything. People should check out his work if you're not already using it. And Django Right. That's our usual Yeah.

Carlton Gibson 51:31
See? See you next time.

Will Vincent 51:33
See you next is very

Adam Johnson 51:35
much for having me cotton. Thanks for coming on.