Hey there, thanks for listening. Before we jump into this episode, I just want to remind you
that this episode is brought to you by us over at Talk Python Training and Brian through his pytest
book. So if you want to get hands-on and learn something with Python, be sure to consider our
courses over at Talk Python Training. Visit them via pythonbytes.fm/courses. And if you're
looking to do testing and get better with pytest, check out Brian's book at pythonbytes.fm slash
pytest. Enjoy the episode. Hello and welcome to Python Bytes, where we deliver Python news and
headlines directly to your earbuds. This is episode 248, recorded September 1st, 2021. Gasp,
it's summer over. I'm Michael Kennedy. I'm Brian Okken. I'm Paul Everett. Yay, Paul Everett here.
Yay. Welcome, Paul. Joy to be here. Long time listener, first time caller. Yeah, I think you
made an appearance in the previous show in the live chat, but now you're... Oh yes, the live, yeah,
true. Or possibly I talk Python. I can't remember. It all blurs together. It wasn't as prepared as
this one. No, now you're on the big stage. So thank you for being here. You know, tell people about the
things that you've been up to or what you're doing or who you are before we jump into our first topic.
I'm developer advocate at JetBrains for Python and Web, which means PyTarm and WebStorm.
What a great gig. Love my job. I always joke that they should be... I should be paying them,
but don't tell them I said that. And I'm just embarrassed that here I am on Python Bytes,
and I didn't get a haircut in time. I know this is a podcast, but there's a video version.
That's right.
Looking at Brian rocking the do, I feel like I should have been better prepared.
Yeah. Brian and I have alternate philosophies, I guess. I've got like the knight's neat hair,
and Brian's just embracing it. And yeah, I would do that too, except for mine just looks like a giant
poofy thing on top of my head. It doesn't look cool. So yeah, not so much.
Oh, I want to see that.
Yeah. It's amazingly bad. Yeah. I've tried it. It's not amazing. All right. But you probably have
something amazing to tell us about, huh, Brian?
Well, I do. I actually... So this is an interesting article. I want to talk about both
Adders and Pydantic because we've talked about both of them on the show, and they're both great
libraries, I think. And so there's this article that I came across called Why I Use Adders Instead
of Pydantic. And there's actually a lot more in here than just that. So it was an interesting read.
Starts out right off the bat talking about basically one of the things that a lot of people
think about with Adders is, don't we have data classes? Do we need Adders anymore?
And it starts out talking about, not talking about Pydantic, but talking about data classes.
And that data classes really came about as a subset of the Adders functionality. So it's really pretty
easy to go back to using Adders. If you're familiar with data classes, it should be easy.
And actually, there's a lot of reasons to use Adders instead. For one, they're just faster,
which I didn't know that they were faster. But there's some examples about a lot of the boilerplate
stuff that goes into data classes that we don't really think about. But the Adders is pretty tight.
Adders has more features and has some validation code that isn't around for data classes. So that's
interesting. So then getting into talking about Pydantic. So I think of Adders as kind of like data
classes, but it does more. So Adders, this author summarized Adders is a library for generating the
boring parts of writing classes.
And like the hash, the equals, the not equals, that kind of stuff, right?
Yeah. And also like throwing in some validation if you want. So you can opt in. So putting in some validation,
you can set that up. There's, and there's a lot of stuff that Adders does. I mean, it's a lot more
than that. It's a, it's a pretty full library also. But what you get with Pydantic is you get that with
the classes that Pydantic provides, but you also have the validation library and structuring and unstructuring
and conversion to and from like from, from a different type, like say, Jason into, into a Pydantic class.
And all these components really are with Adders, you can do all of that. You just, you, you opt in instead of,
instead of having to opt out of it. And it's kind of a really interesting take on that. And I, I thought of it as kind of like, you know, I've got a lot of,
I've got a lot of, I've got a great screwdriver. I've got great knives, but I don't think of my Swiss Army knife as a great, anything. It's just that it has everything.
I don't think it was that harsh of a comparison, but we also think about that with like a Django and Flask where Flask is kind of build up your own framework.
And Django has a lot of built-ins already. There was, and it isn't even that simple. There's also some, there was an example of some of the validation that's just that,
that, that is built into Pydantic that just seems wrong. Like the example was, if you've got a list of a thousand integers,
do you really want Pydantic to go and you pass in a list of integers? You, you want to make sure it's passing in a list, but do you want to want it to go through and make sure absolutely all a thousand elements is an integer?
You might, in which case you're in luck. Cause that's what it does. But if you don't want it to do that, because it's, that's just too much time. you're out of luck.
Uh, the other, well, you also got to remember the, the origins of Pydantic were about accepting input from arbitrary things on the internet.
Oh yeah.
And when you're, your goal is like, I'm accepting unstructured data from random endpoint on a random endpoint. Like you need a different level of integrity.
integrity. Then I loaded this off of a JSON file and I know the app created it. It's not going to be broken, right? It's going to be self consistent, at least in the fact that like the data types are probably still consistent.
So, so it's probably a, a when to use a witch sort of thing as well.
Yeah. So that's the, that's the generated, yeah. Adders class and the generated Pydantic class. so it's, it's around validation. yeah, it is interesting. the other, the other aspect is, making sure that, that, data is validated when it's set, not just when it's created.
And I think I got lost here, but I correct me if I'm wrong, Paul, but I think it's that, Pydantic only validates on creation. Whereas you can set adders to be validating on setting values as well. but I could be wrong.
I believe you're right. I went and looked up a ticket in Pydantic. I didn't read the whole thing about it, but these are hard conversations. There's no free lunch. and this article I thought was a free lunch.
I thought was a fair treatment about the topic. Yeah. The conversion bit was a little interesting. Like for instance, date conversion. So if you pass in, date time to a Pydantic model, Pydantic already has date time conversions built in. So it'll automatically convert it. But if you are using like pendulum, which is a sub, the, the class is a subclass of date time. You're going to get a wrong conversion. It's just going to do it wrong. because it's not going to be wrong.
Uh, cause it'll, it'll assume it's a date time and not a pendulum object. So that's interesting. yeah, anyway, definitely, something to think about of the build your own versus, having it all in one. But, but I definitely think there's places for both. Like Michael said, especially with, input validation on the, on the web. If you know what you're doing, definitely. I think maybe you could roll your own or, or use all these adders and other tools. But
if you're just sort of playing at it and there's getting started, then, why not try Pydantic? It's, it's a great place for that.
Yeah. The other thing is about the, open API specification stuff with Pydantic, where if you just use them and you just say, I'm using this, it'll like automatically generate the documentation, which is a big bonus.
Yeah. It's interesting with the release of SQL model. It's like, you can kind of feel like Pydantic is its own little mini framework dispatcher thingy with hook points that you can plug into and almost treat, almost treat as its own little API surface for gluing things together.
Yeah. Yeah. Yeah. It's the, the data exchange bit. Pretty interesting. Brandon Brainer out in the live stream says, I think it comes down to the, using the right tool for the right job, which is yeah. And how you opened it. Right. Brian? Yeah.
All right. So we all work with the terminal every now and then, right?
Every day.
You might be working with the command prompt if you're on windows, but I strongly encourage you not to do that. You should, you should be switching over to the new Microsoft terminal with like, Oh my posh shell. And then you'll be, you'll be in the terminal world as well.
So Dunderdan on Twitter, send us a recommendation, which I want to cover called McFly, which I love the name. So what is it? It is a bit of rust code that extension for your terminal, super easy to install. Like you can brew, install it and other types of install it. And basically what it does is it lets you fly through your shell history. Okay. So depending on the shell you use, you may use this a lot, or you may use this a little, you can hit control R.
In your terminal. And it brings up a reverse history search. So like, if you knew that you type something to do with get, and it had to do with this repo, you could hit control R and like type parts of the repo name. And that would start to auto complete those commands. There's a couple of things that are kind of a bummer about that though. One is maybe the biggest one is you only see one of those at a time. Right. So if I go and say, show me my history, I get a line. And then that is the closest, most recent match to what I type.
Well, what I often might want is like, it's kind of like a get clone, but which one was it? And I want to see which ones of those are that like, that UI is not fantastic. So imagine if you could type, say, get clone, and then hit control R. And it gave you like a UI in the terminal that you could scroll through and pick. And then you could see what else to type a little bit more. That's McFly. So it's pretty awesome in that regard. But it also uses a little
little bit of AI, if you will, a little neural network, and some context awareness to help filter and order that I guess price sort is probably the biggest thing is it'll say, well, what, you know, we're searching for this. But usually when you're in this folder, you're often using this, this version of that command. But if you're in a different folder, you're doing a different version of get. And so it'll try to filter your history based on the context of where you are. What do you all think?
I think I think it looks pretty cool. I was luckily, so I, I don't know why anybody would use the built in Windows command prompt. So I'm even on Windows, I'm using bash. But
Oh, my posh shell plus pi. Power shell is pretty sweet in the new terminal. Carry on. Carry on. Sorry. Don't mean to derail it.
Anyway, searching history with the VI mode is pretty easy in bash. But I was glad to see that this, this isn't just for, for your command prompt or posh or anything you can use.
You can use this with a Z shell and fish and bash too.
Yeah, it works in a lot of them. And so I found it to be quite neat. So let's see, I'll run through some of the features. So you just rebinds control R, which is kind of nice. But one of the things it'll store your history in a little local SQLite database. So it can do more queries and more interesting stuff have richer information on it. But it also, like, injects the commands that it sees into your regular shell history. So if you stop using it, your shell history for say, Z shell is still totally good. That's pretty nice.
I will say that. I know you had Brett on recently. And so the rustification of Python bytes appears to be complete at this point. You can't go anywhere without bumping into rust.
I know you keep bumping into it. It is quite interesting here.
And my other comment is that I hate to say it, but I think the three of us were, we've been around so long, we were pair programming with Moses. And the idea that I really needed a small neural network for my shell.
That's a tough one.
Yeah, it's interesting, right?
Yeah, it is.
But I do think, I mean, I do think it adds quite a bit of interesting extensions for this stuff. Like, it's a really cool way to do, you know, I use, oh, my Z shell. So if I wanted like SSH somewhere, I could type SSH and just start hitting up arrow. And it's like a beautiful history map. Like I never use control R because there's a better one.
I got to make that jump.
Yeah, it's so good. But sometimes I don't remember exactly what it is, or there's like a lot of them. And so with this one, it'll give you that drop down list that fills the whole screen. So you can jump through them. You can also delete, you're like this one I did once, but I never want to actually don't even want it in my history. You can delete it from your history, which is kind of nice. And then also, let's go through some of the other things. So yeah, so in terms of prioritization, you know, that little neural network,
says it takes into consideration the directory where you ran the command, what you typed before the command. So if you did a get branch and then a checkout, I don't know, maybe that means something or I don't know, whatever.
But like the series of commands that preceded it influence what it suggests and how it orders it, how often you run it when you last ran it, what you've selected in it as it's dropped down. And also, it's exit status.
So if you ran a command, but the command failed, like it won't auto suggest that command again, because that one's the broken one. You know what I mean? Things like that. There's a lot of cool stuff.
Oh, that's cool.
And then I got one for you, Brian, down here. So it's easy to install this, you'd like, you know, brew install or where's the, I'll be an advocate install or something. Anyway, if I go down here, there's all sorts of ways to install it.
But here we are. Vim keybindings, Brian.
Yes. Okay.
So, okay. So you have Vim keybindings, which is by default, it uses Emacs. It definitely reminded me of like just firing up Emacs, but for the shell, which is kind of nice.
The other thing that I like about it, I haven't turned this on yet, is fuzzy searching. So sometimes I'll be like, ah, there's this command. I think it was this. But if you get it wrong, then it's like you get zero help, right? If you get one character wrong. But this one is, if you get close, can you get close and we'll give you some autocomplete on that. That's pretty cool.
Yeah, that's great. Because you might like be searching for a file name or something like that.
Yeah, yeah, exactly. Exactly.
Do you see that? There was an XKCD, I think, or some other comic of somebody. Now it's a different one, but somebody scrolling through their history for like an hour to get LS.
Yes.
No, I'm definitely going to try this out. This is pretty good.
Can you scroll? Yeah.
Oh, you're going on the XKCD.
No, sorry.
Can you scroll up to the commits? Number of commits?
Yeah, 350.
Yeah, this has the look of a project that's been refined, doesn't it?
Yeah. Yeah, it does. I don't know quite how long it's been around, but yeah, it looks like the oldest super obvious one is 14 months.
Yeah.
It's continuous integration. It was last configured 14 months ago, let's say.
No, it's the docs. The docs were two years ago.
Okay. The docs, there you go. I think this is nice.
I wasn't sure I would have wanted to use it. I'm like, oh, this is interesting. And people might, then I installed it. I'm like, oh, this is, this is pretty cool. I like it.
You know, all the cool stuff I like in Python, like PyPI and PipX and things like that. They all have a section about using this with fish, you know? And so I'm always taunted with my lack of foo when it comes to terminals.
Yeah. Yeah. I made the switch to Z shell. Oh my Z shell. I'm not looking back. Love it. All right. Patrick.
We'll be out in the live stream says McFly seems really interesting. I'm using Z shell for a month now and always thought the control R search lacks features compared to other plugins for sure. Absolutely.
And then David, pooch on out there says you covered that LS joke in the show. Yeah. That's beautiful. I love that one. It's been a couple of years, I think, but it was a good one.
Well, we don't have a joke history command. So yeah. Oh, McLaugh. He's writing McLaugh.
Something we never cover on the show is textual. So why don't you tell us about that, Paul?
Sure. switching over to me. Yep. We got me. I think it was episode two 41 when you had Brett on and Brian led with Will McGooghan talking about rich and I'll, I'll quote Brian because it was funny then. And it's funny now. how can I not have heard of it?
I'm a fan of the podcast and Brian loves this tool. So I'm going to go back to the well with the thing that was spun out of rich at that time textual, which has been covered. But I want to talk about a particular aspect of it. It was kind of interesting to me as a pattern. And then have a little debate where the two of you tell me that I'm wrong. and really ancient about this.
So, I've traditionally been against the convention over configuration camp in the world of Python. I come out of kind of the Zope tradition, the pyramid tradition pyramid is like, oh yeah, well, here's a configurator object. And it does 15 trillion things that you really ought to care about, but don't.
Because Chris McDonough has really great design sense, kind of Goldilocks knows exactly what to put in and leave out. And I just, that whole worldview fits into my head. And so I have this dislike about magic names, magic file names, magic variable names, can't auto complete them, can't refactor, can't navigate. If you can't memorize it and keep it all in your head, you know, and Python is explicit over implicit, blah, blah, blah.
Um, I prefer like actual symbols that smart editors can operate on and not have like is a little bit that's going on with data classes right now. Each individual tool having to wire up special support for that template language or that this, that, or the other thing to look for these magic hand waves.
So, we'll have this thread and actually I should bring the thread up. we'll have this thread on Twitter, which made me feel a, like I was a little bit wrong and be like he had solved some of the issues that I had with it.
So what he wanted to do was remove some boilerplate. And in this, he gave some examples about before and after, here's the screenshot of it.
So that's before. And you see like in here, watch how much this changes when you go to this.
So kind of the noise, the ceremony, a lot of the stuff was reduced.
Okay.
Now anybody can look at this and say, wow, that's great. If you're optimizing for writing code, if you're optimizing for reading code and you want to walk back up to this later and know that there are some special semantics that, you know, then if the name starts with these three things, then the next thing is kind of a thing that is a, et cetera.
And so I worry about, I worry about those kinds of things, but he had done it in a way where my pie would still help you some.
And one of the innovations he had that I felt like, let's see, do you see, do you see me on Twitter? Nope, you don't. Cause I'm in the wrong window. Sorry about that.
Okay. My apologies. So into the screenshot, you see a before and after Brian, you see that?
Yeah.
All right. Good. Before and after. And so he's talking about boilerplate removal in this thread and some of the decisions such as like this, for any of you that do type annotations, type hints, you'll look at this and you will say, oh goodness, the type hint went away.
This is actually a perfect example. And you look at this and you think I just lost the typing information and I believe in type hinting. Well, not really because it can be inferred for, it can be deduced.
Right. So for people listening, the example is you've got like a variable colon type equals.
Oh yeah. Sorry. Yes. This is a podcast.
You can instantiate the type versus just drop the type annotation on the variable. But when you're, when you're allocating up the object right there, like all the editors in my pyre, like, you know what thing equals new object.
That's right.
It could be that object.
Yeah. And in these like titantic battles about type hinting, we forget that, well, you don't have to do all that typing all the time. Python and type checker static analysis can figure this kind of stuff out.
So I looked at that and I was pretty, you know, I was probably kind of seduced by that. But let me ask the two of you, maybe the audience as well. Do you think that three months from now, if you walked up to your textual application,
would you be able to remember that he had done these things and that the right hand side was telling you about the left hand side in order to save a little bit of typing?
Did I lose a little bit down the road and have to load up my future self? What do you think about that?
Right.
Well, I'll tell you what I'll tell you what I think. Is there a separation of where this happens? Like on the example that you're showing here, like object or variable equals new object. I never need help with that. I get super clear what that type is all the time.
Where it becomes not so obvious to me is where I've got like a class or something and it's got a field and then I'm creating that object and passing it in.
If my pie could still tell me, oh, this thing is one of these because the only time you ever use it is always passing this type.
But that's a separate file and I'm not looking at it side by side. Then to me that like starts to add additional work for me to keep track of in my mind.
The other one I would say is the autocomplete test. If I'm working with thing, I say variable dot and it goes, zoom, there's the list of things. There's a good chance I don't care about anything else.
Right. Like did it autocomplete the thing? And did it tell me if I put the wrong property field, whatever on it, because it knows what that list is. Right.
And if the magic name changes later, will I get a red squiggle?
Yes, exactly. Will the editor know that it was broken and will it help me write it so I don't have to look at the docs?
I don't have to go to the source. I just use variable dot and I just keep rocking until I really need to understand something.
Yeah.
I would say that that's where I come down on it.
The third thing is, if this is not relevant here necessarily, but if you're doing something like SQLAlchemy or Mongo Engine or Django ORM, so often what they do is they
have like two flavors of the thing.
I'm creating a class.
The class has a field.
It's called email.
Oh, wait, no.
What is it?
It's being set to a new Mongo Engine field of type string that has a regular expression on it.
Wait, that's not what I get at runtime.
At runtime, I get a string.
At code time, I get this.
So for those, I will say field colon type is string equals Mongo field is a Mongo string or whatever or SQLAlchemy column of type string because I want it to be explicit that it's not really what it says there because often the editors will give you column information, which doesn't make any sense.
Anyway, that's a long answer, but I gave Brian some time to think about his position here.
I'm actually just I'm very impressed with Will's design decisions on a lot of things.
And I am like there may be some magic hidden in there, but I would rather have less code to look at.
So less code to look at means less things to get wrong.
As far as I'm concerned.
I am coming down with you on this one.
I've been working for a long time on kind of a long project about static analysis and Python templating that is driven by type hints.
And looking at what he's done has made me step back and think, wow, there is some there's something some things you can do without throwing out type hinting that improves the readability and removes the boilerplate while keeping people on the rails.
Back to what you said about Will's design decisions.
Looking inside the code of textual is really fascinating to me.
Fascinating enough that first today Will announced that he is changing his job status so that he can work for the next three months on open source completely rather than at night and is looking to meet a target for GitHub sponsorship.
So let's all go out there and sponsor him so we can get these delicious looking treats that he keeps giving to us.
But second, I'm interested enough that I want to join the freaking project and learn from him.
I need a reactive system.
He's got one.
Yeah.
I wouldn't even know how to write a test for it.
And he's got that, too.
So I'm with you on that.
I love the way he writes his code, the way he talks about his thinking in public while being a gentle and encouraging public figure.
Yeah.
Well said.
Absolutely.
Well, very, very cool stuff.
There's a lot of neat things coming out of there.
And I think a lot of people's reactions are like astonishment.
Like, wait, that's a terminal?
That's insane that it does that.
Yeah.
Ah.
On to the next.
Speaking of testing, have either of you ever used DocTest?
Paul?
Yes, I have.
So I, way back when, when I started blogging about testing, I thought it'd be fun to compare the test frameworks because I wrote my own.
It wasn't fun.
So I looked at unit test.
I looked at DocTest.
I looked at pytest and Nose also.
And I, I actually thought, you know, maybe just, I didn't think it would go very far, but I tried to use DocTest as a, as a, end to end test tool.
Um, it was difficult.
Uh, and there's still some cool things about DocTest.
So if, if people are unclear what DocTest is, DocTest is a, a package that's built into Python that you can write.
You can use it by saying Python-M docTest and point it at a file, one of your source files.
And within your doc strings, if you've got things that are like the, the three, I'll see if I've got it here.
So the, the three arrows or something like the prompt, the Python repl.
And you can type some examples in there and DocTest makes sure that the output really matches what you said.
So DocTest will go through and make sure your code examples within your code actually work.
This is a cool idea in principle.
In practice, it's very painful.
And, a lot of the pain points come around.
Well, I forgot to import anything.
So you have to, you have to include the imports in there, or I forgot to, there's a lot of stuff that can go wrong.
Um, now pytest adds some things you can run docTest from pytest.
It's pretty cool.
What we're talking about now is a new project or a project new to me called xDocTest.
And xDocTest, it's got a whole bunch of cool features.
One of the things is docTest is a regex plate based thing.
It, like, pulls out the string, finds the code, runs it, looks at the output, makes sure they match.
xDocTest uses a, whatever the, the source tree thing.
Um, abstract syntax tree.
That's, that's it.
Abstract syntax tree.
Uh, yeah.
Um, so it's actually parsing it better.
And, there's a whole bunch of cool stuff you get with that.
The thing that I re there's, there's some highlights in there.
Like one of the things is, continue string continuation was pain, painful because you had
to include the little angle bracket things.
You don't have to do that with xDocTest.
The thing that I love the most though, is, one of the defaults, in docTest is it
does not do string normalize it white space normalization.
You can turn it on, but it doesn't do it by default.
xDocTest by default does white space normalization.
What that means is if in my code, I cut and pasted stuff and added like a tab or a space
at the end of my string, docTest will fail that because it's like, oh, that's, that string's
not the same as white space at the end.
I don't care about the white space at the end.
So, one of the things that xDocTest is just fixes that right off the bat.
So it's going to be way more pleasant just to work with.
But there's a whole bunch of other cool features of this that it, that it brought in.
It has a more sane skip, syntax, although they kind of had to read it for a while.
You have to say plus skip to, to start the skipping and then minus skip to turn it off.
Um, yeah, anyway.
Um, but it's pretty, pretty neat and flexible.
And I think if you're going to start out trying to do docTest stuff, I would totally use xDocTest.
Plus it has a built-in pytest support.
So if you have it installed, you can say pytest --xDocTest and run it on your code.
It'll run fine.
Yeah.
Very nice.
Paul, you've done.
You are two for two on predicting what I was going to talk about.
So, but I, what I really want to hear you do is say abstract syntax tree in a Daffy Duck voice.
No.
You.
No way.
That'll be in the bonus track.
Brett Cannon made us sing a song, from like Ren and Stimpy or something like that.
Oh my goodness.
Ren and Stimpy.
Yeah.
Was it that it was?
No, it was, pinky in the brain.
That's what it was.
Pinky in the brain.
Yeah.
It's all from the same general genre and era.
We should do a Ren and Stimpy skit sometime.
That would be fun.
God, Ren and Stimpy was awesome.
That was awesome.
The peak of civilization.
Yeah.
The red button.
Okay.
Don't press it.
All right.
Uh, what's next?
I'm next with this one.
Okay.
So I want to start with some code and then tell you more about it.
I want to tell you the code and then you can think about how complicated is it and then
what does this accomplish?
So here's some Python code.
It creates a little LED.
It's for like some embedded thing.
It imports the LED, imports time and imports random.
It says LED equals LED number 17 while true.
LED on sleep.
One second.
LED off sleep for between 45 and 60 minutes.
That's the entire bit of code.
What does it do?
This is how I automated my standing desk with a Raspberry Pi.
Pretty awesome, right?
Yes.
So this one comes to us from Joe Ridley.
Ridley.
Thank you, Joe.
And this is by David Kong.
It's apparently he's into sort of hacking his productivity in all sorts of ways.
So we got a standup desk and he said, I have this cool automated standup desk.
You can push a button for up, push a button for down.
You have presets of like where you like the up, where you like the down.
But he didn't press it very often.
So he's like, well, why am I not pressing it?
Because I am lazy and I want to stand up.
And then so he put reminders on his phone.
Says, you want to stand up?
He goes, no, I don't want to stand up right now.
And then he said, well, what if it just did it?
And I had to like adjust to it, right?
So he went along and there's like a couple of buttons, little programmable bits.
And he just pried the faceplate off of the control surface of his automatic desk.
You know, it was a works desk.
So whatever if it breaks, I guess.
Pry that off.
And he just has a few little like pins in the back.
And if you push the button down, it completes the circuit.
And he's like, well, really, all I needed to do is stand up.
I can push the sit down button when I'm tired of standing up again.
And so I went through about like, how do I do this?
I just need to connect something that will trigger electrical current on one of these bits here.
So I said, well, maybe I could use some little like super micro thing, some small things.
I said, you know what?
Actually, for five bucks, I can get a Raspberry Pi Zero.
And you'll go crazy, get a case and an SD card and all that from Adafruit for five bucks.
And just write some Python code.
And then you connect these little pin areas, like number 17, for example.
to a circuit.
And instead of turning on the LED, it just sends a current over to that little thing on the desk.
And it'll make it go.
Isn't that awesome?
That's great.
I want to do that.
I need a standing desk first, though.
I know.
Here I am saying, Will, who is in the audience, has magic method names.
How do I know?
How can I tab complete?
And this thing's like, hook it up to terminal 17.
I mean, oh, okay, not 18.
All right, great.
Exactly.
It's pretty janky.
No, but that's great.
That is, I've got a...
You have a standing desk?
Stand-up desk.
It has a different brand, but it looks like the exact same panel.
Well, stay tuned.
So one of the things is, I don't really need a UI, but maybe just a terminal.
And how do I talk to the Raspberry Pi?
So David goes on to talk about how he set up an SSH shell over to his Raspberry Pi from his MacBook using a USB cable because it's on the desk anyway.
And then just writes this little bit of code that I talked about, move desk.
And off it goes.
Soldered a few things together.
And then just taped it to the bottom of the desk.
And now you have it going.
I would contend there's a few minor upgrades that should be added here.
Maybe a time check.
Like, you may freak a custodial person out if they come in the middle of the night and they go to get the...
The clone army has been activated.
Exactly.
We're going to empty the trash bin under your desk and it goes...
I mean, I would run for it.
But if that were me.
But, you know, so maybe like a web service call to check the time or just check the time and go, really just do this during work hours.
And like, honestly, this was a pre-COVID thing.
So it randomly raises and lowers it or...
Yes.
Between 45 and 60 minutes on the hour.
Okay.
That is fabulous.
Yeah.
If you look at the comments here, this is where you got to hang tight, Paul.
So people are digging it.
Someone down here a little bit further says, I have something called a VeriDesk.
But it turns out when I peeled the front off of my VeriDesk, it had exactly the same control board on the inside.
How about that?
Yeah.
So, Paul, if it looks the same, it may well be the same because someone else was saying that they did.
Now my desk is going to be smarter than me.
I mean, I've gotten used to my watch being smarter than me.
It will just have more willpower than you because you're like, I don't really want to stand up.
Well, I can't reach it anymore.
So I got to stand up.
The Fox and the Hedgehog.
Yeah, exactly.
All right.
Well, that's all.
But I thought it was a, I'm always thinking of like, we have these super cool devices that cost like five bucks and it's, they're so easy to program.
But I just, I don't usually have anything cool to do with them.
And this seems entirely attainable.
Yeah.
I think maybe hooking up a height adjustment with random adjustment to my webcam would be cool.
So I could just have different angles throughout the day.
What if there's like a pulley system that if you, that after a moment yanks the chair and if you don't get up, it's just going to dump you.
Like a little bit more urgency to the network.
Exactly.
Or score a gun if it finds you're still sitting or something.
Puts my coffee slightly farther away.
Exactly.
All right.
Paul, what's your last one?
This was a really interesting one for me.
I was on vacation in heaven in August.
And two things I did was when I was at the beach, I had the beta of Brian's book.
And when I was back at my mother-in-law's house, I was taking my six related Python projects and teleporting them into the future using the hypermodern Python cookie cutter.
And what do I mean by that?
Well, if you're doing a Python package, a library or something that you're going to distribute on PyPI, you know, Python development's gotten, the bar has been raised.
Let's put it that way, on quality control and tooling and things like that.
And my good friend, Brian Okken, long ago, 10 minutes, mentioned about xDocTest, which is also on here, I believe.
Yeah, xDocTest.
Along with 57 other things you might want to do, like Dependabot and Flake 8 and PreCommit and mypy and Black and GitHub Actions and all these other things.
And individually, they're achievable.
Collectively, they are a go on vacation in heaven, delete your repository and start over.
That's what I did.
I deleted all my repositories and started over with poetry and things like that.
This cookie cutter isn't just great because it's a cookie cutter that gets you in the ballpark out of the box.
It is a user guide that explains all the decisions made, including the why.
It's like teaching you how to become a modern Python packager programmer, someone who's going to distribute stuff.
And in fact, there was a blog, a series of blog articles before he did this.
Let's see if I can find that.
Yeah.
So often you'll see these articles of what you should do and then you just have to go do it.
And this is like, here's what you should do.
Indeed.
And then you run this command and then it's done.
But now you know why.
Indeed.
And in fact, I found the part you just described to be more valuable than the cookie cutter.
Yeah.
Because the last thing I wanted was to be teleported into 57 things I didn't understand.
Yeah.
And so just for the two of you, if you could look through that list, maybe anybody in the audience look through that list.
How many of these are things?
Brian, you've been distributing packages recently.
How many of these things are in your list of guilt that you're not doing?
Yeah.
No, a lot of these are great.
Some of these I'd like to add.
I'm not doing much type checking.
I'd like to do more type checking.
Sure.
I don't.
Some of the choices, I just don't agree with the choices.
So I was actually considering doing a fork of this with the choices that I would have made.
Knox is a cool project, but I've got no problem with Knox.
Yes, I knew you would say that and I agree with you.
I would change that too.
And I know you said you like poetry.
I know a lot of people love poetry.
It just doesn't fit my brain, so I don't use poetry.
But that's all right.
I'm only 50-50 on it.
I'm fighting it.
But a whole bunch of other stuff, like you said, things that maybe you didn't consider, like black and prettier.
I don't think I use both.
So I don't know what prettier gives me that black doesn't.
JavaScript and markdown-y things like that, JSON files, non-Python.
Oh, okay.
Don't know what release drafter is.
That looks neat.
The whole release drafter thing, I don't know if either of you have ever looked at release note automation in Python.
But there's a number of packages, semi-dead.
And most of them result in this dance of if you push before this thing runs, you can't get your notes on the tag.
Yeah.
Okay.
And so this is hooked up with a GitHub action, which makes a draft of your release notes for you as part of the merging a pull request to bump the version number process.
It's just fascinating.
I would have never figured this out, man.
Never.
Okay.
We got some cool comments.
One here.
It's not as from Exxon.
Yeah, that's a good point.
It's not as hyper modern as the title suggests.
It's often pretty solid advice.
I'm not sure if what he means by solid is a compliment or an insult.
I'm not sure.
I think what he means is hyper modern.
At least when I read it, I was like, the last thing on earth I want is bleeding edge on this stuff.
And then also, list of guilt would be a good title for this.
Yes.
One of the things I want to point out the article series.
So at the top of this, what we're going to link to, it links to hyper modern Python.
It's a list of articles.
The artwork in this is amazing.
So he's using some freely available artwork.
It's really cool.
It's a clunky thing.
Yeah.
Well said.
Did you read any of the articles, Brian?
Well, I read all of them when they first appeared, but it looks like there's some newer articles that I haven't read yet.
Yep.
So Claudio, mega kudos.
That's another project I should join because there's a couple.
I would like to teleport him from Sphinx restructured text to Sphinx markdown.
Oh, yeah, definitely.
Which is what I've done in my, each time I did this, I did a commit immediately to replace it.
And it's a little bit of work.
And so it's a contribution I could actually make.
Yeah.
Sphinx markdown is the reason why I use Sphinx now.
Very good.
So one last thing I'll close with on the X-Doc test, Brian.
I was using it from Hypermodern cookie cutter.
And I switched to this from Chris Withers, Sybil.
Sybil.
Nice name.
Which is, Chris is an old time Zopista.
And so what he does is he lets you, this is not about dot strings in your code.
This is about blocks in your Sphinx, blocks of code in your Sphinx and testing them.
But you wind up with this doing something pie testy.
And this lets you have fixtures and all these other things available in your doc test blocks.
Cool.
We'll check it out.
Yeah.
Super, super cool.
And actually on said solid was intended as a compliment there.
Yeah.
Very nice.
All right.
Brian, you got any extras to wrap it up?
I don't other than just an apology.
Sorry about the solid comment.
Oh, well.
I know.
That was good.
Paul?
That was good.
Anything else?
Yeah.
I had a chance, I guess at the end of last week, if you've been to PyCon before, you'll know
some of the folks in the PSF.
Bessie Walshowski, who has been with the PSF forever and ever, was with O'Reilly before that.
She is now with OSI, the Open Society.
God, I know I would say that.
Open Source Institute.
I spent 10 years on a project with the Open Society Institute, the other OSI.
And she is working with OSI on their messaging and fundraising and things like that.
And it's a very interesting problem for us in the Python community that's similar to the
problem we had with the PSF, getting people to pay for the comments, if that makes sense.
Now, the comments for the world of open source is a lot squishier.
And the value proposition is a lot more indirect relative to the world of Python.
But I feel like there is a big there there that the world of open source is still relevant
and still has important next problems.
There is a commons.
There are things that will need to be done.
And we need a neutral agency that is an advocate for the commons to to work on things like that.
So she and I discussed what's next for the commons, things going on at OSI.
If any of you were around in the beginning of the words open source, you know, the problems
that were being solved then.
They feel like solved problems now.
But that's an open question.
And sometimes problems don't have a way of staying solved.
So keep an eye on OSI.
Keep an eye on what Betsy and Stefano and others are doing.
Keep an eye on open source itself and maybe share some thoughts in the show notes or anything
like that.
What do you think is the big mission for open source?
Yeah.
Maybe you reply to the Twitter thread announcing this episode, which will be out shortly.
That probably the best place or the YouTube, the YouTube live stream chat would be good.
Good places for that.
How about you, Michael?
Do you have any extra bits?
You know, I do.
First of all, I want to just really quickly on the hypermodern thing throughout.
Remember, we talked about readme.so?
Oh, yeah.
Gosh.
And this is readme as a service.
This is good to generate your readme.
And then you can use the release note thing to keep it going.
So, yeah, I just want to give another shout out to that because the idea of readme as a
service blew my mind.
Does it do badges?
God, badges are so hard.
I know.
If it doesn't do badges, it better.
That would be an awesome upgrade.
Okay.
A couple of quick things I want to throw a shout out to.
These are at the bottom of the show notes.
Active States, you know, they're one of the packages, distributors of more full featured,
holistic sort of prepackaged Python distributions.
They are running a survey called the Software Supply Chain Security Survey to, you know, supply
chain security of like pip vulnerabilities.
IPI package pollution vulnerabilities and stuff like that are big deals.
So they're interested in running a survey.
So I thought I'd give a shout out about that.
People can fill that out.
Python 397 and 3812 are out with, I think 397 might have some very minor new things.
And 38 is just a security update.
So bug fixes.
But the 391 didn't speak to me as anything super major, but you might check it out.
There's a few security things in there about like, if you pass this to like the IP class
or something like that, it could be an issue, but I don't really think there's anything super
important there.
But no.
Brian, this one, let me read the little description for you.
This one here comes from Shlomi Lanton.
Does Brian, you talked about having a history of all the files and a GitHub repo and finding
out how long the oldest one, like we were just looking around, like how old is this project?
Maybe two years looks like lasting change.
So he wrote a thing called grandpa.
And the idea is simply find the oldest modified files in the repo that you can run it standalone.
You can make it a GitHub action and so on.
So it just goes through and finds the oldest files.
Last week, I talked about wake pi, which will let you keep a process awake.
No, keep your computer awake while your process, your Python process is running.
You do like a context manager, you know, with keep awake, do the stuff you don't want the
computer to go to sleep during.
And then when you leave the computer can go back to sleep.
And I said that there was a problem on macOS.
PR is accepted that things back to good.
So thank you for that.
Really quick shout out to some, oh my Z shell.
Not my Z shell.
Oh my posh shell.
Look at all that good stuff, Brian.
That's, that could be your, that could be your, power shell on windows.
Does it have VI key bindings?
If not, I can't use it.
Just, I honestly don't know.
Anyway, I think it's pretty cool, but people, and it's not just for power shell.
It just happens to be one of these really nice extensions that also works for power shell.
Oh really?
Yeah.
All right.
It took me forever to know what posh meant.
I'm like posh.
What, what shell is that?
Posh is power shell, right?
I, it probably is actually.
Yeah, it probably is.
It sounds cooler than power shell though.
Okay.
Cool.
All right.
Uh, I think that's it for, for those.
Are y'all ready for a joke?
Yes.
All right.
Here we go.
So here's a tweet from monkey user at is monkey user.
And they have a mess.
They have like a, this sort of planning diagram here, like a flow chart.
If you will remember a flow chart, but there's like real high level.
And it's about trying to find, a meaning and as a software developer.
So if the person enters to the workflow, quit.
Question mark.
Yes or no.
Yes.
Do you have paid time off?
Then, then what you can do, is you can go in and you change your JavaScript.
I think it's JavaScript.
Change your JavaScript framework.
Do you acquire new skills?
Are you burnt out?
No.
You go back.
You change your JavaScript framework again.
It's a little starving.
Have you changed your JavaScript framework in the last two, two months?
If, if, no, then you need to change it again.
It burns.
Yeah.
You've got some, some backlog here.
It goes to in progress and that gets shipped.
It gets done.
You get paid.
Do you have burnout?
Yes.
Are you dead?
Whoops.
Not yet.
Do you have paid time off?
Then you can change your JavaScript framework again.
No.
Then you ask, have it, has it changed in two months?
If, no, then you change it again.
Otherwise you go to the backlog.
And I thought this part right here, Ryan, you might particularly like, is it ready for QA?
Nothing goes to that.
It's just like an orphaned input box right there.
This should be, this should be the logo for HTMX.
Yes, it actually should.
Yeah.
This would be awesome.
Cause it really, it just tells you the churn.
And another person walks up and says, Hey, are you, are you trying to find a new workflow
for how we're working this?
No, I'm trying to figure out why I'm still doing this.
Well, there's, there's no way to go back to quit.
And there's, yeah.
Yeah.
And you found the Easter egg.
Yeah.
Well, also why is there still a separate QA department?
I love the leveraging of paid time off.
Yeah.
Backlog.
Backlog is like an afterthought.
If there's nothing else you can do, maybe you can work on the backlog.
Yeah, exactly.
Nice.
Awesome.
Well, thanks.
That's it.
Yeah.
That's it for our show, Brian.
Thank you.
As always.
Great to have you here.
And Paul, thanks for joining us.
Thanks for having me.
Love the show.
Love everything the two of you have been doing for the last few years and hope to tell you
this in person soon, but probably not.
Yeah.
That's wrong.
You said for me to interrupt you and tell you when you were wrong.
I forgot to.
Okay, great.
Keep happy thoughts.
Do you promise not to cut your hair until we see each other again?
Yes.
I want to be cousin it by next year at this time.
Love it.
All right.
Bye.
Bye, guys.
Thanks for listening to Python Bytes.
Follow the show on Twitter via at Python Bytes.
That's Python Bytes as in B-Y-T-E-S.
Get the full show notes over at pythonbytes.fm.
If you have a news item we should cover, just visit pythonbytes.fm and click Submit in the
nav bar.
We're always on the lookout for sharing something cool.
If you want to join us for the live recording, just visit the website and click Livestream to
get notified of when our next episode goes live.
That's usually happening at noon Pacific on Wednesdays over at YouTube.
On behalf of myself and Brian Okken, this is Michael Kennedy.
Thank you for listening and sharing this podcast with your friends and colleagues.