Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 423, recorded March 10, 2025.
And I am Brian Okken.
And I'm Michael Kennedy.
And thanks everybody again for supporting us through training courses at pythontest.com and at talkpython.fm.
So lots of great courses there.
And our Patreon supporters, of course.
Thank you.
And for people that'd like to get a hold of us, we'd love to get here.
If you've got a suggestion for the show or have a question about it or correction, you can reach the show at pythontest.fm.
And there's also in the show notes, there's links to our Blue Sky and Mastodon links.
And you can also sign up at pythontest.fm.
You can go to live to see when the next live show is going to go on.
Or you can sign up for the newsletter and get everything we talked about sent directly to your inbox, which is cool.
Yeah.
And they can crush that bell on YouTube, too.
Oh, yeah.
Subscribing on YouTube.
That would be great.
Yeah.
So speaking of subscribing or scribing, what are we talking about first?
Well, how's your SQL game, Brian?
A little weak, actually.
Yeah.
Mine's a little weak as well.
It's atrophied a bit.
You know, I've got its table and I got another table and I want to do a join on that table.
And then maybe I want to use an aggregation function.
How do I do that again?
Well, there's a lot of cool tools and libraries around there to solve that.
For example, you can use SQLAlchemy or SQL Model and then you just talk in Python terms and classes and stuff.
And then somehow magically deep down when it docs the database, it'll do that kind of stuff for you.
You still kind of got to know the queries.
So it's not perfect, but it doesn't perfectly solve it for you.
But I want to introduce everyone to a new tool called PySQL Scribe.
And the idea here is similar to that, except for you use it for real SQL.
So, for example, if you want to know how to do one of these joins or you want to get some support doing that and you're not already using SQLAlchemy, it's not reasonable to say, well, let me re-implement everything I'm doing in SQLAlchemy.
So I can ask it a question to get a simple SQL statement that I just want to use outside of SQLAlchemy.
Right.
Okay.
So that's kind of what this is.
So you can take this thing and you teach it about different things, which database you're using.
Because even though SQL is a general query language, it does not generally work against any database.
Right.
Each database has its own dialect.
Right.
So the way you say, for example, specify parameters for MySQL is different than the way you do for Microsoft SQL Server.
And while they are similar, they're not the same.
So what you do is with this is you say, I'm working with this particular database.
And then you say, you give it information about your tables.
Right.
So here's a table name.
Here it's columns and so on.
And then you can just say, create a little builder and say, builder.select this column, that column from this table build.
And what it builds is it outputs a select or a SQL statement of some sort.
So in this case, select the various columns from the table.
Cool, right?
Yeah.
But you can do more than that.
You can, let's see, you can create your own class by creating a class that is decorated.
And then it will know that, you know, basically you can create either your own queries or you can create your own dialect.
So for example, here's a MySQL table.
So you don't have to specify the dialect because it's a MySQL table.
It knows the dialect.
And if you go further down here, you can see it understands more complicated things like join.
Like first I want to select this thing.
Then I want to join on that table on this thing and then build and it'll write the join statement for you.
Just pretty neat.
You can also do, like I said, functions.
Let me scroll down a tad to that.
So for example, if you wanted to write something that did, you know, uppercase in the select statement or max of some value out of there, right?
And a group by type of thing.
So you could just go and write that in terms of the SQL scribe, the PySQL scribe, and then it will actually generate all that for you.
So that's pretty neat.
And finally, you can combine them if you have one builder inside of another builder type of thing.
And it'll join.
It's a more complicated thing.
So the more you do with the SQL, you know, probably the more helpful this is.
If you're just doing real simple select and where statements, maybe not that helpful.
But that is my first item.
I think it might help some folks.
Yeah.
I guess you're probably the wrong person to ask, but I was just curious about the use case.
So like, for instance, I guess if you had an application that the user could select which database they're connecting to, and then you could create the different features based on that and just, I guess.
Yeah.
I don't think it's operational in a sense.
I think it's more, because if you're doing it operationally, just use an ORM.
Okay.
Because it does that, right?
I think it's, I would like this thing to help me write the queries because I'm, sometimes I forget.
Like if you're doing data science, you might be connecting to different data sources.
You might be going, oh, I want to ask this question, but oh, that's probably a join.
How do I do that again?
And so on.
Okay.
Yeah.
I was actually, because I was just thinking about putting an application together and I was like, it's pretty lightweight.
I don't really want an ORM.
So I was going to do raw SQL, but then I.
Yeah.
So what you might do is you might run this one, you might give it your specification, run it one time, and then hard code the responses as parameterized queries in your Python code.
And don't revisit it again until you might need to change the query in a sufficiently complicated way that you can't just like type another column or something.
You know what I mean?
Yeah.
Okay.
Yeah.
Interesting.
Cool.
One addition that I added here, added sort of an idea I added, I guess, is I, I just, as getting ready for this, I'd thought, you know what?
This is like typing in the names of the columns and the available tables seems like that should be automated.
So I don't know if Daniel, the guy who created it, is any, has any interest in this, but I said, Hey, wouldn't it be cool if you could give it a create script?
You know, you can go to your database and say, create an entire create script for the entire database with all the columns and the relationships and indexes and all that kind of stuff.
If you could just point it at that, and then it could generate all the tables as an thing you pull in by table name.
And then it just automatically knows the structure of everything of all your tables.
Right. So I said, Hey, maybe you can make it pars a SQL data, create a data definition language, create script sort of thing.
So I gave a little example of something that you might be able to do there.
So who knows if that comes around, if he likes the idea or not, but I think there's some cool ways to expand this.
Cool. Nice.
Yeah. All right.
Over to you.
Well, I'm going to add, I'm going to look at a map of Python.
So I ran across this article.
It's kind of cool.
So the idea is around looking at PyPI has got tons of packages there, but there's a lot of dependencies between them.
And visualizing kind of how, what would it look like if we visualize all of this?
So there's a couple of visualizations here.
And I actually got a little lost in trying to interpret this, but it's pretty dots.
But you can, you know, you can zoom in a little bit on, on some of these, the scroll wheel works on this to zoom in.
And I'm not, I couldn't figure out what the spacing meant, but anyway, I, the, why I'm okay.
So since I don't really know what this is doing, why am I covering it?
One of the things I thought was great was it was just sort of a discussion around dealing with large data.
And, you know, the, the big, the data set of PyPI is a pretty big data set.
There is big, there's copies in BigQuery so that you can query that instead of, instead of querying PyPI all the time, which is something that I've done with the Python or pytest plugin list as well.
But the, it's, but then there's some discussions.
Well, there's, there's some junk in there.
There's, there's, there's packages that don't have like source code listed or there's, you know, other things that make them really not,
they're not really open source.
They're just utilizing PyPI or something.
Sometimes companies do that.
Anyway, so there's some discussion around filtering that, which is an interesting discussion.
And then a little bit of discussion about deciding what graphing mechanism to use and, and how to visualize it.
So I, I just really appreciated the discussion.
So if you're into visualizing data, I think this might be an interesting thing.
Plus it's just a really fun visualization.
And then at the end, there's a link that said, oh yeah, by the way, there's a better UI for this.
I'm like, oh, okay.
Let's take a look at that.
And this is just cool.
It's the spaceship, I don't know, spaceship operating manual.
Wow.
So this is like the galaxy of Python.
And let's see if we have W and S for forward and back.
Yeah.
The first one was kind of like, I don't know, old school maps.
It was really cool.
But old school maps and like, you know, the days of like sailing and exploring.
And this is like Hubble.
Yeah.
So look, look at this.
We move forward and back.
Oops.
Let's see.
W.
See if we can get this to go.
This is great.
So for people listening, I'm zooming in and it's like you're going through a star field.
And these are, these are Python dependencies that we're going around in.
It's just, it's, it's a fun, I don't know, video game, video visualization thing.
So.
I'm going to play with, I haven't seen this before.
I'm going to play this later.
Thanks.
You're just wasting like a half an hour of my day.
You're welcome.
Yeah.
And so this, this is, this is all on, on GitHub also.
So if you want to take a look at how he did the filtering and I'm, I'm linked to this because
I'm going to take a look at how he's doing.
So even a reproduction guide said there's the SQL query.
So if you, if you'd like to do some big query stuff for around PyPI, there's an example.
There's a process Jason.
So how he's using the filters and stuff and then converting it to a graph.
So some great, nice open source or nice examples of how to do data and visualization and stuff.
So.
Yeah.
I love it.
It's beautiful.
Very, very cool.
Yeah.
You all have to follow the links to explore it.
Yeah.
And play with, play with the, the space one.
That's fun.
So.
Yeah.
The space one is the one I was thinking of.
Awesome.
I want to talk Rust, C++ and Python.
I heard Bjorn was saying that C++ is under attack, Brian.
How do you feel about that?
It's under attack.
I think so.
I heard people say that I've heard a lot of, we really, you know, new software should be
written in a memory safe language.
And that's, you know, that doesn't work with C++.
Anyway, that's not the point of this.
Yeah.
The point is.
I'll have a comment later that we'll have to add.
So.
Yeah.
Okay.
I'm here for it.
But that's not what it's about.
This is by Martin Otsiak.
And it is Rust, C++ and Python trends in jobs on Hacker News.
Interesting.
Yeah.
So there's, I don't know how he found this data, but somehow, hey, look, maybe just conversations
on Hacker News might serve as a proxy for programming language job demand.
So there's two questions, you know, ask Hacker News who is hiring and ask Hacker News who
wants to be hired for February, 2025.
And then there's graphs of how many times those appear for Python, Rust and C++.
So if you look at it and this data actually goes back, I don't know what, I guess it's
as of February, but this goes all the way back to 2021.
So this is pretty long-term data, five years, four years.
And so if you look at Python, it's trending downward pretty sharply.
So are C++ and Rust, although they're starting to take up, I guess they're all a little bit
starting to take up here at the very end.
But the Python one is trending downward faster than the other two.
So what does that mean?
Like that people more and more at a higher rate of speed, people are not asking who is
hiring in a particular language, right?
Now, if you look at the other one, the inverse, who wants to be hired?
Hey, we need people.
We need people in this.
They're all going up a little bit generally, but Python is going up way faster.
So fewer people asking to be hired.
More and more people are going, where do I find Python people?
It looks like there's more demand for Python people over time.
There's still more demand for C++ and more demand for Rust people, but at a slower rate
of speed.
Interesting, huh?
Yeah.
And I was totally depressed for a while looking at this graph because of the sharp downward
trend of all programmers, at least for C++, Rust and Python.
I'm like, oh no.
But it looks like if you just look at it from 2021 to now, it's a downward slope.
But if it's kind of...
Which one though?
Who's hiring or who wants to be hired?
Well, I guess I don't get it.
Like the who's hiring.
If that's individuals trying to find a job or don't have a job, they either have or want.
Okay.
Right.
They don't have a job at all, or they have a job that they don't want.
They want one in that technology.
Okay.
Who's trying to hire Python?
Oh, right.
Okay.
So the fact that that's going down means fewer people are not in a job that they want, right?
They're like, they're employed.
That's a good thing.
And they're employed kind of happily.
So the fact that that goes down is good.
And then you look at the next one.
I don't know if this is good or bad, but there's fewer people per...
They're not easily filling the jobs.
It's getting harder and harder to fill the Python jobs at a faster rate than it is for the others.
That means basically there's more employer demand, I'm pretty sure.
That makes sense.
Per candidate, I guess, if you can somehow...
That's more optimistic then.
Yeah, I think it's optimistic on both graphs.
It just depends how you read it.
Yeah.
I mean, it's hacker news, right?
But it's still an interesting angle, you know?
Yeah.
I guess my take on the C++ versus other things or the demise of C++ or whatever, I don't think
we're going to see a demise of C++.
But there's a lot of stuff.
It is difficult to learn.
No doubt about it.
Rust, I think, is difficult to learn too.
But it's, I think, more manageable for people to come up to speed on a small project with
Rust than Python.
But maybe I'm wrong about that.
But I think one of the gains of Rust is we need a way...
It's around Python.
We have this great Python project, but there's a little bit of it here that needs to be sped
up.
What do we do?
Do we jump into C++ that we don't know about or Rust that we don't know about?
And I think people are choosing Rust.
So anyway, that's my take on that.
Yeah, I listen to a couple of cybersecurity, computer security podcasts.
And there's some really interesting conversations about like, if you're going to, you know, they
just did one of them just did an analysis and said, I think 70% of all, 70 or 80% of all security problems with
iOS were memory corruption, memory failure issues, right?
Off by one on an array, use after free, right?
Like the whole category of like things that happen because you're in a memory unsafe language.
Microsoft was something like in the 60 to 70% of all security problems with the software
has to do with memory issues.
Oh, yeah.
And he goes, you can just go through them like one after another.
And they're all, they've all got that flavor, if not the exact same numbers.
You know what I mean?
Yeah.
And so if you're choosing new, you're choosing new projects to start from scratch and you're
picking some systems level language like C, C++, Rust, whatever, and you don't choose
a memory safe language, you're basically choosing to have, you know, two and a half times as
many vulnerabilities in your software.
And that, I think that's what the, my language is under attack feel is.
It's like, yeah, but that fact is still a fact that I'm sorry, but it is, you know?
Yeah.
And you can do stuff, you can do stuff in say C++, right?
Right.
And you need like smart pointers and things that will automatically free them and so on, but
probably not for C, but it's still present, you know?
There's still S print F that was, you know, print F that was wrong or whatever.
Yeah.
And I guess I've spent so much of my life in the low level world of like device drivers
and stuff that that's one of the beautiful things about C++ is a memory mapped hardware
access system is really easy to put together in C++ and I don't know how to do it somewhere
else.
I mean, I'm sure there's ways, but so, and we're always going to have software talk to
hardware.
So unless it gets really easy to do that in another language, we'll have C++.
Yeah.
Or someone builds a little layer.
Well, it probably already is.
We just don't know.
I don't know Matt.
Yeah.
I don't either.
I don't live, I don't live in that world these days.
Anyway, that's pretty interesting stuff.
Yeah.
All right.
Over to you for your final thing.
Well, so there is help and it is only a keyword away.
So I, you know, occasionally I forget about this.
So it's so tempting if you have a question about the world of Python or anything is to just
Google something more.
I mean, what am I using now?
Not Google, something else, some Google alternative.
And, but there's help there and it's pretty good.
So linking to Trey Hunter's article, features of Python's help function.
And help is, is really pretty good with Python.
And it's part of built in.
I don't know if it was built in from the language at the beginning, but it's been there for as
long as I've been using it.
But if you say help, you can give it a string and you can give it a, you can say help on
a function.
You can say help on a module, symbols, keywords, topics, objects, and there's useful stuff that
often comes out.
So this article is talking through some of the things you can do.
One of the things that I like is looking at meta help.
The meta help is pretty interesting.
You can have basically there's a, if you say help and give it the quote topics, you get a
list of available topics and you've got stuff like strings.
I looked up strings.
I'm like, well, I don't use strings, but I looked it up.
And one of the things that strings has is all these scapegoats.
So like, what is a, what does the line feed code look like?
And what's a, you know, all of those, those are in the.
Like the backslash T, the backslash N, but there's got to be some that I don't know.
Yeah.
There's a bunch of others.
And so there's, there's a lot of interesting information in here.
And I think I remember looking at, I don't know, like literals and some of the, some of
the other things in here.
Namespaces is a good one.
Just probably a really good discussion around none and, and numbers and objects.
And there's a lot of great information around, around Python just available with the help
utility.
So here we go.
Help symbols.
So here's all the symbols of Python.
So if you're curious what all the keywords, oh yeah, you can just have a list of all the
keywords there.
There's really not that many Python keywords.
Wow.
That's pretty interesting.
Anyway.
Yeah.
Don't forget help.
And those keywords are things that you can't use as variables or functions or let's say symbols
more broadly in Python.
I just realized that from this PySQL scribe, I was like, why do you have to say select thing
than dot from underscore.
Oh.
And I, and I knew that the old parser, that would probably be the case, right?
Yeah.
Because it's just looks for the word from, but with the new like peg parser forward looking
thing, I thought, oh, it's going to be smart enough to know that this is being used in an
expression and not keyword.
No.
So you can say help symbols and keywords.
And those are the things you can't name symbols at all.
Yeah.
You don't really have to memorize them though, because Python will not let you.
Like it's just.
It's going to be like, Hey, that's a keyword.
Yeah.
Don't do that.
Can't do that.
Yeah, for sure.
For sure.
All right.
Extras.
What do you think?
Yeah.
Extras would be great.
Do you got any?
Got any?
Yeah.
I got one quick, quick, quick.
So last week I mentioned that granion, granion is going strong.
How many stars?
3,200.
This is the rust based one.
Oh yeah.
That is based.
That basically is like a handy wrapper around hyper, right?
Which hyper is a rust HTTP engine.
And that has 15,000 stars.
So quite popular.
But that they released 2.0 and that meant FastAPI and probably a lot of starlet stuff as
well.
Just stopped working categorically.
Whoops.
Well, the next day out rolls patch release 2.0 and that was a good idea.
And FastAPI makes heavy use of any IO.
So that seems like that was probably the problem.
Give it another go.
And all the FastAPI things are happy again.
Cool.
So just as a follow up from last week, really.
Yeah.
I wouldn't point it out that normally, but because since I said it didn't work, I'll put it back
on the checkbox.
If now it works again.
All right.
That's all I got.
Quick and easy.
I got no extras.
Although it just reminded me, I guess I don't have a page for this, but looking at dependencies,
I had to pull up.
I was looking for like I had a big, large, large set of packages that work together, internal
thing.
And something was using Greenlit.
And I'm like, what is using Greenlit?
And I pulled out pip dep tree.
So I love pip dep tree to quickly take a look at what, if you run that, if you just pip install
it and run it, and it'll show you in a tree form what all you have installed and what dependencies
there are.
And so I searched, easily searched through that and found out that Playwright was using
Greenlit.
And I'm like, oh, well, I'll trust them that they have a good reason to use it.
So I just needed to update my Playwright and we were good to go.
Excellent.
Yeah.
I've used that a lot.
It's really nice.
I use the UV pip compile thing, which now embeds that information into the requirements.txt file,
which is nice as well.
Oh, yeah.
Okay.
Yeah.
So I haven't used it that much lately.
But yeah, if you're in any project that doesn't have one of those generated files, then it's...
And another problem you can run into with just having it generate the stuff is, I don't know
about you, but when you add stuff to your requirements file, it'd be that piproject.toml
or requirements.txt equivalent or whatever.
It's easy to put stuff in there and then not take it out because it's like, I don't think
I've used it anymore, but it could break stuff and let's just...
What's it hurting in there?
You know, like it can become real easy for that to become stale.
So, you know, you get a little better look of it from piped up tree maybe.
Anyway, how about a joke?
Sounds good.
I brought a series of battling conspiracy theories to do with technology here.
That sounds fun, right?
Yeah.
So here's a flat earther.
I'm all here for making fun of flat earthers.
I'm a computer engineer and I affirm that the earth is flat.
But apparently John Davis, the secretary of the Flat Earth Society, you are not alone, Brian.
Just because no one else around you thinks the earth is flat, that doesn't mean there's not
a whole hive of people on the internet.
All over the globe.
So what is the response?
Okay.
I'm a geologist and I say that computers work because there are very small people inside
doing all the work.
Yeah.
I gotcha.
I think right back atcha.
And then the subtitle, or if this is not, but if it weren't, XKCD, the hover, whatever that
is, says this earth is flat versus computers work because there are very small people inside
doing all the work.
Was the geologist inspired by Amazon's just walk out technology?
Remember, do you know the story behind that?
No.
You know the Amazon walk in, pick up wherever you want, you register your card, pick up
wherever you want, you walk out and they just charge you?
Yeah.
I'm pretty sure that, I don't have any good sources off the top of my head right now,
but that that was actually, instead of being super smart AI, which is what it was billed
as there were just people in countries where it was cheap enough, just paid to sit there and watch
a camera and just like mark down what you got.
And then like, and someday maybe it was supposed to eventually become powered by AI and video
recognition.
But the working versions were just people watching you on camera and marking it down
as you picked up and put down stuff.
Yeah.
Interesting.
Okay.
Anyway, I think that's the reference there.
That is funny.
There was a, somebody posted the other day about some studies that people are doing.
So a lot of people are using AI for stuff and I'm using it for some things as well, but the,
but for some things companies are doing like they're putting together lists of tasks and having
like, if they were going to like hire a person to do this, a person should be able to do this
task and this is kind of the output they should get.
And, and then putting that, those tests to AI, like agents and just other ways to use AI
and rating them that way.
And if you do that and have, have domain experts come up with these tests, like AI is not doing
well.
And, and, but one of the results was about like 16% correct on a lot of these.
And if the comment was, while impressive and that went on and I'm like, while impressive,
that's just not, I've never got a 16% score in, in school and had somebody say, wow, that's
impressive, but you need to grade on a good curve there.
There you go.
Business Insider.
Oh, go away cookies.
Amazon's just walk out technology relies on hundreds of workers in India watching you
shop.
That, that is ridiculous.
Yeah.
I thought it was RFID or something like that.
No, it's magic.
It's magic.
Yeah.
What a boring job or maybe interesting.
I don't know.
Watching people shop.
Yeah.
Maybe.
Anyway.
All right.
Well, good episode as usual.
Uh, good to talk with you.
Thanks to everybody for tuning in and we'll see you next week.
Yeah.