Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to
your earbuds. This is episode 266, recorded January 12th, 2022. I'm Michael Kennedy.
And I'm Brian Okken.
So great to be here again. And we had this whole survey about having guests, Brian. And this week,
we don't have a guest, it's just you and me, which I think is cool.
That's all right.
Yeah. People out there listening, if they really want to be a guest, they can shoot us a message.
For now, we've got so much cool things, so many cool things to speak about.
We're going to need like a glossary or an FAQ or I mean, something.
Yeah. Well, actually, I don't know how I missed this for so long, but there was a tweet by,
who was it? Trey Hunter had a tweet that it mentioned and actually referred to the glossary.
And I'm like, what? We have a glossary? I never checked it out before.
On the python.org website, there at docs.python.org, there's a glossary.
And it's actually pretty cool. There's a whole bunch of stuff.
Like if you forget what abstract base classes are, it's there.
So there's Python stuff, there's programming stuff.
It even defines what the three arrows mean.
Yeah. Like the three arrows, that's the first one. Default Python prompted, but also the dot, dot, dot.
What is that? The ellipses. And two to three.
See, this threw me off once when I first started. I was like, what's this two to three thing?
Is this a third party package? And it wasn't obvious to me that it was built in.
So that's kind of neat. But it shouldn't be an issue anymore because everybody's on Python 3 now, right?
So anyway, so the glossary, just a shout out that this is here. It's fun. So check it out.
The other thing that this refers to the other documentation in Python a lot.
And one of the things it refers to sometimes is the FAQ. And also didn't know that was there.
We have an FAQ.
Yeah. And it's split into a whole bunch of stuff like general Python and programming and history and design and stuff.
And I ran across it because one of the things I looked up when I followed from the glossary was this question of what's the difference between arguments and parameters?
And it's something that I've always messed up. And now I think I have it.
Parameters are the names of things that appear in the function definition.
And the arguments are the values that get passed in.
Neat.
Don't know why.
Sometimes people use them interchangeably, but they kind of talk about different ways of working with that data.
Yeah. But like, let's say you're new, either new to Python or new to programming.
Some of these perusals, some of these are great things.
Like, why did my changing list Y also change list X?
Well, this will help you understand why there's the naming system in Python and stuff like that.
So it's pretty great.
Yeah. It talks about references and all sorts of stuff.
Yeah. Quite cool.
I like it. I didn't know that we had it, but yeah, that's cool.
You did know it was there?
No, I did not know it was there. That's great.
Okay. Yeah.
I mean, I didn't know anything about it.
So I want to talk about something else.
I want to talk about any IO.
As I'm sure you and a lot of listeners know, I'm a big fan of asyncio and async and await.
I think it really unlocks a lot of potential when you're waiting on things.
There's been a lot of analysis saying, oh, I did this computational thing and it didn't make it any faster.
It made it slower.
It's like, yeah, because it only scales waiting and you're not waiting.
So when you're talking about waiting, it usually has to do with IO with external systems, right?
I'm waiting on the file system.
I'm waiting on the database.
I'm waiting on whatever.
So there's this cool library called any IO.
So I indirectly learned about this from Sebastian Ramirez from FastAPI because he talked about this thing called asyncr, which extends a few things that are ultimately probably going to make it back to any IO.
So any IO is an asynchronous networking and concurrency library that works on top of either asyncio, which is the one we all know and love, or Trio, which is similar to asyncio, but it has a larger, it has more of an understanding of dependencies between tasks and things.
How you can say, I'm going to create a set of work that is made up of these tasks.
And this task is actually a child of that other task.
So if I cancel the top level one, cancel its children, it's a little bit more complicated, but it solves this structured concurrency story that people sometimes need.
So you can use this to get some libraries that will do nice things with stuff you might wait on, right?
So some of the features include there's task groups.
That's the thing I was describing with parent-child relationship type of things.
With Trio, it has high-level networking, TCP, UDP, an API for byte streams and object streams, intertask synchronization and communication, like locks and conditions and events and semaphores, worker threads, subprocesses, all kinds of stuff.
So go over and you can sort of see some real simple ways for it to run.
So one of the things that's sometimes not entirely obvious is how do you run something on asyncio?
Because you've got to make sure you've got an asyncio event loop running.
And if there's already one, you should call get loop.
But if it's not one, you should create one.
And so on.
So this is just, you know, I have an async method, which can be a task and just say, you know, trio.run.
Or you can run and just say the backend is trio, which is pretty cool.
So all sorts of cool stuff like that.
And it just sort of simplifies working with these different things.
If we go and look at the sockets example, you can just say await async with await connect TCP.
And that's allow you to do like await receive, await send, and so on.
So some nice libraries that come out of any IO for doing TCP, UDP, all that kind of stuff.
You know, the things you would wait on.
Yeah.
So if you know you're going to use asyncio, would this buy you anything?
I think that it has those additional higher level libraries for like talking to TCP and byte streams and stuff like that.
And also the subprocess.
Yeah.
So I think it does have like some utility stuff on top of it.
But it's pretty cool.
You can say like await run subprocess, which is pretty cool.
That's actually, that's really cool.
I've not seen this one before.
And that one kind of makes me excited now.
Yeah.
That's cool.
Nice.
Cool.
So not a whole lot more to say about it than that.
But if those are the types of things you're doing, then, you know, come check it out.
It's a cool library.
Do you know what else is cool?
I do not.
Tell me about it.
Oh, I thought we were doing something else.
Wait.
Oh, yes.
We do.
I've got one more thing to talk about before we move on because we have a different number
of things.
I'm not sure where we're sliding.
I'll slide it in here.
So what else is cool is that this episode is brought to you by Datadog.
Thank you, Datadog, for supporting the show.
They've been big supporters of Python Bytes for a really long time.
So that's fantastic.
Plus, really great t-shirts.
Exactly.
They've got cool t-shirts.
I mean, I definitely want to get one of those.
So Datadog does a lot of things.
One of their things they're focusing on now is real-time monitoring.
So they have a real-time monitoring platform that unifies metrics, traces, logs into one
tightly integrated platform.
Their APM empowers developers to identify anomalies, resolve issues, and improve application
performance.
We just finished the Talk Python episode talking about running production.
And everyone there on the panel was like, you need to make sure you're monitoring in
production for things that change in your performance profile because you get too much
data as your infrastructure changes.
That's the way your app is being used changed.
It could hit these scenarios and run into problems that you would just never see in testing.
So if you had Datadog APM, you would have caught it.
So you can begin collecting stack traces, visualize them as flame graphs, organize them into profile
types, such as these are the CPU metrics, Ether, IO, and so on.
Teams can search for specific profiles, correlate them with distributed traces if you're doing microservices,
and identify slower underperforming code for analysis and optimization.
Plus, with Datadog's APM live search, you can perform searches across the full stream of
ingest traces generated by your app over the last 15 minutes.
So try Datadog APM for free with a 14-day trial.
And if you do, you get that t-shirt that Brian mentioned.
So just go to pythonbytes.fm/Datadog or click the link in your podcast player show
notes or in this chapter.
Remember, we talked about chapters and links.
I'll have this have a chapter as well.
So thank you, Datadog, for supporting the show.
Now, let's talk about your next item, Brian.
Yeah, I think it's Vax, Vax, Vax.
I don't know.
Vax?
Vax.
Oh.
There's people are gaining traction for the idea of putting a pronunciation on a GitHub
repo for projects that are not obvious.
Yeah.
I saw this on Twitter.
Let's do it.
Let's make it happen.
So this was suggested by Glenn Ferguson.
This is a library that's a high-performance Python library for lazy out-of-core data frames.
Hmm.
I don't know what out-of-core is.
So I looked it up in a glossary.
After the FAQ.
Yeah.
Out-of-core typically refers to processing data that is too large to fit in the computer's
memory.
So yeah, that's what this is.
So for data processing, often you're trying to do some analysis, do some statistics, maybe
explore the data a little bit.
But you don't want to read it because they're huge data sets and you've got like maybe a limited
computer.
And so that's what this is set up to do.
The main features of it.
So you've got like big data sets.
It also has statistics like mean and sum and count and standard deviation, et cetera.
But it also has some visualizations that are sped up from how they've sped things up and not
kept things in memory.
And they're using memory mapping and some tricks inside to try to avoid any memory copies and try
to do it as lazy as computation as possible.
And this is actually pretty impressive.
I was watching some of this, some of the demos.
So there's a scipy 2019 video where it's the person that started this library, which is now a company
also, but does a demo of this.
And it's really impressive how fast things are.
He's pulling things up.
Because of the memory mapping, you can even have multiple, you know, multiple Jupyter Notebooks.
Yeah, that's it.
Multiple Jupyter Notebooks looking at the same huge data set.
And it doesn't slow things down even when things are working on it.
It's pretty neat.
So I definitely think this is worth checking out.
One of the things on the ReadMe that I like is the key features.
So it's an instant opening of huge data files because it's memory mapping the data file.
It actually doesn't read.
It doesn't do any reads when you read it.
But when you pull some data out, it does lazy reads, jumps ahead.
And it's pretty impressive.
So that also has an expression system so that it's kind of, there is a little bit of a, so
lazy transforms of data.
So that's neat.
Out of core data frames, like we said, fast group buy and aggregations, a whole bunch of
the fast and efficient joins are interesting.
I was watching, looking at another comparison of pandas and Dask and other things versus
Vax.
And it, the joins of huge tables are pretty fast and seamless with here.
And those will blow up some projects.
So yeah, this is, yes, it is similar to Dask.
Somebody asked, lazy, lazy like Dask.
Yes.
But that's a good thing.
Yeah.
Oops.
But it, yeah, a bunch of fun things.
It's good to have, it isn't the same as Dask.
So it's worth checking out to see if maybe this one might be a good fit for you.
Yeah, it's cool.
It's the lazy that makes the magic, right?
You don't have to load it all from disk.
You can distribute it.
There's all kinds of interesting things.
In the a billion sample per row operations per second.
That sounds, that sounds pretty good.
Yeah.
It's watching the demo.
It's incredible how fast he's.
He's popping up things and loading.
Even to be able to visualize things by pulling out samples out of the set.
Wait a minute, Brian.
I heard people told me that Python was slow, so it didn't make sense to do this kind of stuff with it.
What's going on here?
No, no, no, no.
Python's fast.
I know.
Pick the right libraries.
All right.
One of the things that is definitely well known in the Python world is Django.
I've even had people tell me I came to become a Django developer and so I had to learn Python, which is a really interesting perspective.
Yeah.
I want to talk about the Django developer survey results for the 2021 survey because that just recently happened.
So I'll highlight a couple of things that are interesting over here.
One of the questions was, what is the main reason you use Django?
Is it both for work, personal, or for work?
Only 15% said just for work.
Does that seem like a lower number than you expect?
Yeah.
I thought more people were just like, they'd go to work and do Django and they'd go home and they'd, I don't know, watch Game of Thrones or something.
But Django developers love it and they use it a lot for all sorts of things.
So by far, the biggest group here, 66% is for using it for both.
So that stood out to me.
Another one that's interesting is how many people are on the latest version.
So web apps often sort of get stuck in the past because once you get them up and running, like people don't want to touch it.
But 75% of the people are using the 3.2, which at the time of asking, I believe, was the latest version.
Okay.
I'm like, I thought we were up to four now.
What's going on there?
I think four is in beta.
I'm not 100% sure.
I don't think it's totally released.
But yeah, this is still, remember, it's from 2021.
Okay.
2021.
And then also Django has this concept of the latest stable release and then a long-term support release.
So if you go to just the latest stable release and it's not LTS, you may have to upgrade sooner if you want security fixes and so on.
And yet 71% of the people use the latest stable release because they're upgrading frequently, I'm guessing.
And then 27% are on the latest LTS and 2% are just like, how do I upgrade this again?
I don't know.
But that's pretty interesting.
And then the next question was how often.
So 44% of the people upgrade every stable release.
Other people less so.
And it kind of breaks down.
5%.
I use an unsupported version of Django.
I'm okay with that.
Databases for people doing Django is a very strong bias to use a relational database because much of the magic of Django depends upon the Django models, right?
Like the admin section is driven by that and so many things.
And those are all relational.
So with that in mind, the most common database, 77% of the time is Postgres SQL, which is cool.
And then does number two there surprise you, Brian?
No, not really.
SQLite.
Awesome.
Yeah.
If you got very simple deployment stories, you're just going to put it on one server, not much data.
You just want to need something relational, SQLite.
Well, a lot of internal tools and stuff too.
Exactly.
I mean, you wouldn't run like a major tech company on SQLite.
Get away with it without scars and tears.
But, you know, for simple internal apps, that might just be what you need.
You're going to make some SQLite enemies by saying that.
But if you had 100,000 users concurrently using SQLite, that might be bad.
Oh, somebody else said possibly because SQLite is the default setting.
Yeah.
Certainly, that's a big push.
The other one is, do you do caching?
So caching is another layer between the database and your web app where you get the database stuff back
and then you stash it into memory somewhere so that you don't have to do queries again.
So they said, do you do that?
And if so, what do you use?
47% Redis.
43% I don't do that.
And then the only other really notable thing is memcached.
So interesting there.
And I guess people, if they're really interested, they come through and look.
There's a lot of, I don't want to go through it because there's so many details,
but it's like, what are your favorite components?
Like models or admins or auth or what contrib apps do you find most useful?
Like humanize or whatever.
So pretty interesting.
No surprise.
People are using Django templates, not Jinja as their main templates.
And then look, it's a race between pytest and UnitTest as the top two most common frameworks.
With pytest above UnitTest, that's pretty cool.
Especially since UnitTest is the default.
Yeah.
Yeah, absolutely.
Let's see.
I'll just wrap it up with some front-end stuff.
What JavaScript front-end frameworks do you most use?
jQuery.
Number one.
And I don't mean that with a negative way.
Like sometimes you just got some simple problems and you don't need a whole CLI to build a spot to like, you know, focus the text box.
All right.
React is tied at 37% as well.
And then Vue and then Angular.
And then, wow, HTMX made the list.
Look at this.
That's pretty cool, actually.
That's brand new shininess getting in there.
That's pretty cool.
5%, but still.
Yeah.
And then CSS, we got Bootstrap way out front and then Tailwind and then Pure CSS.
All right.
So that's the survey results.
Pretty interesting.
Nice.
All right.
What do you got next for us?
Next, we've got more extras.
We've got our extras.
Okay.
Yes.
Extra, extra, extra, extra, extra, extra.
So I've got so many extras.
I decided to make it one of my topics.
Brian, got anything else before I go on another rant?
No, I'm just ready to listen to all these extras.
All right.
I got a bunch of good stuff.
So don't let the bad guys into your web apps.
Django just had secured your releases for 4.01.
Sorry.
4.01.
3.2 and 2.66.
Oh, does that mean 4.0 is out?
Yeah.
It does look well.
Nobody's using it.
Yeah.
Well, they didn't use it in the past when it wasn't out.
Paul Everett and I teamed up to create a course over at Talk Python called Static Sites with Sphinx and Markdown.
So this course is free.
Everyone can go take it.
All you got to do is have an account.
You can go here and it teaches you how to do Markdown and Sphinx and generate static sites.
There's a cool little demo app that we build over here that you can go and do search and look around and see how you document your code and do all kinds of stuff.
It's nothing too complicated, but sort of neat to see how to use Markdown with Sphinx because typically Sphinx is about restructured text.
So check out the course over there.
I'll put that in the show notes.
I'm going to definitely check that out because I've got a project that I wanted to use Sphinx for, but I was a little intimidated.
Cool.
Yeah.
Paul does a great job with it.
So, and it's only an hour and 25 minutes or something.
So it's not a huge investment in time.
Something that's bothered me basically ever since USB-C, what is this, four years or something, is I need more ports on my computer.
And I want them to be USB ports because I have USB things these days because I want them to go into the ports that I already have.
Until Thunderbolt 4, you've not been able to get a dock that has more than one USB-C or Thunderbolt port, which is super weird to me.
But recently they've come out with Thunderbolt 4 and I just got this thing called the CalDigit Thunderbolt 4 USB 4 Element Hub.
Oh man, this thing is fantastic.
Brian, I'm talking to you on my computer here and I have my 4K monitor, my 1080p camera, my microphone, my stream deck, the lights, keyboard, mouse, track, like seven different things, including the monitor, plugged in with one cable through this thing.
That's really pretty cool.
And so sweet.
So basically it has on the front, it has three USB-C Thunderbolt 4 and a power in.
And then on the side, it has the Thunderbolt that goes to the computer and then also four USB, high speed USB-A, but the good ones.
So really, really cool if you need to expand out your new-ish computer.
What are you using to plug into the monitor then?
I have a Thunderbolt 2 DisplayPort adapter.
And so that way, if I come with my new MacBook, I can just unplug one thing from my mini, click it over, and then boom, I'm ready to go.
Everything's configured.
I'm going to get one of these then.
Yeah, they're not super cheap.
They've been out for about four or five months, but they've been sold out supply chains.
You know, what time of, what's going on with supply chains and everything.
But they finally came out.
They're on Amazon.
So I linked to it over on Amazon.
I also linked to this video by Doc Rock talking about like what the heck is this thing and why is it different?
All right.
I also tweeted about how we use the stream deck to do our live stream, which was fun.
So I shared a bunch of pictures of that, like how we like put the website.
So it says how it's streaming, how we tweet automatically, how we do the sharing and all that kind of stuff.
I'm now going to be working on how to use that thing for software development.
Like how do you use it for Jupyter Notebooks?
So every button on the stream deck, which is 14 free buttons, basically.
Like how, what are the 14 Jupyter operations you'd like to have?
Like run all cells could be a button or, you know, format with black could be a button.
All sorts of stuff.
So very cool.
Oh, you can just have a black button with no logo.
Yes.
That should absolutely be black as well.
So anyway, people are interested in that.
That's there.
I did a talk at PyBay quite a while ago.
Now the talk is out.
Carson was kind enough to retweet that and pointed out that, hey, the talk is actually out.
So I'm linking to my PyBay talk, which was an in-person talk at a conference.
Imagine that.
Wow.
In San Francisco, that was really fun.
People can check that out.
Speaking of conferences, we are a media sponsor of Python Web Conference.
And so you can definitely check that out.
This is one of the, honestly, becoming one of the bigger online conferences.
It's five days all day.
You know, a lot of these online conferences are like, oh, half day, a little thing here.
So a lot of tracks, a lot of things going on with the Python Web Conference.
I'm also speaking there as well.
Are you speaking there?
No.
I'm going to have to get you pytesting something up there.
Well, I should probably do some web stuff.
Yeah, absolutely.
Absolutely.
And so there's a code that you can use.
It's in the show notes, Python Bytes at PwC2022.
And I'll give you 15% off.
Also, in our neighborhood, sort of, because it's virtual, does that still have meaning?
We have PyCascades coming up.
And PyCascades is February 5th and 6th.
So that's going to be remote.
So it's not really local until things settle down.
So people, wherever, can take it.
Well, it's in our time zone.
So it's good.
That's true.
Time zone still matters.
It absolutely still matters.
All right.
That's it for all of my extras.
And we have Patrick out in the audience pointing out PyCon Italy is also happening in June.
So that's fantastic.
Yeah.
Awesome.
So before we get to the joke, I wanted to ask you this brain teaser that my daughter brought up.
I'm on the spot.
So she, yeah, I'm totally putting you on the spot.
So she came home.
I don't know.
She's in junior high.
She came home.
She said, we have this cool brain teaser.
I just want to ask you, just tell me what you think.
So it's a math problem.
So I'm going to go out.
I'm going to buy a baseball bat and a baseball.
The total for both the baseball bat and the baseball are $1.10.
It's pretty cheap.
Yeah.
The difference is the baseball bat is $1 more than the baseball.
So how much is the baseball?
So I'm not going to, you don't have to answer it right now.
But it tripped me up for a little bit.
I'm like, why is this difficult?
It turns out it's like $0.05 because $0.05 plus $1.05 is $1.10.
But my brain went, it's $1.
It's $1 and $0.10.
That's what mine said.
Yeah.
But that's a $0.90 difference.
I don't know why this is difficult, but it's a fun brain teaser to ask people.
Indeed.
Ha, funny.
Very cool.
Well, you know what else is funny?
That feeling of joy that we get as software developers.
Yeah.
But it's mixed in with, I kind of remember myself screaming at my computer yesterday, like out
loud, because something was so frustrating.
I was just like, how is it possible that this is not working?
Like, what is going on?
It wasn't actually about programming.
It was with some app or something.
It's always something else.
Yeah.
Yes.
Sometimes it's my fault.
But anyway, so the joke is expressing that feeling.
And it's the sticker says, I hate programming.
I hate programming.
It works.
I love programming.
This is amazing.
Look at it.
It's like, it's like childbirth.
Like you forget all the horror and pain.
Like, oh, look at my amazing app.
Like, do you remember that you cried for two days because like you couldn't get it to query
the database right in production.
Yeah.
And you love, right.
But you love it because now it works.
I love this.
I was there this morning.
I was like fighting Jenkins of trying to create a Jenkins job with four repos and different
branches.
And I just like, I, I, I hate Jenkins, but if it works or when it works, when it works, I'm
like, sweet.
I am the smartest person in the world.
I'm ready to do this all the time.
Fantastic.
All right.
Well, it never ends.
It never ends.
We've been doing this a long time and we still have these feelings, don't we?
Yeah.
So, well, yeah.
So thanks a lot, Michael, for another great show.
Yeah.
You as well.
It's always fun.
Thank you everyone for listening.
Catch you all later.
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 live stream
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.