Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 215, reported January 6th, one of my favorite dates, 21.
I'm Brian Okken.
I'm Michael Kennedy.
And we have Jason.
Hello.
Yeah, hey, Jason, nice to have you here. Jason McDonald.
Yeah, it's good to be here. Thank you for having me.
Yeah, thanks for joining us.
Oh, and Brian, I think he's going to cover something we haven't really covered much on the show, GUIs.
Oh, good.
Actually, to be honest, I know this is like a longstanding joke in the show for longtime listeners, but we actually haven't covered GUIs that much recently.
But there was a long stretch where we did.
Yeah, yeah. That was probably like a year ago.
Yeah, yeah.
I like my programming projects and my brownies to be GUI.
And fudge. Come on, fudge too.
And you like bad jokes, so you'll fit in nicely.
Oh, absolutely. No, if anyone likes puns, follow my Twitter. I post an original every Monday.
Nice. I heard that there's going to be a lot of exciting news for space in 2021.
So I kind of want to bring a little space and Python together.
That's good. Yeah.
Yeah.
So the first topic that I want to talk about is this video done by a woman in the UK who is a astrophysicist.
She goes by the name Dr. Becky, which is cool.
She has a fantastic YouTube channel.
She's also a Python developer and she works in cosmology, which is pretty cool.
And she did this video that I'd just like to highlight for people who maybe are coming into Python, not from the, hey, I'm going to create a microservice set of APIs talking to Docker, but more from the, hey, I do some kind of science or data science or something like that.
And the video is called the five ways that I use code as an astrophysicist.
Cool.
Huh?
Yeah.
So she basically lays out the idea of as a modern day scientist, you can barely do your job if you're not doing some sort of programming.
And of course, one of the best languages, technologies for programming these days is Python in the data science space, right?
Right.
Surprise.
Yeah.
No big surprise there since 2012, I would say.
And so the, she covers five different things with examples of each.
So I thought that was just a nice way for people who are either getting into Python from a science side, or maybe they're teachers and they want people ask them, why should I not just use MATLAB or some other custom tool?
Like, let me show you.
So here's some really cool examples of real astronomy being done with Python, but it's also super accessible to even like middle schoolers, I would say.
And number one is image processing of galaxies from telescopes.
So you can do things like noise removal.
So it turns out that when you're taking pictures of galaxies, even if there's no actual background light or disturbances, just the basic disturbance in the actual sensors themselves will put little marks and imperfections in the images.
So using Python to go through and clean those up makes it much easier to get started.
And the size of these pictures and the amount of data coming in from some of these new telescopes is stunningly large.
It's cool.
Yeah.
For sure.
Another one is data analysis.
So if you're trying to find the brightness of some part of an image, say, maybe you're looking for a transit of an exoplanet, right?
You want to constantly monitor the brightness of a star.
Or in her case, what she's studying, it just blows my mind.
She's studying galaxies.
Like when you see pictures of stars and you're zooming in, you're like, oh, that's not a star.
That's a galaxy.
It's just like, you know, like I still can't really get my mind around that.
But she talks about one of her data sets that has 600,000 rows of like brightness of galaxies.
So 600,000 galaxies, they all have information about that they're comparing.
So that's pretty awesome, right?
Yep.
Model fitting.
There's an example about theory that most galaxies have a supermassive black hole in the middle.
There's also this idea that possibly the size of the black hole and the size of the galaxy, these things kind of grow in mass together.
So she has all this data.
She's like, well, let's do some statistical fits of black hole size and galaxy size.
Also, the color of galaxies can indicate the relative speed or rate of star formation.
And the age.
Exactly.
Yeah.
All tied together.
And so she's using Python for that.
Finally, data visualization, you know, pretty straightforward, but in drawing graphs and pictures.
And the last part that was my favorite part is simulation.
So there's two really cool examples.
What happens if a star gets too close to a black hole and gets, she said, spaghetti-ified?
That's cool.
And the other one is examples of galaxies colliding, which is just, again, mind-blowing.
But really cool computational examples of all that.
So I wanted to highlight this video because it's super accessible, but it's also really neat to show concrete examples of real science being done with Python.
Yeah, I thought it was cool when she was talking to her colleague about building the simulations of the universe.
You know, you have a simulation of the universe.
Where do you start on that?
It's like, we think we have project blocking.
You know, it's like you start on a project.
It's like, yeah, I'm just going to build a tool.
Where do I begin?
It's like, I'm going to build a simulation of the entire universe.
Where do I start?
Exactly.
I'm going to simulate gravity at a galactic scale.
Let's just do that.
Yeah.
Awesome.
So if people are out there and they're interested in this kind of stuff, yeah.
This is all in one video?
Yeah.
This is all in one video.
Yeah.
Robert says star or galaxy.
It's big.
Yeah.
They're both huge, but obviously, man.
It's just like, I can't get my head around like galaxy-sized stuff.
It's so insane.
Star is a primitive type in the universe.
And then a galaxy is a collection.
That's what I just immediately go to right there.
Yeah.
Exactly.
Yeah.
So Brian, it's like a 15 minute video that half of it is the stuff that I talked about.
Then half is what Jason touched on.
She actually interviews one of her colleagues who basically does the more, the simulation side
of programming.
That's pretty cool.
Yeah.
I'll have to check that out.
Yeah.
It's definitely worth it.
Yeah.
I enjoyed it.
I don't do very much data science actually at all.
And so it's like, you know, understanding, seeing data science stuff is always interesting because
I, but most of my work is in like application development.
I don't usually work with a lot of data.
So it's the, that side of it explained in this really cool, relevant way.
And said, I was like, well, the statistics is a number of people, you know, who, you know,
buy, you know, cheese every weekend that the supermarket is not interested galaxies.
Exactly.
Getting better click through rates on your ads is not, not super compelling, but I think
it's really valuable to see alternate perspectives, right?
We all get into our own little world of like, this is what programming is.
This is what Python is for.
And then, you know, it's, it's bigger.
I want to talk about NumPy a little bit.
All right.
Tell us about it.
Well, I've, I've, I actually, I've used NumPy off and on a lot.
And it's definitely a staple scientific use of machine learning and sorts of stuff, but,
but I'm starting to use it more.
And I've realized, I realized that I, I had the wrong mental model.
So I like think of arrays kind of just like lists, but different.
And so I came across this article.
It's a couple of years old, but it's a visual intro to NumPy and data represent.
And to me, it really helps a lot, like to, to help me understand what you can do with
it and just have a good mental picture of what, what the arrays are in NumPy.
So it talks about arrays, matrices, and, and, and, and D arrays, which are in dimensional,
but like, for instance, I'm even just creating an array.
I knew how to create an array.
I mean, you just kind of initialize it with a list and you get an array, but I didn't know
you could do like, just say I want a list of ones or a list of zeros.
Or an array of ones or just a random array pre-filled with random numbers.
That's pretty.
And then he talks about, you know, arithmetic you can do with them and slicing and stuff.
You know, Brian, like when we talk about Pythonic code all the time, like, oh, you could write
code in this way where you kind of hack a numerical for loop, but you should do this other way.
And that would be more Pythonic.
I suspect there's also a.
A NumPy way.
A NumPy way, right?
Yeah.
Sort of like filling up stuff.
You're like, oh, you should just do ones on this one.
And then then, you know, you always like there's a lot of cool other ways of sort of
conceptualizing things.
Right.
Yeah.
Well, and it's worth remembering.
You know, I've said this quite a few times.
Not here, obviously.
But I regularly like to remind people abstractions are there to save us typing, never to save us
thinking.
It's like it helps to have that mental model, as you put it, Brian, you know, straight.
Because if your mental model is wrong, it can really wind up.
Well, you're prone to both cargo cult programming.
Well, I do it this way because it's the way I was taught.
Or trying to, you know, ill fit a pattern that's familiar to, you know, the wrong sort of problem
and you don't realize what it is you're really working with.
So understanding what's happening under the hood, even if, you know, you don't know all
the technical details of the implementation.
So understanding how it's doing things is important to, you know, choosing the right job.
Idiomatic patterns always.
Yeah, yeah.
And you'll hear stuff like, oh, well, Python is slow.
It's like, well, because you're doing it wrong.
Don't do it that way.
For example, use something like NumPy, right?
And like, for instance, one of the things I really loved about this article was the explanation
of dot product because I've heard this before.
I've never had to use a dot product, but it like somebody described it to me several times
and I'm like, yeah, okay, weird.
But then like the visual representation of it, I like just stared at it and read it for like,
you know, 30 seconds.
Oh, that's easy.
Now I get it.
And I'll have it forever now because of that sunk in there.
Pretty good.
Yeah, that's awesome.
One of the reasons why I went to it, I have this problem is that I have like large arrays,
but they're not like huge.
They're like in the thousands, say, of numbers.
And I need to make sure that one array is like comparing to another.
I know equal works, but I wanted to compare item by item to make sure every element is less
than the other element in the other array, less than or equal.
I didn't know how to do that.
And I'm like, I think NumPy would probably do that easy.
Can you do one NumPy array less than the other?
Yeah.
So if you say less than, it compares it element by element and it gives you a list of true
or false.
And then you can do all.
Yeah.
Do an all on it.
Yeah.
Just say all of these two arrays less than or equal to each other.
And I get exactly what I want.
They're very expressive, simple line of code.
Yeah.
It's that kind of stuff I was thinking of when I was talking about like the NumPy, NumPy
way or whatever.
Idiomatic NumPy.
Thank you.
It's like, that's like one or two lines and it's really fast.
Whereas you could loop over each item individually and it not only is more code, but it's also
slower.
Yeah.
Well, and also I like, I also have to, I like that there's the intermediate step of that.
There's gives me a list of true and false too, because I also on the debugging side,
I need to be able to like wrap this in something and pick like, say the first five elements
that are not matching.
I mean, I don't want, if I, if, if it, if it's false, the whole statement's false.
I don't want to like just say, you know, list all the thousands that are wrong, but I, I want
to be able to like list a few to say, at least these are not in the right.
Yeah.
It's good.
I'm going to try out NumPy now.
Hey, I now have a reason to try it out.
Exactly.
Like, why am I not using this in certain situations?
Magnus, the live stream says, two dimensions is okay.
Three is hard, but in that, then my mind blows.
Yeah.
I actually did a bunch of math research and four dimensional stuff, two dimensional, but
complex numbers.
So four dimensional sort of, and yeah, it's just, it's just hard.
Well, what one, one of my weird nacks as a programmer is I actually can think in six
dimensions.
It's it's, I mentioned before the podcast, I had a head injury a few years ago.
So I'm a minor traumatic savant.
I can think in six dimension.
And the best way I can explain it, if you're trying to do it without having a really bizarre brain
like mine is think of, think of the fourth dimension as a timeline.
And for each timeline you have, you have space represented as a cube, but then you have this
row of cubes, which represents the timeline.
It becomes a lot easier to think of four dimensional race when you think of it in that fashion.
Yeah.
And the way that we did it, we actually had animations of that three dimension thing and
the animations were moving through that, that bit.
Yeah.
But still it's, it's, it's no easy, no easy thing.
Yeah.
It's easier when you're an animator to wrap your head around 4d than if you're just a, you
know, an ordinary run of the mill programmer like most of us.
Brian, would you say that that's a gooey type of solution?
Uh, no.
Maybe you could do something with cute.
Yeah.
Okay.
Oh yeah.
I don't know.
Yeah.
Jason.
Yeah.
Who knows?
It's possible.
So, that's our next topic.
Take it.
Grab it, Jason.
Yeah.
Well, okay.
Well, I, I, so I was really excited to discover the cute six just released on December
8th.
So, cute.
Yeah.
It is officially pronounced cute.
Although it's much, it's very debatable.
People like, Oh, it's cutie.
It's cute.
Come on.
Yeah, exactly.
Anyway, whatever you're going to call it, it just released.
Um, and this includes the Python binding.
So, pie side six, Shabokan six, which is the, so pie side two was cutie five,
as if that made sense.
Pie side six is, is cute.
T six, cute sexy.
Now I'm doing it.
Anyway, so that just released.
Um, and you also have the pie cute T six, if you prefer, Riverbanks version, but in
whatever case, you're going to wind up with, with all the, all the cute six features.
Um, I think the, the coolest thing here is if you're doing, if you're doing like,
you know, really fancy sort of, graphics is that, previously, cute five and prior
had this hard dependency on open GL and they've actually put in a, what they call the rendering
hardware interface.
So it's an abstraction layer into, into cute.
So now, it can natively support whatever the 3d graphics driver is on that device, whether
it's direct ax, bulk in metal, whatever, whatever you want it to work with, but uses the native
by default.
You could, you could tell it to use whatever, whatever you want.
Um, that is so cool.
Yeah.
Um, and there's a bunch of other optimizations and fixes to have in here.
I am really excited because I discovered, and this was actually introduced in five 15,
but they now support snake case for those of us who are like PEP 8 addicts who really
hate the fact that cute kind of seemed to force you to use the camel case.
You can use snake case.
There is a, there is a, a setting for it.
Um, you can also use properties instead of getters and setters as a cute X.
So you can just rely on properties and that is, it makes it a lot easier to write, you know,
idiomatic Python code that is cute, which is fun.
Well, it just feels wrong to write, you know, get with, set with all those things.
They also have this cool thing called property binding where you can actually link those together
now too, is like you can link the width and the height.
So when you change the width, height automatically changes.
Nice.
Yeah.
I really want to build some stuff with cute.
I've, I've got a few app ideas in mind.
What I don't have is time.
Sadly.
Can you help me with that?
Jason, can you tell me to have more time in my life?
I, I, I, I know I have a reputation as a time Lord, but unfortunately I can't control the
stream of flow of time there.
If I find my TARDIS, I'll pick you up and, and, and drop you off, you know, 10 years ago
and you can relive those 10 years and do additional things.
Okay.
Yeah.
Nice.
That would be, yeah.
Yep.
Uh, let's see, actually a couple of questions from the live stream.
Magnus asks, any news about cute going mobile?
I actually am ashamed to admit.
I don't know.
I don't know either, but the, I think the bigger, more interesting question would, could PyQt stuff
like could, would, could, would you be able to write a Python cute application and make it
mobile?
Right.
I think that's where it gets really interesting.
Um, cause there's other, if you pick another language like C++, there's other options
you might be able to choose.
And then, maybe, you know, this one you're going to ask, are there any well-known Python
apps built with cute?
Oh yeah.
Yeah.
They're, I'm on the spot.
I'm trying to think of what mine.
It's not well known, but I built time card in cute.
If you look up, if you look up time card, it's just a time tracking, app that
I, that I built, but actually there's, there's, there's quite a lot built, built with cute.
Um, I didn't want to K in front of it.
If you're, if you're into KDE, the entire, the entire KDE stack is built on top of cute.
And there's actually quite a bit of it.
So, names are escaping me off the top of my head here, but, yeah, there's any,
anything in the KDE universe is, is cute.
And so you're either going to get C++ or Python.
Python is certainly a lot faster, right?
So, oh, filezilla apparently is built.
You know, one that I know that's written in it, for sure that I, it's like one of my
favorite apps actually is, Robo Mongo or Robo three T it got renamed to.
Um, I believe it's just C++ it's not Python cute, but that one's a really nice one
as well.
Actually, there's a huge long list.
I'll put it in the show notes over here, of a bunch of apps written as well.
So it's definitely a lot easier to write, write, something in KDE.
I've, I've used a lot of different UI toolkits and KDE's definitely one of the easiest.
Yeah.
The thing that I like about it is it looks like it belongs because so many apps you build with
these sort of cross platform things and it's just like, well, okay, well that's not how
the file dialogue is supposed to look.
You just know it's alien, but you're like, no, no, this looks, this looks like it belongs
here.
Well, and packaging is the other half of it because like I tried to build something with
Kivi and I love Kivi from a, from a development standpoint.
It's really cool.
From a packaging standpoint, it's like beating yourself to death of the wet trout.
So, and, and actually if you're going to do cross platform, then, actually,
GTK is horrible too, because it's really hard to get it to package on windows.
A lot of times it just works.
It just packages everywhere, which.
Yeah, that's great.
Nice.
All right.
Um, Brian, I think this episode is brought to everyone by us.
Wonderful.
Yeah.
So we are, we're doing a lot of work out there and as everyone probably knows, if you're
into testing, check out Brian's pytest book.
If you're looking to take a Python course, we are just about to pass 200 hours of Python courses
over at Talk Python training.
I'm working on a new course, how to build web apps, not web APIs, but web apps with FastAPI.
Super neat stuff.
So that's, that should be out in a week or two.
So anyway.
Yeah.
I'm also, I wanted to bring up that, there was kind of a spike in, pytest books.
Sales in last, last quarter of 2020 and hoping that like some screws in it, right?
Testing other teaching.
So yeah, that'd be super cool.
Yeah.
It's nice to see more, more, more, more stuff about stuff other than unit test.
I mean, unit test has its place, but I, when I wrote the chat, I've got a book coming out
in May and when I wrote the chapter on testing and one of my editors was like, thank you for
not forcing me to edit yet one more unit test chapter.
Nice.
What's your book on?
Oh, my book's called a dead simple Python.
It just, it, it introduces the language of Python, the idiomatic practices of Python
to people who are coming from another language.
So if you don't want to have to sit through yet one more explanation of what a variable
or a function is or a class is, you can pick this up and it dives straight into the, the,
the fine details of why idiomatic patterns are what they are in Python.
Nice.
That's yeah.
That's a good idea.
I, I, the courses or books that say, we're going to pretend, you know, nothing about the
world and we're going to force you to go through everything from scratch every time that drives
me crazy.
You know, what else drives me crazy, Brian is, when my Python GC is doing stuff when
I know that it doesn't need to do stuff.
Yeah.
I like to not have to think about the garbage collect.
And you generally don't, right?
Like one of the things that genuinely surprises me is the fact that we don't really talk about
memory very much in Python.
It's like, Oh, okay.
I think it cleans itself up.
That's good.
Now what?
Let's go.
Let's go about stuff.
Right.
But if you dig into it, it's pretty interesting.
There's a lot of stuff around allocation we've covered before, but it's quite unique.
Um, but Python's also somewhat unique in the sense that it has like two modes.
So it has reference counting, which I would say 98% of all like memory management cleanup
stuff is in the reference counting side.
This is totally made up these numbers, but there's a little, there's, I would say maybe
even more like 99.5, unless you're building some kind of a certain kind of app, like with
interesting algorithms, most apps don't create cycles.
And the only reason we have garbage collection in addition to the reference counting is to
catch those cycles, right?
Um, you know, I've got a customer object.
I've got it out of a SQLAlchemy database.
It has a relationship over to the orders.
I go to the orders.
The orders have a link back to the customer.
Maybe like traversing that lazy loaded list has created a cycle and now I need the GC to save
me.
So the rule for when the garbage collector runs is you can ask it.
You can say, import the GC module and say GC dot get threshold or thresholds.
I can't remember a singular or plural on my screen.
If I would switch to a singular get threshold, it returns three numbers.
Uh, they're not the same units, which makes them really hard to understand.
The first number is how many allocations of collection objects.
So classes, dictionaries, lists, tuples, things that could contain other stuff.
So things that could potentially be participants in a cycle, like numbers and strings are not
even considered by the GC.
But how many allocations of collection types are there that exceed the reference counting
deallocation?
So if I had a list and I put a thousand classes, class objects in it by allocating and filling
it up, then I would hold on to a thousand and none of them would have been come become garbage.
So the first number that comes back is, well, how big is that number before we just run a
GC no matter what?
And the default is 700.
So my example there, if I create a list of a thousand objects, that's a GC that's going
to run.
It doesn't matter if there's cycles, there's no cycles.
It just doesn't matter.
Like I've made a thousand of them.
That's over 700.
So we're going to run a GC.
And then the rest are like, how much do you run?
Like a whole memory GC versus a local, a small, like recent object GC.
And what occurred to me is, you know, my website, there's a lot of pages that pull back thousands
of items and any website that uses the database and an ORM that pulls stuff back and hangs on
to it and not just like streams over the items, but puts them maybe in a list or something
temporarily.
Anytime you do that more with a thousand, you're going to have the GC run, right?
They're just looking for anything to throw away, basically.
Yeah.
But you know, you're still in the process of building the list of them.
I got to get 10,000.
Well, guess what?
That means you're going to have 14 GCs and you're just in the process of building the
list.
I'm like, that's kind of weird.
That, that, that seems excessive to me.
And then I went and looked at the site map on Talk Python training where we're pulling
back like thousands of transcripts and all sorts of stuff to generate all the pages on
there.
77.
There's 77 GCs to render the site map.
There's no cycles.
There's not one.
So I'm like, that's not good.
Well, let me think about that for a second.
So what I ended up doing was I said, well, what if I made the threshold 10,000?
Actually, I ended up on 50,000.
So only run the GC if you get more than 50,000 allocations without deallocation.
What was really interesting is doing that made my unit tests, which were including many,
many integration tests on Talk Python training run 10 to 12% faster.
Just setting that one line.
And it basically does not use more memory in my case.
Is that crazy?
Well, it makes sense.
Most issues of performance just come down to memory and how memory allocation is deallocation.
I spend almost all my time in C++, more time in C++ than I do in Python.
And we don't have a garbage collector over there.
So you have to do all this manually.
And doing it right.
You know how much work it is, right?
Yeah.
Yeah, exactly.
It's like doing it wrong is why stuff's slow.
People are like, well, Python's slower than C++.
So it has the potential.
People's has the potential to be faster than Python.
But it really depends on how you write that code.
Because well-written code is always going to run faster than poorly written code.
It doesn't matter what the two languages.
Yeah.
And I realized that in my world, in my type of application, I almost never create cycles.
But I often get back more than 700 class objects, which also have dictionaries potentially in the mix as they're allocating the converting, serializing into classes.
There's got to be a lot of places where that's happened.
So I just set this number to say, you know what?
Let's waste a little bit of memory.
And if there are cycles, we'll come back and get them later.
And because there's almost no cycles, there's almost no memory growth.
For example, so the server is running like eight worker processes, one of them.
And I made this change.
And I think over after running for a week without restarting any of the processes, it went from 1.89 gigs of memory usage to 1.91.
So like 220 megs.
I think it was 20 megs more memory usage.
And yet like 10% speed up by just changing like one call at startup.
It was insane.
Well, and think about what Dr. Becky's code is.
You know, like, you know, go back to the astrophysicist, you know, thing here, you know, with the sizes of data structures that she's doing or any data scientist who's listening, you know, they're usually dealing with 10,000, 100,000 million items.
You know, you combine this with all the stuff that we talked about with NumPy and with data processing.
And, you know, we talk about how long it takes to do some of these data regressions.
How much would this be?
Yeah, exactly.
So if that data is being done in Python and it's not just purely being pushed down into the C data science layer, then yeah, that's really interesting, I think.
Although I would caution at the same time that there's no such thing as a magic bullet.
So you have to understand why this is going to speed things up.
Well, I have to just copy and paste that line that my colleague has that he got from Michael Kennedy because it'll make the code faster.
No, you have to know why it's going to go faster.
It's an easy test.
Some cases it makes sense.
People can check it out.
I thought it was really, it just so surprised me.
I just walk along and I'm like, wait a minute, that must mean something weird is going on.
And then I put it on just on one of my pages.
Like, why would I do 77 GCs on a single page load?
That's crazy.
And so I just started exploring this and here we are.
So did you, whatever you're linking to, does it talk about how you can test how many garbage collections?
Let me see.
I'm linking to a Twitter thread and way deep down.
No, but there is a way to do it.
If you, if you go to the GC, you can say, I think it's set debug stats or something.
I'll, I'll look it up real quick while we're talking.
I'll throw it in at the end here.
But yeah, it's, there is a way to do it.
Actually, I got it right here.
Hold on.
Give me just a sec.
The way you do it is you say GC dot set underscore debug, and then you pass in numeration and the
value is GC debug stats.
Okay.
So that thing was just lighting up my, you know, when I turned that on, it would just light
up and just completely fill this, the terminal with the debug or, you know, GC, GC, GC, GC,
GC over and over and over when I hit the, that one page and then changing it, guess what?
Made it better.
Yeah.
Now we should probably be PC about the GC and call the garbage collector, the, the, the,
the, the programmatic sanitation engineer.
Right.
Well, it, it, it doesn't have, it doesn't, it doesn't take offense.
It's just there to help us out.
Brian is probably a pretty awesome library.
Honestly, the GC library.
Probably, but it's built in.
Yeah.
So I'm, you know, of course I'm susceptible to click on a listicle, but the.
Who isn't?
Come on.
Right.
But we don't cover them very much, but I really like this.
So this, this article is a top 10 Python libraries of 2020, but their criteria was interesting.
The criteria was, it has to be a library that was launched or popular.
It has to be well maintained as have maintenance changes since their launch date.
And it has to be just outright cool that you should check it out.
So I'm going to go through a handful of these.
They listed 10.
I don't know if all of them, since I'm, there's like four of them that are machine learning focused that I.
I think cool is relative.
Yeah.
But the first one, I, the first one was typer and I can't, I'm like, I'm, I'm really a fan of typer now.
Is it really just 2020?
And I went back and look.
It was released like, yeah, in December of 2019.
So Sebastian Ramirez is killing it for sure.
And then I looked in it.
I'm like, well, FastAPI, when did that come out?
Well, that was the previous December.
So, the end of 2018 released FastAPI and then typer a year later, he's just crushing it.
Yeah.
So yeah, nice.
Um, both a huge fan of both of those, a big fan of rich also.
So rich, actually just showed up this in last year in 2020.
Um, and rich is a beautiful, beautiful formatting in the terminal.
And yes, it's a beautiful, it's really great.
Let me use that.
That's glorious.
Um, I'm even using it even in applications where I just need these, the tables.
So if you need to print out a table in the command line, the, the tables, tables are kind of hard and there were like weird other, there were other table, specialized table libraries.
Um, but this one is great that you can, it works.
You don't have to specify the width that like comes up with the width on its own.
And then you, if you, you shrink the terminal to really narrow or wide, it'll word wrap correctly and stuff.
Um, and that's kind of incredible.
Uh, so even if, even just for tables, I would.
Yeah.
Which is awesome.
The third one is dear pie gooey.
I think we covered this.
Maybe we could.
I don't remember.
I mean, we did go on our gooey rant, so it feels like it should be.
Yeah.
So it's a, a, a gooey project.
Um, the, nice pictures though, at least.
Yeah.
I've been drooling over, I've been drooling over dear I'm gooey for a while.
I haven't, I haven't had an opportunity to use it yet, but I've been looking at it.
So.
Yeah.
So, the last few I want to highlight pretty errors looks neat.
I haven't tried that yet, but it's, it's a way to, yeah.
That is glorious as well.
Better tracebacks.
Um, so.
I mean, ideally you don't show errors to people, but if you're going to, let's make them at least
readable.
This is great.
And let's treat ourselves too.
You know, it's like, you know, we're going to have to read the, we're going to spend at
least half our life reading error messages.
Face it.
So let's at least make it readable.
Yeah.
And another quarter crying about the, what we just couldn't figure out.
And then the last two that I want to highlight is diagrams and scaling.
Um, diagrams is a library.
Look at that, picture.
Um, it's a way to do, it's intended for like, cloud architecture drawings.
Um, but the, it's written in, in Python.
You, you write these diagrams in Python.
Um, and so because they're text, you can check them in and with version control.
That's cool.
Um, which is nice.
I'd like to see these sorts of diagrams look more would be great for not just, you
know, network diagrams, other diagrams.
Flow charts would be great.
Uh, I still flow chart.
Yeah.
So the last one is scaling, which, is a, memory CPU and memory profiler in Python
that, handles multi-threading well and distinguishes between Python versus run for use.
Oh, that's, pretty cool.
Like definitely need to try this out.
Uh, I also like that you don't have to modify your code.
Yeah.
That's really cool.
Yeah, absolutely.
Yeah.
Those are cool.
Uh, there's a bunch of great ideas there.
And man, I really need to find a use for rich solution.
I'm going to source of a problem again, but Hey, I mean, I write a lot of like a little
terminal apps and stuff.
And I'm just like, you know, maybe you'll put a little color in here or something.
And just, you know, I just need to take the time and go, no, this is a UI that I should
pay more attention to.
Not just some random thing with text.
Yeah.
Well, we'll find this cool stuff.
It's like, I want to, I want to use, I feel the need to use this somewhere.
Well, I had a little, so I had a little application where it's just like I said, with the
tables and, and I'm like, I don't think it needs colors.
I'm just showing a table.
Um, but the default for rich is to show colors.
So, and you don't have to pick them.
It just, so the, like the, the heading and the lines between were like different colors
if you're on a color terminal.
And if you're not on a color terminal, it works anyway.
It just figures that out for you and lovely.
Love it.
Yeah.
That's awesome.
It's awesome.
It's very awesome.
Awesome.
Speaking of awesome.
So, PEP 518 rolled out a while back.
Uh, I was introducing this thing called a pie project.
Uh, T-O-M-L, I guess it's called a pie project.
Toml.
Uh, so the idea behind this was that it was going to be this, configuration file, you
know, one configuration file to rule them all.
And of course, we're, by then we like things to be simple.
Well, ironically, this turned into a really political thing, which I'm still trying to
wrap my head around.
So basically the, the, the nice thing about this repository is, is, is, is keeping track
of all the projects that have adopted pie project.
Toml, either optionally or mandatory, for configurations.
So instead of having to have, you know, a dozen configuration files in your project for all
these different tools, you can just use this one.
And so it's got this big list.
What I find interesting is this part down here at the bottom.
Uh, if you go down to, yeah, just scroll just slightly here, just slightly, just
a little bit up.
Um, that's going to sound weird on the podcast.
Anyway, so if you're going to, so these are projects that are quote unquote, discussing
the use of pie project Toml.
But if you actually look at these, it's kind of odd.
Um, you know, the, the big sticking points, cause these are the projects that are like stopping
people from really just going all in on, on pie project Toml.
And there's even some, you know, talk about circular, you know, dependencies or somewhere
like, well, I'll do it when they do it.
And they're like, well, I will do it when they do it.
Um, which makes you wonder if it's a serious excuse.
Uh, so my pie is the weirdest.
We'd have an awesome himself said, well, it doesn't solve anything.
You know, someone said, can we just add this, please just add it.
It's easy here.
Here's the PR.
Somebody even did the PR.
He's like, nah, it doesn't solve anything.
And he closed, he closed it.
It's like, it does solve something.
It's one less file I have to deal with.
That is a solution.
Um, Blake eight, they have a couple of concrete objections.
One is the fact we don't have the standard Toml parser in the Python, standard library.
So that could be, you know, that could be a problem.
Interesting.
Um, you're adding another dependency to just support having this format.
Exactly.
Yeah.
Um, but then again, it's, if it's a common dependency with a bunch of other, you know,
tools that are already in use and it almost doesn't matter.
Uh, pip, someone said, I don't understand this.
Pip to change its behavior.
So mere presence of the file doesn't change functionality.
I can't wrap my head around what he's referring to there.
Maybe a, but the stupid thing is someone already did flake nine, which is a, which an exact fork
of flake eight that just adds high project Toml.
So it's like, it's done.
They just have to merge it.
But it's, and actually the same thing happened with a bandit.
Uh, someone actually implemented in 2019.
The PR has been sitting there untouched since 2019.
So over a year's gone by it's there and bandit is not picking it up.
They're just, they're silent.
Read the docs is saying it's too much work.
Um, like it's a lot of work for us to have the multiple, pie oxidizer shockingly hasn't
even said anything.
It's 2019.
They're, they're like the, they're like the new trendy, like the trend setting packaging
thing.
And they haven't been saying anything about this.
This.
So I, I'm trying to figure out why it is that this is so controversial because it seems
so obvious.
You have one file to store all of the settings for all the different tools.
Um, and yet everybody seems to want to do their own thing with this.
Well, I know that, you know, pip and poetry and flit and some of these other tools that
suggest a workflow.
I feel like I hear this file format being used along with those and, you know, telling people
we're going to have a different way for you to like work with your projects and manage
dependencies and stuff.
And you know that I think that's part of the source of, of this.
And I don't know if it's just necessarily all mixed together.
Brian, what do you think?
You know more about this than I do.
Um, I think a lot of projects are on the side of like, for instance, coverage was,
was it, I don't know where they are on the list.
That they adopted.
Did they adopt it?
Okay.
Yeah.
Well, coverage had this thing in, in other tools we're talking about, you know, there's
no Toml parser and they, they didn't have any other dependencies.
So they didn't want to add a third party dependency, just for this.
And, and if they're just using it for packaging, however, or, or settings or something.
But, the, so I do, I do think we will see a lot.
I don't think it's a reasonable argument because, there's, there's reasons why, you know,
the same thing, reason why request is, because there's making changes.
But I do think that the, like the format of Toml basic format enough to get a by project,
um, isn't going to change much.
Uh, so I think enough of a project, Toml parser to handle by project.
Um, that's, I think we need one of the, something like that in the, in, in, in built into Python.
Yeah.
Especially since we have, we have PEP 5.18.
So like we have some, we have some standard already.
Yeah.
So I think we'll see a big, I would like to see at least, even if it isn't the mainstream
one, if we have, if the, if most projects that are okay with the third party use something
else, for a Toml parser, but there's some built in stripped down version in the, the standard
library.
I think that that's, I think that's great.
Yeah.
I, I, I see you could solve that problem by just bendering it.
Just like, here's the two files that make up the parser.
We're just going to make it part of this package.
So now we're good to go.
I don't know.
Sounds good.
Well, I think that's it for all of our items.
Um, Brian, you got anything I actually want to share with folks?
Yeah.
I'm, it's my birthday.
Yay.
Happy birthday.
Happy birthday, man.
So I'm looking good for, I was gonna say you're looking good for 28 brother.
So I'm 51.
And, I heard today that that's just one.
I'm just shy of a full deck.
Well, yeah, I've, I've never been accused of playing with a full deck myself.
Um, but don't, I will say, don't let anyone tell you that you're old because, it says
in the first chapter, chapter of Genesis, thou, and then God said, man's year shall be limited
to 120.
Half of 120 is 60.
So what is biblical that 60 is middle age.
You're not even middle aged.
You've got a way to go.
I mean, it's the Bible.
I keep telling everybody that I don't look at day over 73.
Oh, you're a good man.
Uh, a couple of happy birthdays.
And also you're going to ask if you're still a fan of flit.
Yeah.
I love flit, especially since they adopted the, source source directory.
Yeah, that's right.
That's awesome.
Uh, that's, that's saved my life.
Jason, anything extra that you want to throw out there?
I mean, maybe people have a place they could get notified about your upcoming book or
something like that.
Yeah.
You know, following me on Twitter is probably the best way to do that.
I'm code mouse nine to one Twitter.
Um, and then, actually I follow no starts press too.
I mean, no starts press is awesome to begin with.
That's where you're doing the book.
Yeah, exactly.
You're there.
They're my publisher.
No search.
I don't think they ever put out a bad book.
I love that publisher.
So, I was, I, I can, you can actually, you can ask my mother when I got, when I got,
when my book contract got accepted, I actually screamed, very high pitched.
That's awesome.
Yeah.
Follow, follow those starts press for updates on, on that.
And all their other awesome, they got some other incredible books coming up too.
So I'll go ahead and ask her.
So what's your mom's Twitter handle?
Oh, my mom's Twitter handle.
Oh, she doesn't have a Twitter handle actually.
So I'll have to put you in touch directly.
I think.
Awesome.
Well, cool.
Thanks for being here again.
So I have a couple of items to throw out here.
This almost, Brian, this almost could have been an extra, extra, extra, extra, extra, extra,
extra here all about it, but they're real short.
So I didn't do that.
Django 315 is released.
Django 3.
Didn't we just, just go to Django 2 or something?
That's, I mean, that's good.
That's really good to hear.
So awesome.
That Python 310 alpha 4 is available for testing.
Yeah, the new parser is going to be in that one, which is going to be.
Oh, that's the peg parser that Gita's been working on?
Yeah, that's going to be, that's going to, that's going to revolutionize the language eventually.
Yeah.
It'll definitely make it possible to do more.
And in releases, SciPy 1.6.0 was released.
I learned about a cool project.
So we talked about like avoiding Excel for the Python data science stack, right?
Like just stop doing Excel.
There's all these weird errors.
Like the, the organization that defines or governs how you can name genes has come up
with rules for names you can't use.
And the reason they can't be used is they'll be parsed incorrectly into other data types
by Excel, for example.
So there's a lot of issues you might run into with Excel and, and that's all good.
But there's this project called PyXLL and this is actually a paid product.
They're not sponsoring the show.
I just think it's kind of neat.
So spreading the word.
But anyway, if it's interesting for you, what you can do is it's a plugin for Excel that
will embed Jupyter into Excel and allow you to write functions and macros in Excel in Python.
So basically it almost adds the program, Python, the programming language to Excel, which is
good.
Yeah.
It's better than VBA.
Let's see.
No, I started in VBA.
Tell me about it.
Anything's better than VBA.
So someone on Twitter asked if PyCharm works okay on my Apple Mac Mini M1.
And they, PyCharm and JetBrains in general, just released a whole bunch of their tooling
with different installs for the Apple Silicon native versions.
And so I've got a cool little video that I'm going to link to in the show notes.
And it's just like a five second video of here.
I open up PyCharm and you basically from the time you click on open project till the project's
open, if you've opened a project before.
So that caveat.
But at that point, if you click on it, you cannot perceive click.
Like by the time you're letting up the mouse, the whole the project is loaded and ready to
work on.
It's like it's insane.
I will I will consider picking up PyCharm again when they add live share into it.
They have they're they're working on it.
It's something called code with me.
Yeah.
So I have not tried it.
I have no one to code with.
I'm sorry, but email me later.
We'll set something.
Yeah, exactly.
We'll go together.
So also, since I got my M1 like three, four weeks ago, whatever, I've only used used this
for all my Python work.
And apparently it's it's still going strong.
I even had to send in my MacBook Pro because it had starting started shut.
The battery was so bad.
It would shut down at 75 percent.
Like, you know, when it gets too low, it'll shut down.
And as the battery gets bad, maybe it shuts down at 10 percent instead of zero.
If I'm doing video work, it'll actually shut down at 75 percent.
So I plug it back in.
So so it's all in one until that comes back.
Well, I'm I'm still on my system.
76 Linux.
I can't speak to Apple.
I do love my system.
That's cool.
I just I think this whole like new arm architecture stuff that they're doing, it's going to be
interesting.
You know, I think Microsoft's following suit or trying in parallel with them.
It just felt to me like Intel and AMD.
That's just the way it was going to be forever.
And it's not necessarily the case.
I don't I don't have a problem with I don't have a problem with competition.
What I have a problem with is software companies making their own, you know, architecture and
it only works on their architecture.
That's what you move towards.
And then you wind up with a totally fragmented industry.
I think that's yeah, that's not going to be great.
Don't do it, Microsoft.
It's not worth it.
Awesome.
All right.
Well, that that's my extra, extra, extra, extra, extra, extra, right?
Nice.
I want to get an M1.
I'd like to get a mini.
Yeah, the mini is fantastic.
I really, really like it.
It's not even funny.
It's not even it's not even a joke.
I'm being serious, but we do need a joke.
Yes.
Oh, I have a joke.
All right.
Yeah.
You got the joke this week.
I actually do have the joke this week.
Yeah.
And it was a why, why did the programmer always refuse to check his code into the repository?
Why?
He was afraid to commit.
Yeah.
If you want to, if you want a regular dose of my, of my, that is one of my originals.
If you want a regular dose of my absolutely horrific puns, you can follow me on Twitter,
your own peril.
I posted every, every Monday.
I've got a new one.
So awesome.
Nice.
Yeah.
Thanks for being on the show.
Yeah, it was fun.
Yeah.
Thanks. See y'all. Thanks everyone out there on the live stream and thanks everyone who listened.