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 251, recorded September 22nd? Wow. 2021. I am
Brian Okken. I'm Michael Kennedy. And I'm Brett Cannon. So do we need to introduce Brett? I mean,
thanks for being on the show, Brett. Welcome back. We can introduce my cat, Gidget, for all those on
the live stream, because she's in frame at the moment, just lounging around on a nice, comfy
blanket. Actually from Google, from when I won an open source peer bonus. You won your way
more information than anyone probably cared, but there you go. Nice. Yeah, my dog is around
here somewhere, but probably won't show up and screen. Well, let's just get started. I think
if people don't know Brett, they need to get out from under a rock. So yeah, absolutely. Live chat
real quick. Brandon, Brainerd, thanks. They gave you a cat? No. Yeah. There's a long story
about how he got Gidget, but no. Cat did not come with a blanket. Nice. So the first thing that I want
to talk about comes to us from, this is both recommended and created by Dan Lutik. So Dan,
nice work. I love these little tools that you can run against your code that will just reformat them to
be better. You know, one of the, probably the most popular and well-known one is black, right? We've
all heard of black, which is great. But there's other ones like Flint, F-L-Y-N-T is one of my favorites
that converts all the various string formattings to F-strings, which is great. So here's another one
around typing called auto-optional. And Brett, I think people maybe are using optional a little bit
wrong in the typing space in Python. What do you think? Or just not using it when they should be.
Yeah. That's definitely a thing that was actually, I think, discussed early on about, do we even need
to have the concept of optional to represent, Hey, this thing can be whatever the type is or none.
And what was the thinking there? Because, you know, languages like C-sharp, Java, C++, you can have a
thing and then it can be null. And C-sharp, there's value types, but generally most things are pointers and
they can be set to null. And you don't have to have some kind of a special type to say it's
either a user or it's null. You just say it's a user because it could be a reference type,
but also it could be null or nil or whatever. But Swift and Python have this concept of you must
explicitly say that it could not have a value.
Oh, so explicit is better than implicit, as we all know. The other thing is obviously
having none accidentally sneak in when you don't want it. As you mentioned, Michael, Swift specifically
does not let you have null. You can't have null references. You have to either declare that it
will accept null and you have to check or it won't take it at all. And it's a similar thing here. No one
likes it when they actually find out, oh, the null type's not callable because you accidentally pass
null.
What's the most common exception type is attribute or type attribute. None has no attribute, whatever the
thing is you're trying to access, right? That thing?
Yeah, I'm willing to bet. Yeah, that attribute error alone, it probably makes up like a huge portion of
people's exceptions. So that's why you have to be explicit. Like you need if you're going to be running a type checker,
let's be very explicit about what you do and don't expect.
Yeah, cool. I agree with that. I think it's nice. It did surprise me at first, but then I'm like, oh, okay, well,
that's a that's an interesting choice. But now that I know, I should use optional. So here's a case of a function.
And it's just some food bar example, but they have a bar parameter and they say colon stir equals none.
So they're giving it a default value and saying it can be a string. Well, obviously that is like in three,
three words patently wrong, right? It can't both be a string and be set to be none because it,
you know, strings and type system can't be none. They have to, that has to be optional. Right.
And so that, except for all of us know what that means. I know we all know that. Well,
so funny enough, you know what it means, but if you didn't write that, do you know what they actually
meant? Right. Like if Michael typed that and you saw it, would you go, Michael meant for that to
actually be optional and that's nullable in terms of what, how other languages write it or was that on
purpose? And that's why that's not allowed is because you don't know who screwed up. If anyone,
was that accidentally written that way and it weirdly was meant to be optional or was it on
purpose? And thus it's listed that way because you don't know intent of someone else who wrote it.
This is why we went with the explicit where you have to label something as optional.
And this is why it's awesome to have core developers on the show.
So, so the idea of this is it's a thing you install, but then you pip install it, but then
you just run it on the CLI like Flint and you just point it at a directory and it will go through
and it'll find all of these default values that are none, but don't have optional in their type
information. And then it'll just add optional, which is pretty straightforward, but you know,
it's so easy to use, right? It's like, Oh, I have this 20,000 lines of Python code. And I really wish
they were f-strings like Flint, that folder it's done. So same thing here, right? It's I've,
I've got this huge bunch of code and nobody really thought about optional. Let's just quick fix that.
It doesn't fix it everywhere. Right? Like I could say a thing takes a string without a default value
for the parameter. And then maybe it's somewhere else that's getting a none. And it's not like that
advanced. It just looks, if you're having default values that don't match the type, make them match.
Yeah. so I like it. one of the questions I have is, so if I do optional string equals none,
does that mean I still can pass none to the, to the function? Yes. Cause it's no different.
That is normal. Okay. But wouldn't that be the same as saying that I can pass stir or none?
Yes. Yes. And also that's what, on the live stream, Will McGuggan, Hey, Will says,
do you need optional now that we can have foo pipe none as a, an alternative to optional of foo?
No, but this is sort of more backwards compatible, right? Like Brett, when did that come out? Is
that three, nine? three, 10, I think three, 10. Yeah. So, so it's not even out yet officially
next month. Yeah. So give it, give it a little over a week. Right on. That's exciting. But you know,
how, how much backwards compatibility do you want? Right. So I think soon, but maybe I don't know if I
would go yet. And then Chris may says, oops, opening PyCharm to add optional to my last project.
Uh, before you go to the work to write it, just run this against it on the CLI, on the command
line and just see how it works. Right. So yeah. So it also works in VS Code. Although Zdocs does say
back in three seven, you can use from Dunder future import annotations and then get that to work. I
don't know about that personally, Brett. So what Zdocs is suggesting here is if you use the from Dunder
future import annotations, what that does is it turns all your annotations technically into strings
to Python. And so it's actually not executed because before that, what actually happened was,
is that code in your annotation actually got run and the resulting object cut bound to the code object.
What that future import does is just says, no, no, we don't want to pay that overhead, on your
import. You might have performance reasons. Don't do that. And it'll actually just become a string.
And then we have some stuff, to try to resolve that at runtime. This is the whole thing that came up
in Python 310 that, you all covered in a previous episode of Pydantic going, Oh God,
there's a change coming in 310 that might break us. And there's a whole kerfuffle. And anyway,
that's what that's all resolving. So technically you're right that you could write it back,
but it would break complete expectations of everyone who ever tried to use your code when you tried to run
that somewhere else. So I would advise against it unless you know, you're going to be working against
310 because for instance, someone might write code for Python 3.7 or 3.8, tell my pie it's Python 3.8.
And then it would error out saying, well, that like that syntax makes no sense.
Right. Okay. Interesting. All right. Well, yeah, pretty good one.
Pretty good one. super easy to use, not a whole lot to it, but I think it's because it's so easy to adopt.
It's kind of a nice one. yeah. Well, I want to talk about something that's not easy. It's not easy to write good documentation.
So there's an article, from Daniel Stenberg and this doesn't apply to just, Python stuff. This applies to every software, all software stuff.
Uh, there's an article called making world-class docs takes effort. And I think it's an understatement. It takes a lot of effort.
Uh, but there's, this is a nice little doc, project or article talks about, he's, he's got some gold, gold things that he looks for to get a gold star.
You must have these six items in your documentation. So let's just talk about what, what he's looking for. first of all, the documentation should be in the repositories, the code. I've got mixed feelings about this, but in general, I'm on the side of, this is a good idea just to keep the code and the docs together.
The only reason why I sometimes find it difficult is when is I'm updating my documentation possibly way more than I'm updating my code. And it looks like there's a lot of turn on the code when there's not. So I don't know. but generally I think that's a good idea.
Yeah. Most, most projects have the reverse, right? Like the documentations were edited that was edited two years ago, but there's been changes continuously. Right. Like, I don't even know if they still apply, but.
Yeah. Yeah. But it is good to try to keep these together. Also, you can make a pull request or a merge request be with both the documentation and the code together. And, and so that's a good reason for that. next up is that your docs are not extracted from code. And I know there's a lot of tools out there that can try to do this, but the comment is just think about your favorite project documentation. Is any of it generated from code and odds are not. So, yeah, I, I agree with this.
Yeah. You can usually spot it because it'll be like method login user. And then the, the method, the, the comment will be logs in user.
And you're like, honestly, I've seen the reverse too, where people have doc strings that are extremely verbose and take up pages in your terminal just to scroll through.
And because they just use that to spit out your docs, in which case it's not as convenient as when you just run help from a ripple to just go like, I was this do again.
What are the arguments? Like, I need a really clear point pointed thing directly at a developer who's just trying to double check something versus a whole ex exposition of here.
All the examples of how to use this thing. It's like, I don't need that level of detail. I just need to remember one little thing.
Right. Right. Right. Yeah. It's, it's a range. Is it inclusive or exclusive of the bound? Like something like that. Right.
One thing's the one place where I'm, I'm working on, I've got a project to try to use auto-generated documentation is I've got a really large test suite on a project.
I'm shocked. Absolutely shocked, Brian.
That I would really like to have doc strings, the encouraged developers to put doc strings in there for the reason why the test exists and what feature it's really testing.
And to be able to have an auto-generated light, like website with just all of our tests, that'd be cool, but I'm not there yet.
That makes sense.
The next thing is your docs feature examples.
And I love this because that's what people want to know.
If I, if I want to do this, how do I do it?
And so the comment is really just use examples.
If you already have examples, add more.
You probably can't have too many examples.
And test them.
Oh yeah.
Test the examples.
We covered a tool called make doc test that you could use to test your code within your documentation.
Use that.
Next is your doc, your document, document every API call you provide.
This one's a tough one to keep up on, but it's really important.
Even some great projects like typer and stuff that I've used not to, not to bash typer, but I think all projects have this problem.
They'll add a new cool feature and it's cool.
I want to use it and it's not in the docs yet.
So that's a tough one to keep up on, but please do.
One thing I'll say that is actually hard for Python is because it's so dynamic.
It's hard to actually get a static list of all the API points.
But one thing I'll say because Paul Everett says I have to bring more Rust to this podcast.
Docs.rs, which is auto-generated documentation for anything uploaded to crates.io for Rust tools, will actually give you a percentage of covered public APIs.
So you can actually see how much coverage you have in your documentation.
So that's an interesting definition of code coverage.
Yeah, it is, right?
But it's like I didn't even know about it.
And then I found it when I was just double-checking that everything built okay for a project I will mention later in my extras, extras, extras.
And I noticed it was 100%.
I was like, I thought I covered everything.
And I went back.
I was like, nope, there were actually a couple enum values that I didn't document.
And so I was able to go back, do that, and make sure I had full 100% coverage of my stuff.
It can be handy.
But yeah, it's tricky in Python, right?
Where it's like I could auto-gen my whole API and no way to know whether I covered it or not.
At runtime and never have it hit disk, yeah.
Yeah.
Last couple things.
Docs should be easily accessible and browsed.
And hopefully a search feature or something, even if you attach Google search.
That's cool.
But there was a comment in the text also to say, preferably be able to have that online.
So offline is what the comment is.
So if it's, and I'm on the fence on that.
I'm usually attached to the internet.
So looking stuff up isn't a bad thing.
And easy to contribute to, the lastly.
So yeah, documentation stuff.
There's a lot of stuff.
It's hard to get it right.
There's a lot of stuff I'd add if I was being more verbose.
But the last thing I really want to add to this is don't slam projects that don't have good documentation.
Because it's hard.
If you want to have it be better, then contribute.
Fix it yourself.
Yeah.
Brian, you're kind of blowing up the audience out here with the comments.
So I'll throw a few out that seem interesting.
Sam out there says, pro tip, keep on top of your documentation, even if it's just a cursory
doc string.
Some notes.
Otherwise, it quickly gets out of hand.
Yeah, it's definitely one of those things that if you had to sit down and write it all at
once, it would be dreadful.
But if you can kind of do little bits as you go, then for sure.
Right.
Brandon Brainer says your documentation update should be part of the ticket or even better,
your definition of done for the ticket.
Right.
Like when you estimate how much work in your sprint or something.
And then Chris has a great one.
Bonus documentation.
If a bonus, if your documentation includes animated gifts or emojis.
Yes.
Yeah, those are awesome.
We'll probably leave it there for that one.
But that's great.
All right.
So one interesting thing you could actually do is if you really want to push this is if
you keep your documentation in the same repository as your code, you could.
I'm going to use this from GitHub.
I'm sure GitHub has equivalents.
But you could probably set up a GitHub action.
Actually, I know you can because I've written the GitHub action to do this to actually have
your checks, your status checks on your PR fail if there are no touch docs and have
to have to opt out of that check.
Right.
I actually have a GitHub action I wrote called check for change files.
And you could write a requirement saying if you change any .py file, an equivalent .rst
or .md file must be changed somewhere in the PR.
And if it's not, have to add like a skip docs labeled to make it pass and otherwise let people
know very explicitly.
OK, we care about our docs.
You can't just opt out of it.
Please make sure everything's up to date.
There are ways to really push this pretty far if you really want to go for it.
Yeah.
Have robots be mean and say, no, you haven't finished your PR yet rather than the maintainers.
Yeah.
All right.
Tell us about this next one, Brett.
Yeah.
So once again, more rust on this podcast due to Paul Everett demanding it.
And I've noticed there's been a slight theme the last couple episodes of talking about ways
to kind of improve your shell and your general development flow, as it were.
And one thing I use here, and partially because Michael's mentioned Oh My Posh multiple times,
I believe Brian's now mentioned Oh My Zeesh.
I thought I'd just mention what I use for All My Prompts, which is Starship.
The thing I love about this is it's actually cross shell.
So what you do is basically you define, it comes with a lot of basically plugins for configuring
built in.
And what you do is you basically turn them on and off, configuring one way or the other.
And then there's a one line activation you just put in your code.
And that's it.
Configuration is done by a TML file, Starship.TML.
And then it just works.
There's no mucking about.
It doesn't matter what shell you're on.
And it just does its thing.
And the reason I really appreciate that is I'm one of these people who likes to play with
tools, right?
Which leads to me playing with different shells, right?
Probably by the time Paul Everett tries out fish, I'll be trying out new shell.
So because of that, I want to make sure that I can bring my shell with me very easily.
And Starship, for instance, has support for fish and Zeesh and Bash and all of them and new
shell.
So I can very easily try out a different shell and not feel like I'm in a foreign country
where the prompting is gibberish, right?
Like I always hate it.
It seems like, oh, my Z shell go on to Z shell and oh, my posh go on to posh.
And like you're stuck on that specific one, right?
Exactly.
And there's oh, my fish.
Like pretty much every shell has an oh, my something or other to tweak it out.
But with this, at least for my prompt, which is actually what I see the most, right?
Like I don't know about the rest of you, but my prompt is what I interact with.
More than anything in my shell, not the extra fancy stuff I put in.
It's this.
And so this is why I really appreciate this project.
I will also.
Yeah, go ahead.
I did.
Go for it.
It's just.
Well, what I like is we're seeing on the screen here.
If you go to the starship.rs site, you can see like a little animated GIF and props to
them for putting that on there.
That is fantastic.
As we just learned, it's good documentation.
Yes.
There's a lot of stuff about if you're in a GitHub branch and what branch you're on and
versioning and things.
Does it have specific stuff for Python and Python virtual environments and versioning like that?
Yes, because I don't use it, but there's built in PyPI support.
But if you use the Python launcher, I actually have an entry on it in the FAQ for the Python
launcher to tell how to use the Python launcher to automatically tell you what version of Python
is being used.
And then you can configure the Python configuration to say, what should I trigger on for it to be
considered a Python project?
And it has a default list that's pretty good, like pyproject.tom, setup.py, setup.cfg.
The things you would expect any repo or workspace or whatever to have to be a clear marker that
there is Python that I care about here.
And then the other thing is, is there's also a way that if you use PY, you can also have it set up to
auto trigger as long as you just have like a .vemv directory, for instance, that contains your
virtual environment.
And then if you happen to use the Python launcher to be the way to query for what version of Python
it is, it all magically just tells you what version your virtual environment is in.
And so I actually use this with the Python launcher because it will always tell me exactly what will
happen if I just type py.
Oh, nice.
Yeah.
Yeah, that's awesome.
And I know nerd fonts have been mentioned previously on this podcast.
You'll notice that it has nerd font support.
So if you get that installed, there's extra little fancy bits to it.
You don't have to have it installed while those things will either turn into Mojibake or you can
just turn them off.
Yeah.
But there's all sorts of stuff that this thing does.
There's even real nice little subtle details.
Like if you use Starship and if you're watching the live stream, you'll notice that the prompt
is green when the last command succeeded.
But if it fails, it turns red.
Like there's real nice little subtle touches of this tool that I really appreciate.
Yeah.
I really like it too.
It looks great.
I'm going to try to check this out because I'm I'm always using I got some tools that
I have to run from the command prompt.
And but most of the time I'm in bash or something else.
So, yeah.
Yeah.
Very nice.
Zdocs says using multiline shell prompts and FZF are two of the better productivity improvements
I've ever done.
I I wanted I've highlighted that specifically because I really like these multiline prompts
that has all the details and then the prompt is below it.
But I can't bring myself to use them yet.
I don't know why I've just it's I'd rather have it more densely packed on one line.
Where do you stand on this?
I used to be that way.
Actually, I I used to be a Z user before I became a fish user.
And even before this, I used to use left prompt and right prompt.
And I had a consistent left prompt, which was basically just the greater than symbol.
And then I had my current working directory as my right prompt so that at least the cursor
position never shifted.
Like, I don't know about the rest of you, but I always find that that they're joking
nuts.
Like, where's the start of my prompt now after I changed my directory?
So having that as the right side was great.
But then I saw this and I was like, OK, I've never loved this, but this is so nice and set
up across the board for everything that I consistently use, like Rust, Python, NPM, whatever.
I was like, OK, I'm going to give it a shot.
And I did it and I've stuck with it and I continue to like it.
So I totally hear where you're coming from in terms of the density level.
But it's just turned out to be way too nice with Starship for me to care about going back.
Now, if I do go back, right, and I don't have it set up for this, I actually have like my
.files set up so that my default basher, so you know that if I end up on a random machine,
at least has that kind of prompting.
But as soon as I'm on any machine where I know I'm going to be a fully set up environment,
I just kick on Starship.
I just don't care.
I basically I get it.
But this was just too many benefits and I just let it go.
And now I just don't notice it.
Yeah.
And now you're used to it.
Right.
I think I'm going to try to embrace it.
Just just run with it.
And honestly, the resolution on all our screens are so high now compared to what it used to
be back when I picked up that habit that the lack of vertical density, maybe it's because
I'm a black user doesn't bother me so much anymore.
Yeah, that's true.
I do have a 4K monitor, I suppose that like a 32 inch 4K monitor.
I could probably fit the terminal on it.
I suspect so.
It's actually kind of nice to have the those like color stuff in your in the multi line prompt
to be able to kind of scroll up and see where the beginning of your line, your command started
because it's easier.
It's like an HR horizontal rule.
Yeah, exactly.
Or yeah.
Final thing, Jeremiah Page out there in live stream says Starship is great, but I think
you need nerd fonts for some of the plugins.
Hold that thought.
We'll be back to more nerd fonts later.
But that is correct.
Some of the things like if you're watching the live stream, there's a nice little symbol
for like a branch next to the get stuff.
If you have the power monitoring one that tells you like your battery is low, it uses nerd fonts
to show that.
But Michael's foreshadowing something coming later.
Yes, indeed.
All right.
Let's talk about James Path.
Now, Brian, one of the challenges we always have on the show is we have these acronyms for
packages and then we have to speak them.
And we've never spoken to the person who creates it or named it.
And so we always I'm sure we wreck the names of so many packages.
And let's just do a blanket apology.
But this one is called James Path.
And I know because it says J-M-E-S-P-A-T-H pronounced James Path allows you to like, yes,
this is another new thing I'm starting to really like allows you to declare to declaratively
specify how to extract elements from a JSON document.
So instead of going through and sort of going, you know, parsing up something as JSON, turning
to a dictionary and then traversing it with indexes and keys and such, there's a whole lot
of interesting things you can do to quickly get at elements.
So, for example, you can just if you had the dictionary that had key foo and then inside
there, there was another dictionary that had a key bar and then that had a value baz, you
could just say foo dot bar and it'll give you baz, which is kind of nice.
You can also do that with with arrays, although this is actually not doing anything.
It's just giving you back the list and then you're indexing into it.
So whatever.
But you can do things like star on it.
So, for example, if you had foo bar and then bar was an array, you can say like foo dot bar
a bracket star dot name and it'll give you all the names out of the sub thing, the sub dictionaries
in the list that bar points at.
So there's like these cool, like almost like SQL like things.
You can also do negative indexing into it, which is pretty nice.
You can do star like foo dot star dot name for hashes to get the values out kind of like
a set or something.
So that's pretty nice.
And yeah, it's pretty interesting.
This one comes to us from Josh Thurston.
So thanks for that.
He said he was working with all these sort of arbitrary nested JSON documents.
And it was really handy for that.
So, you know, you look at this code and I'm sure, Brett, you're thinking that's not Python, right?
No, actually, I'm wondering if the query syntax is the same as JQ.
And do people know what JQ is?
I don't know what JQ is.
Yeah.
Interesting.
So JQ is a command line tool.
So literally, it's just JQ, Juliet, Quebec, that is designed to actually take in JSON,
more or less use the same kind of syntax as the query selector and the browser for CSS selectors
and query your JSON.
I think it's meant a lot for like tools if you're using like HTTPY or curl or whatever to query
some like REST API that's going to give you back JSON and then to try to find something out of it.
And it looks pretty similar.
So I'm thinking that this is maybe kind of just a Python packaging approach to the same syntax,
which is neat because it means if you know one tool, hopefully it'll work for you.
Yeah, right.
Yeah, it could be.
So you should think of it not as syntax that you write, but more almost like a regular expression.
So you would import JamesPath and then you say expression equals JamesPath compile.
And then you give it a string, which is these things I've been describing.
And then you can tell it to like search or execute queries against things.
So a lot of neat stuff you can do there.
You can even add custom functions that can become part of this query syntax.
So if you create a class that derives from functions that comes out of that library,
you can have things like unique letters.
And what you could do in there is say, given a string, I would like to do a set on the string
and then turn it back into a string.
So it only shows you the letters involved, not necessarily, you know, with duplication.
Right.
And so then if you create that, then you can do things like when you do your search, you can do food out bar pipe, unique letters,
and you pass the parameters over.
And it'll give you, you know, basically the result of those values, but then applying these transforms and stuff to it.
Cool.
So, yeah, pretty neat.
You got a lot of traversing dictionaries and stuff like that, and you kind of want to treat them like SQL.
I feel like this is sort of along those lines.
People can check that out.
All right.
Brian, over to you.
Yeah.
I wanted to cover, this was announced last week, I think.
There's a tool called Pedalboard.
This is a library that comes from Spotify, and it's for manipulating audio files.
But in the introductory article, it says the power and speed and sound of a DAW.
I never knew how to pronounce that one either.
Digital, what is that?
Digital audio something.
Workstation.
Yeah, digital audio workstation.
A DAW, I think.
Maybe a DAW.
DAW.
I don't know.
So what do you use?
I use Logic Pro usually.
So something like that would be a DAW.
Yeah, I use Adobe Audition.
Yeah.
So there's a lot of stuff you can do that are just common things that you're going to do to all files.
So it'd be kind of neat to automate that.
So things I'm thinking about are things like a compressor, a high-pass filter, a low-pass filter.
But this thing has a whole bunch of other transforms you can do, like convolutions
and chorus and some distortions and gain if you want to make it louder.
Some reverb, a high-pass filter.
And then stuff.
I don't even know what it is.
A ladder filter.
I don't know what that is.
Phaser?
Phaser.
That sounds neat.
Yeah, it does.
Oh, shit, Scotty.
So I definitely want to try that out.
And if you're working with audio files, I think it would be kind of a fun thing.
We've linked to the GitHub repo for it, which is nice.
It's completely open source.
It says it also has some cool things like plugins for VST3 and audio unit, which I have no idea what those are.
But also, there's some...
One of the things with audio is it takes a while.
So there are speed enhancements in this.
So it says it really doesn't take that long to use it.
It takes advantage of your CPU cores, which is neat.
Also linking to an article to introduce it.
And I got to warn people.
There's an image at the top, which totally messed with my head.
Because, I mean, it just triggers me with all the different flashing colors.
So be careful with that.
Scroll past that quick.
But other than that, it's a good article on what it is.
Some graphics.
And I don't quite get...
There's some graphics on how it works.
And I don't quite get what the graphics mean.
Like the noise gate really doesn't tell me much.
I love the noise gate.
That's one of the biggest tricks to sound good, actually.
Yeah.
So important enough for me that I've got a hardware noise gate in my studio.
Nice.
Anyway, cool library.
Check it out.
Yeah.
So if you want to do audio transformation.
If you want to basically write Python code that does like Audition or the one you said, Brian.
Well, I mean, and especially with automation.
So if you've got like a whole bunch of files you're dealing with
and you want to make sure that they're all kind of the same level,
you definitely want to automate that and not try to...
And I know there's ways to automate with some of your other tools too,
but it's kind of cool to have this.
Yeah, definitely.
The only thing I have to contribute is going back to Brian's previous link about good documentation.
While you two were talking, I just submitted a PR to fix the trailing triple backticks
accidentally left in their readme.
So just to give feedback to people, trying to fix documentation is always appreciated.
And it's usually something you can do pretty quick, especially with either the pencil editor in GitHub
or just hitting the dot to use GitHub.dev if you want, if you need a little bit fancier support and just send that PR.
And I mean, most maintainers would appreciate it.
As we all know, it's hard to keep going straight.
If you submit an issue or send an email and say, this part of your docs needs this misspelling fixed
or this link has an extra trailing slash that makes it not work, that's work.
If you submit a PR, that's joy, right?
You just say, I accept.
Okay, you fixed it.
Thank you.
I'll just carry on, right?
Rather, oh, geez, I got another thing to do.
So yeah, that's great.
Nice catch.
It took me well to see that.
Yeah.
Well, I mean, some people ask me, like, how do you have so many contributions to so many repositories?
That's how.
Literally, if you just read docs, anytime you find anything a little off, just take the time to just submit that PR.
And most of them get in.
Not all of them do.
But honestly, that's enough to just kind of help out.
And honestly, you just suddenly end up contributing to, I think I'm up to 160 something repos on GitHub at this point.
Wow.
That's awesome.
Thanks.
Okay, so Michael said it was nice sometimes to have core devs.
We'll see if this doesn't cause you to regret having core devs on the podcast.
So I'm going to use this as story time and just kind of explain how processes work in terms of packaging peps.
Starting about six months ago, I took it upon myself to try to come up with a lock file format for Python.
It seemed like it was kind of a gap we had where multiple tools were trying to solve the same problem.
And that felt like something that we should try to avoid if possible.
Coming from speaking as the dev manager for the Python extension for VS Code, having each bespoke tool such as pipin, poetry, requirements.txt files, even through pip-tools, right?
Having to support each of those tools individually is a drag, right?
Like it takes a lot of time and effort to figure out what to do for each tool.
If the tools update, suddenly we break.
So it's a bit tricky.
Making calls through CLI is kind of an annoyance too because we got to make sure that they're, you know, how to use their API, what they report out is consistent, that they don't change it.
Because not all tools consider their output or their CLI part of their stable API that they maintain.
Anyway, there's a lot of drawbacks.
So I tried to decide to be silly and take it upon myself to see if I can come up with a way to get all the tools to kind of rally around something.
There's also needs for like cloud, right?
Like if you upload something to Azure Functions, they want to do the install for you, but you need to be able to tell them what you want installed.
So lock files, good thing, right?
Just in general.
So I spent six months talking behind the scenes with various people.
Originally it was me, Pratune, and Zuping from Pip.
We came up with a lock file spec.
And then we invited Sebastian and Frost from Poetry and PDM, respectively.
And they said, that's not going to work for us.
And we said, why?
And it's like, well, your lock file was defined very specifically for a certain platform, right?
Like think of wheel tags, right?
It says, well, Python version, what ABI do you support, and what OS are you on, right?
That's the platform from what I'm speaking from.
It's like, that's great, but we want platform agnostic lock files, right?
Like if you ever crack open the lock files that Poetry spits out, they actually work no matter what OS you're on.
And it was by design.
Sebastian wanted to make it so that it didn't matter.
And actually, I've heard a good example from Pratune where it's like, let's say you're doing Pi Week, right?
And you're doing a game.
You might be developing on Linux, but if you want to give it to your teammate who you're working with during Pi Week and they're on Mac,
you want a way to be consistent on what you work on.
And then if the judges are on Linux, you're on a whole other place or Windows or whatever, right?
So there is a use case there for platform agnostic lock files.
So we tried to add that back in.
We took this public to discuss stuff at Python.org where all the packaging discussions happened.
And it led to 152 comments on a thread starting July 29th.
So actually, it's more like, oh God, eight months ago.
So this led to a whole other discussion, right?
About people going like, okay, the clarification.
And it ranged, right?
All the way from the title's not clear enough to like real nitty gritty details.
And it's now led to us going back, having discussions with the same people plus some other people who participated here who made good comments
to try to come back with another approach that's a bit more from the ground up covering everything versus what we had before where it was just a platform specific lock file.
And then we kind of bolted on the agnostic bit and try and design it from scratch.
But the key point here I want to make is you hear people sometimes go on about, oh, I really want lock files, right?
Like I've talked about this publicly and I think I talked about this PyCascades, maybe I mentioned it during the steering council keynote or maybe it was PyCon.
And my wife, Andrea, who said she might actually be in the live stream, said, oh my God, all the comments about when you mentioned lock files were so, so positive.
Like, okay, cool.
It's surprisingly hard to make this stuff work, right?
Like everyone thinks it's a snap your finger.
Someone has an idea.
Do you just get it done?
But there's a lot of use cases here, right?
And especially with packaging, you constantly hear people go like,
Oh, packaging in Python is so bad.
Well, first of all, most people are out of date.
Like Brian's been really great about having me and other people come on testing code, for instance, directly, specifically to talk about this past packaging stuff to keep people up to date.
So there's a lot going on, but if you need to try to keep up.
But on top of that, it's just hard to make any changes because there's so much legacy out there.
Everyone's got their own workflow at this point, right?
Like 30, 30 year old language that's had some form of packaging for like over 20 of it.
Everyone's got the way they want to work.
And no one likes to have it changed on them.
Especially your workflow, right?
Like try telling someone who's using VS Code, like, yeah, we don't think you're doing it the right way.
Does not fly, right?
It just does not work.
Everyone wants to work the way they want to work, which is totally fine.
But it also makes trying to come up with a standard really hard.
So the point I'm trying to make here is try to be understanding when you work with packaging Python.
Not only is Python challenging it on its own due to the amount of C code, Fortran code, all the crazy stuff that people used thanks to us being the glue code, the glue language of the world.
But on top of that, there's a lot of legacy.
Everyone has something they ask for.
And people are working very diligently to continue to try to improve it.
But do understand that there's a lot of work going on to try to make it better.
So please try to be understanding on Twitter or wherever else you're going.
Oh, my God.
Packaging Python is so bad.
The places where outrage must be expressed.
Yeah, yeah.
So that's what really here.
So A, lock files are hopefully coming.
I am working on a V2 of this PEP.
Probably go public with that.
I'm going to guess sometime next month.
And these will be independent of things like poetry and pip-inf and just pip and stuff like that?
If we're lucky, right?
Like the key point here is we can't require this.
But the hope is whatever solution we come up with will be good enough for those tools to rally behind.
None of this is like an edict from on high to say like all packaging tools must use this.
The idea with all this has to be what's the carrot for the tools, right?
How are we making things better both for the community but for the tools themselves?
Now, it can be we make it so great from the community that the tools feel pressure to support it.
But when you're talking from this perspective, the first thing you're dealing with is the tools.
So it's trying to make the tools happy because then eventually the users also become happy.
So we'll have something.
At worst, my suspicion is at absolute worst, we'll have platform-specific.
Specific lock files come out with this path.
But my hope is we can get platform agnostic and get all the other tools on board so that everyone gets what they want and need and we can service everyone's needs.
Nice.
But the key point here is it's being worked on.
It's taken a long time.
It's going to take even longer.
So understand that when people say, oh, why can't packaging get better faster?
It takes a long time, right?
Like literally, I've been working on packaging as my focus for Python stuff for years now, right?
It's not a fast process because there's a lot of people involved, a lot of projects.
Everyone has their needs.
So people just need to be patient.
But do understand things are getting better consistently.
That ends my rant to hopefully not make you all regret having me on.
No, that's great.
I love the insight.
The only thing with packaging that I want to bring up is I wish it didn't change all the time.
Sorry.
I couldn't resist.
No, I think things are getting better and I like the direction.
So, but cool.
Yeah.
I mean, my grand unified goal when I got involved with packaging really was to try to drive everything towards standards and specs, right?
Like I have a project called Mouse Bender after the clerk from the cheese sketch, right?
If you don't know the Monty Python sketch, it's when one of them walks in and just starts to ask for every cheese they can think of and they don't have any in the cheese monger shop.
So, anyway, I created an outline of what does it take to go from I want to install Django 3.2.7 down to actually getting files on desk.
And I figured out where there was a spec and where there was a library back in that spec and where the gaps were.
And I've just been trying to plug it.
And this is probably the last one, right?
Because more or less this takes care of the pip-tools, pip m poetry kind of give me a set of locked things and let me be able to reproduce my environment.
After this, I think I'm more or less kind of I'm personally probably going to be done with packaging.
After this is moving on to WebAssembly, which hopefully make Michael happy.
Oh, yeah.
And then probably that'll lead into is there a way to potentially start distributing like a self-contained binary for Python or just try to help with Python as a Python, CPython interpreter distribution kind of solution.
So is the new PEP going to be 666 or is that already taken?
No, actually 666 is taken.
Okay.
It's been taken for over a decade.
It was purposely done to be immediately rejected because it said you should be able to allow mixed tabs and spaces.
So that was written to make people stop asking for that and it got rejected immediately.
Okay.
But no, I'll just since this didn't get accepted, I'm just going to rewrite it in place.
The goals are the same.
There's no need to have to do yet another PEP.
So since this draft, I'm just going to basically just gut it and redo it.
And since the goal is the same, I'm just going to reduce the number.
Okay.
Nice.
Well, thanks for working on this because it definitely is important.
Yeah.
You're welcome.
Hopefully it'll lead to something.
Otherwise, I've had a lot of interesting conversations about how people do and don't want to lock things.
Brian, back to you.
Back to me?
Yeah.
For extras.
You got any extras?
Yeah.
So I've got one.
I'll throw it up.
So it looks like Python's popular.
I've heard that.
I bet it would be popular enough to have a podcast about it.
With lots of pop-ups.
Or three, even.
Exactly.
So there's an article on ZDNet.
Python is on the verge of another big step forward.
And the big step forward, apparently, is the Ti...
I'm going to get this wrong.
Tiobi Index.
List C is the number one language.
But Python only needs 0.16% more to become the number one language, according to this index.
So are they arguing that if we got to the top of Tiobi, that would cause another spike in usage?
I have no idea.
No, another spike in usage would cause this to happen, maybe.
I don't know.
Oh, I don't know.
Yeah.
So I think, historically, only C and Java have ever had that designation.
And so it's kind of big news.
JavaScript's never gotten up there?
I don't think so.
Oh.
Okay.
One more thing.
Brett mentioned the cheese sketch.
And if you go to PyPI.org and type, like, anything that's silly, you'll probably get a 404.
And the 404 has the cheese sketch embedded in it.
Yes.
The G-shop sketch is at the bottom.
And a piece of history.
PyPI was originally supposed to be named the G-shop.
It was actually originally supposed to be, it was actually originally cheese shop.python.org.
But people were too concerned that managers wouldn't take Python seriously if the package index was named after a mighty Python sketch.
So it got its name changed.
Yeah.
Cool.
Brett, looks like you got some extras as well.
Yeah.
Well, I mean, this is Python Bytes.
So we couldn't go an episode without mentioning Will.
Although I think Will's out in the live stream.
So this is also more of the Paul love fest on here.
So Paul had Will go on to an episode to talk all about textual and rich and how it's all textured, mainly textual.
I believe Will tweeted that he got a haircut for this and everything.
I actually haven't watched it.
But as I said, it's not Python Bytes that Will doesn't get mentioned.
So I just want to make sure Will got called out.
I will also say that it has been 30 episodes since I was last on, which I thought was kind of a nice round number.
But on that episode, I mentioned that I was working on the Python launcher for Unix.
And since over the last 30 episodes, I've actually wanted to mention that I had launched version one.
And thanks to Brian and Michael for feedback because actually one of their feature requests got into it.
The one thing I did want to call out that actually did happen recently is the launcher is now actually in Fedora.
So one of the first things that ever got contributed was someone actually put Arch.
It was actually Burnout Gabor of Tox fame.
Got it into Arch via AUR.
I don't know how Arch does community versus not.
There's a whole thing.
But you can install it via Arch.
But just the other week managed some very nice folks from Fedora were nice enough to get it in.
So you can actually now use DNF to install the launcher on Fedora.
And then all the previous tarballs are all there as well.
So it's still available.
But yeah, version one, no bugs so far.
So it seems nice and stable and meeting people's needs pretty much.
Awesome.
Congratulations.
Thank you.
I'm pulling on Michael extra, extra, extra, extra at the end.
I will say that my Syntactic Sugar series is still going on.
When it's done, I'll probably have a wrap up thing.
And this is probably going to be what my next set of talks will be all about.
But they're still happening.
One interesting thing.
I actually just did two just in the last two days.
They were short.
Actually.
Oh, God.
I didn't really.
They published three in a week.
That's a lot for me.
I did have one that didn't work.
So if anyone's curious, what happens when I can't unravel a piece of syntax?
You can read that blog post to see how I put in all the effort to do it.
And then realize the day after.
Oh, yeah.
That's not going to work.
I did enjoy that.
Oh, good.
Yeah.
Assignment expressions continuously break me in various ways.
So there's a bunch of syntax I can never undo because of assignment expressions.
They're handy, by the way.
I've used them since the month after we approved them.
But they do make unraveling our stuff hard.
And then for Brian, I just wanted to call out that in our last release for the Python
extension for VS Code, we completely redid our UI.
VS Code now actually launches with a built-in UI for testing.
And we integrated directly into it.
So now you have consistent UI for testing.
Like a test tree result type of navigation thing.
Yeah.
Well, and we had that before, actually, but it was bespoke to our extension.
And so there was some wonkiness to it and all that.
But now that this is actually built into VS Code, if all the language, I suspect, will eventually
move over to this.
So by having that, learning it for one tool, one language means it'll work for another language.
And there's some extra niceties to it as well in terms of updates and all that.
It's really snappy.
We'll probably, we are also going to rewrite all the code behind this and how it runs to
make it a bit more performant, more stable and all that.
So if you've had UI problems before with testing with VS Code for Python, please give
another try.
If you've had more discovery run problems, we are going to be working on that.
So that's coming up as well.
And then when that's all done, we'll be bugging Brian about this to make sure he gets the Brian
Okkens stamp of approval.
Yeah.
You know, I charge for that.
But no.
I thought that was just coming on the podcast was the fee.
No, I definitely, I tried this out and I like the changes.
And I'm excited to see the discovery changes as well.
Yeah.
Well, we reached out to the pytest team directly actually and asked them like, what would you
want us to do?
And they gave us some feedback of how they think it should be done and all that.
So we're hoping to incorporate that and use that as the basis of how we do pytest and then
UnitTest.
UnitTest is UnitTest.
Unfortunately, we had to break, we had to drop no support due to this, but honestly, it was
extremely low used anyway.
But we did have a lot of gum, but we still have UnitTest by Test support.
People shouldn't use it anyway.
You heard it from Brian.
Don't send me the hate mail.
But yeah, that's it.
Nice.
Those are all great ones.
All right.
I now have banners to separate my sections.
Oh, that's awesome.
Nice.
All right.
I'll be quick, but I do have a couple of things.
I just want to go back and sort of talk more about NerdFonts a little bit at nerdfonts.com.
People can check this out.
So it takes all these different things and puts them together like a bunch of font, awesome
fonts, dev icons, weather icons, and to a bunch of things.
And then the ones that I really like is the developer fonts, right?
So you go over and check these out.
A lot of them have font ligatures.
Brett, I don't know how you feel about font ligatures, but I'm actually a fan.
Although they freaked me out when I first saw them.
I'm definitely a fan.
I'm actually a fear of code.
Yeah, exactly.
Yep.
Although the new ligature support for infinite arrow length throws me a bit sometimes to the
point that I actually have turned it off and I use Cascadia code, the NerdFont version
for Starship in my terminal.
So I actually have a separate font for terminals in here.
Yeah.
Cascadia right there.
Cascadia Cove here.
It's Cascadia code on the official.
Gotcha.
So yeah, I use Cascadia for my terminal and then I use Fira code for my editing.
Although I'm contemplating actually buying a font called Mono Lisa, M-O-N-O-L-I-S-A and
using that.
But I haven't pulled the trigger yet.
I'm not against buying fonts if they're amazing.
Yeah.
Neither am I.
It's $100.
Armin Roenacker actually uses it.
That's partially how I came across it.
And someone else recommended it somewhere.
Kuchel Doss.
Yeah.
Paced on me tweeting about it, bought it and actually thanked me for using it.
So multiple people I know use it and actually appreciate it.
Yeah.
And it does have ligature support.
Good.
Yeah.
All right.
So one more shell thing.
So here is my power, my Microsoft terminal running Oh My Posh on my computer.
Look how dreadful that looks, right?
That's because I, that's because I'm not using nerd fonts.
If people are just listening, there's just tons of squares where there should be, where there
should be symbols and stuff.
And it says like, you know, username, square, square, folder name, square, square, get information.
But if you go and install the nerd fonts, pretty much any of them, the terminal or Oh My Posh,
actually, I guess is what it is, is, is tested against all the nerd fonts to work.
So if you install that, then you end up with beautiful terminal, right?
So definitely something nice to look into.
If you're just a, yeah, just use whatever mono thing is built in.
Yeah.
The nerd fonts are cool.
All right.
Let's see what's next.
Oh, did a article interview.
This company in Russia interviewed me and people are interested.
I want to give a quick shout out to that.
It was kind of fun to talk about some of the history of the podcast and stuff over there.
More shell Henry Schreiner third said, shared with us, here's my setup process for setting
up a new Mac.
And there's all these cool scripts and brew setups and all sorts of things,
including all the fish shell and Vim setups that you might need.
So if you want to follow up, we talked a little bit about that last time.
People can follow up with that.
I'll also say one convenient thing about committing all of your dot files, at least on GitHub is
if you use code spaces, GitHub, and you check a box, code spaces will automatically clone your
dot files repo and load them up into your code spaces.
Ooh, that's nice.
Yeah.
That's very nice.
And so I've actually published my dot files and done somewhat of a similar thing.
The other nice thing is obviously when your machine, I don't know if I ever told the story
in this podcast, but when your laptop accidentally gets grabbed by someone else and ends up in
Dubai and it gets shipped to you to a core dev sprint in London later and you feel the need
to wipe it for security purposes.
It's very convenient to have all your stuff in the cloud and have your dot files in a repo.
So it's just a clone run and you're done.
Yeah.
I would want to wipe it too.
Someone had physical possession of your laptop for a while.
Yeah.
All right.
A couple other things, Brian.
Last time I said I was using the editor to just jump between projects and stuff.
And one thing I didn't point out is like I'm on the terminal all the time as well, but I basically,
everything that I have some kind of terminal command for is I've almost entirely set up some
kind of bash alias.
So that actually uses the specific virtual environment as part of the command in the alias.
So it doesn't matter what I have activated or where I am or anything like that.
So anyway, just a quick follow up on that.
Cool.
All right.
Well, I think that's it for extras.
Do you have a separator for our joke also?
I have a laughs.
I have a separator for our laughs.
Yes, of course.
Nice.
I hope this is not as funny as the joke, but you all, you all will be the judge.
Okay.
All right.
So this is going back to a solid, solid place.
Geek and poke over at geek dash and dash poke.com.
This one is called the last 5%.
And Brett, your comment was perfect about setting up a new computer or reinstalling everything.
Right.
So this is the last 5%.
I know where this is going.
Or corporate IT made easy.
Make sure that the new developers, notebooks or computers aren't only 95%
provisioned.
So there's a senior woman developer helping a new one who can't seem to compile the project
or run it or something that says, I had the same problem, but I barely remember somewhere
in a wiki or on a file server, there was a certificate or something like that.
And I had to copy it to some folder on my machine.
And it's just entitled the last 5%.
It's like anytime someone onboards onto your team right at work.
Yes, exactly.
Oh yeah.
Go read with the last person five years ago or two years ago or how often you get a new
person come on.
Yeah.
Did it.
And by the way, the processes have all changed.
So yeah, chances of it does not work.
Yeah.
Just scroll back two years in Slack or Teams and find that message where we talked about
it.
Yeah.
You just have to hire people more often.
So they update the wiki at least every few years.
Yeah.
But the question then becomes, is it because your headcount's growing or because your turnover
is so high in this, you're just a bad manager in this, everyone just keeps quitting your
team.
Yeah.
I'd rather just have the stable number of people who, by the way, told me they were
going to be on the live stream and I didn't see Michael let any of the comments by.
So I wonder if they actually showed up.
So hello to my team if they showed up.
And Andrew and my wife, if she did.
Yeah, I hope they did.
And Chris May has a final parting thought for us.
This comic hits too close to home or work or work from home.
Yeah, definitely.
Definitely.
Cool.
Well, that's it.
So thanks a lot, Brett, for showing up.
Of course.
It was a joy to have you.
Thank you to my cat for taking a nap during the entire podcast and let's not distract
me in the middle of it.
We'll put it on our calendar to make sure to invite you about every 30 episodes then.
Perfect.
Yeah, it's great to have you here.
Yeah.
Thanks.
Thanks, everyone.
Thanks, Brian.
Thanks, 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.