WEBVTT

00:00:00.001 --> 00:00:04.800
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to

00:00:04.800 --> 00:00:11.300
earbuds. This is episode 347, recorded August 8th, 2023. And I'm Brian Okken.

00:00:11.300 --> 00:00:12.560
And I'm Michael Kennedy.

00:00:12.560 --> 00:00:18.940
Well, we have lots of great topics today. I'm pretty excited to get to them. This episode,

00:00:18.940 --> 00:00:24.660
of course, is, well, not of course, but is sponsored by us. So if you'd like to support

00:00:24.660 --> 00:00:30.480
the show, you can support us on Patreon or check out one of Michael's many courses or

00:00:30.480 --> 00:00:34.140
my other podcasts or you know how to support us.

00:00:34.140 --> 00:00:36.840
They know the deal. Brian, let me throw one more in there for people.

00:00:36.840 --> 00:00:37.300
Okay.

00:00:37.300 --> 00:00:41.820
If you work for a company and that company is trying to spread the word about a product or

00:00:41.820 --> 00:00:46.060
service, Python Bytes.fm slash sponsor, I can check that out as well. Recommend that to their

00:00:46.060 --> 00:00:47.220
marketing team.

00:00:47.220 --> 00:00:52.940
Definitely. And if you are listening and would like to join the show live sometimes,

00:00:53.240 --> 00:00:58.880
just check out pythonbytes.fm/live. And there's info about it there. Why don't you kick

00:00:58.880 --> 00:01:00.820
us off, Michael, with the first topic?

00:01:00.820 --> 00:01:06.320
Here we go. Let's talk. Let's do a lead in here to basically all of my things.

00:01:06.320 --> 00:01:13.980
Ready? I believe it was Freddy. The folks behind Litestar, L-I-T-E star, is a async framework

00:01:13.980 --> 00:01:19.500
for building APIs in Python. It's pretty interesting. Similar but not the same as FastAPI. They kind

00:01:19.500 --> 00:01:23.020
of share some of the same zen. Now, I'm not ready to talk about Litestar.

00:01:23.020 --> 00:01:28.660
It's not actually my thing. I will at some point, probably. It's pretty popular. 2.4 thousand

00:01:28.660 --> 00:01:32.980
stars. Which is cool. But I'm like, huh, let me learn more about this. Like, let me see what

00:01:32.980 --> 00:01:37.020
this is built on. And so I started poking through, what did I poke through? Not the requirements,

00:01:37.020 --> 00:01:44.200
but the poetry lock file and, and PI project and all that stuff. And came across two projects

00:01:44.200 --> 00:01:48.340
that are not super well known, I think. And I kind of want to shine a light on them by way of

00:01:48.340 --> 00:01:49.840
finding them through Litestar.

00:01:49.840 --> 00:01:55.480
So the first one I want to talk about is async timeout. And I know you have some stuff you want to talk about

00:01:55.480 --> 00:02:03.120
with context managers. And this kind of lines right up there. So this is an asyncio compatible, as in async and await keywords,

00:02:03.120 --> 00:02:13.480
timeout class. And it is itself a context manager. Not the only way you could possibly use it, I suppose. But it's a context manager. And the idea is you say async with timeout. And then whatever you do inside of that block, that, that context manager, that with block, if it's asynchronous and it takes longer than the timeout you've specified, it will cancel it and raise an

00:02:13.480 --> 00:02:30.480
exception say this took too long, right? Maybe you're trying to talk to a database and you're not sure it's on, or you're trying to call an API and you don't know, you don't want to wait more than two seconds for the API to respond or whatever it is you're after. That's, that's what you do is you just say async with timeout, and then it manages all of the

00:02:30.480 --> 00:02:47.480
the nested asyncio calls. And if something goes wrong there, it just raises an exception and cancels it. That's really pretty cool. Isn't that cool? There are ways in which in Python 3.11, I believe it was added where you can create a task group. And then you can do certain things.

00:02:47.480 --> 00:03:08.480
I believe you got to pass, you got to use the task group itself to run the work. Okay, so you pretty sure that's how you do is been a while since I thought about it be some like task group dot, you know, create task and you await it something along those lines, right? And there, you can do a task group.

00:03:08.480 --> 00:03:38.460
And there, you've got to be really explicit, not just in the parts within that, but all the stuff that's doing async and await deep down in the guts, right? They all kind of got to know about this task group deal, I believe, remembering it correctly. And this one, you don't have to do that, right? You just run async stuff within this with block. And if it takes too long, that's it. So in the example here, it says,

00:03:38.460 --> 00:04:08.440
we have an await inner, this is like all the work that's happening. I don't see why that has to be just one, it could be multiple things. Yeah. And it says if it executes faster than the timeout, it just runs as if nothing happened. Otherwise, the inner work is canceled internally by sending an asyncio dot canceled error into it. But from the outside, that's transformed into a timeout error that's raised outside the context manager scope. Be cool. Yeah, that's handy. Yeah, there's another way you can specify you can say timeout

00:04:08.440 --> 00:04:38.420
at like now plus 1.5 seconds, if you'd rather than just say 1.5 seconds. So if there's, you want to capture time at some point, and then later, you want to say that time plus some bit of time, you can also access things like the expired property on the context manager, which tells you whether or not it was expired, or whether it ran successfully. Inside the context manager, you can ask for the deadline. So you know how long it takes. And you can upgrade the time as it runs. You're like, Oh, this part took too long.

00:04:38.420 --> 00:05:08.400
long or under some circumstance, something happened. So we need to do more work. Like maybe we're checking the API if there's a user, but actually there's not. So we've got to create the new user and we've got to send them an email and that might take more time than we were in the sort of other scenario. So you can say shift by or shift to for time. So you can say, Hey, we need to add a second to the timeout within this context manager. Interesting. So basically reschedule it. Yeah. Oh, that's pretty cool. Yeah. So that's

00:05:08.400 --> 00:05:34.460
one thing. And then there's one other bit in here. Wait for right. It says so that this is useful when asyncio wait for is not suitable, but it's also faster than wait for because it doesn't create a separate task that is also scheduled as async wait for itself does. So it's not totally unique functionality in Python, but it's it's a neat way to look at it. And I think this is a nice little library.

00:05:34.460 --> 00:05:37.920
Yeah, I like that. The interface to it's pretty clean as well.

00:05:37.920 --> 00:05:41.360
Yeah. A good little API there because it's a context manager, huh?

00:05:41.360 --> 00:05:46.360
Yeah. Well, let's let's reorder my topics a little bit. Let's talk about context managers.

00:05:46.360 --> 00:05:48.740
Did I change your order? Sorry.

00:05:48.740 --> 00:05:54.900
That's all right. So Trey Hunter has written an article called creating a context manager in Python.

00:05:54.900 --> 00:06:02.280
And we it's as you've just described a context managers, really the things that you use a with block with.

00:06:03.020 --> 00:06:14.300
And there's a whole bunch of them like there's a open if you say with open and then a file name as file, then it automatic. The context manager automatically closes it afterwards.

00:06:14.540 --> 00:06:27.300
So really, this article is about this is pretty awesome. But how do we do it ourselves? And and so he kind of walks through he's got a bunch of a bunch of detail here, which is great.

00:06:27.300 --> 00:06:39.820
It's not too long of an article, though, a useful one, which I thought that was an awesome, good example is having a context manager that changed an environmental variable just with the with block.

00:06:39.820 --> 00:06:48.620
And then it goes back to the way it was before. And the code for this is just a it's just a class with it's not inheriting from anything.

00:06:48.620 --> 00:06:57.140
And the context manager class is a class that has dunder in it, dunder enter and dunder exit functions.

00:06:57.140 --> 00:07:00.220
And then he talks about all the stuff you have to put in here.

00:07:00.660 --> 00:07:13.380
The and then in your example before you said as like with the timer as CM or something so that you could access that to see, you know, values afterwards.

00:07:13.380 --> 00:07:19.900
So Trey talks about how what is the how do you get the as functionality to work?

00:07:19.900 --> 00:07:22.080
And really, it's just you have to return something.

00:07:22.500 --> 00:07:25.980
And then there's enter and exit functions.

00:07:25.980 --> 00:07:29.080
And there's yeah.

00:07:29.080 --> 00:07:31.460
How do you deal with all of those?

00:07:31.460 --> 00:07:33.900
It's a great it's just a little great article.

00:07:33.900 --> 00:07:45.580
I love using context managers and knowing how to I think it makes sense to practice a couple of these, because knowing how to use one in the in the context of your own code.

00:07:45.580 --> 00:07:50.660
There's frequently times where you have to do something and, you know, you're going to have to clean up or something.

00:07:50.780 --> 00:07:52.620
Or there's some final thing that you have to do.

00:07:52.620 --> 00:08:01.460
You don't really want to have that littered all over your code, especially if there's multiple exit points or return points in a context manager is a great way to to deal with that.

00:08:01.460 --> 00:08:04.980
I did want to shout out to pytest a little bit.

00:08:04.980 --> 00:08:14.740
So the environmental variable part example is a great useful one for normal code if you ever want to change the environment outside of testing.

00:08:14.740 --> 00:08:20.740
But if you're doing it in testing, I recommend making sure that you I scroll to the wrong spot.

00:08:20.740 --> 00:08:23.980
There's a monkey patch thing within pytest.

00:08:23.980 --> 00:08:32.600
So if you use fixtures, monkey patch, there is a set environment monkey patch portion.

00:08:32.600 --> 00:08:35.160
So within a test, that's how you do an environmental variable.

00:08:35.160 --> 00:08:39.380
But outside of a test, why not create your own context manager?

00:08:39.380 --> 00:08:40.160
Oh, you're muted.

00:08:40.160 --> 00:08:44.820
So the environment variable only exists while you're in the context block, right?

00:08:44.820 --> 00:08:45.280
That's cool.

00:08:45.280 --> 00:08:45.780
Yeah.

00:08:45.780 --> 00:08:46.260
With block.

00:08:46.260 --> 00:08:46.660
Yeah.

00:08:46.660 --> 00:08:47.860
Or you're changing it.

00:08:47.860 --> 00:08:51.620
Like if you wanted to add a path, add something to the path path or something.

00:08:51.620 --> 00:08:52.220
Sure.

00:08:52.220 --> 00:08:54.040
There's other ways to do the path.

00:08:54.040 --> 00:08:58.200
But let's say it's a, I don't know, some other Windows environment variable or something.

00:08:58.200 --> 00:08:59.000
But yeah.

00:08:59.000 --> 00:08:59.440
Yeah.

00:08:59.440 --> 00:09:00.260
These things are so cool.

00:09:00.360 --> 00:09:06.380
So if you ever find yourself writing, try finally, and the finally part is unwinding something

00:09:06.380 --> 00:09:13.500
like it's clearing some variable or deleting a temporary file or closing a connection, that's

00:09:13.500 --> 00:09:16.500
a super good chance to be using a context manager instead.

00:09:16.500 --> 00:09:20.460
Because you just say with the thing, and then it goes, I'll give two examples that I think

00:09:20.460 --> 00:09:22.740
were really fun and that people might connect with.

00:09:22.740 --> 00:09:30.160
So prior to SQLAlchemy 1.4, the session, which is the unit of work design pattern object

00:09:30.160 --> 00:09:37.240
in SQLAlchemy, the idea of those are, I start a session, I do some queries, updates, deletes,

00:09:37.240 --> 00:09:38.420
inserts, more work.

00:09:38.420 --> 00:09:40.960
And then I commit all of that work in one shot.

00:09:40.960 --> 00:09:43.680
Like that thing didn't used to be a context manager.

00:09:43.680 --> 00:09:49.380
And so what was really awesome was I would create one, like a wrapper class that would

00:09:49.380 --> 00:09:52.540
say in this block, create a session, do all the work.

00:09:52.540 --> 00:09:56.680
And then if you look at the Dunder exit, it has whether or not there was an exception.

00:09:56.680 --> 00:10:00.940
And so my context manager, you could say, when you create it, do you want to auto commit the

00:10:00.940 --> 00:10:01.400
transaction?

00:10:01.400 --> 00:10:04.000
If it succeeds and auto roll it back, if there's an error.

00:10:04.000 --> 00:10:04.520
Yeah.

00:10:04.520 --> 00:10:08.560
And so you just say in the exit, is there an error roll back the session?

00:10:08.560 --> 00:10:11.060
If it's no errors, commit the session.

00:10:11.060 --> 00:10:13.020
And then you just, it's like beautiful, right?

00:10:13.020 --> 00:10:13.900
You don't have to juggle that.

00:10:13.900 --> 00:10:14.500
There's no try.

00:10:14.500 --> 00:10:15.900
Finally, there's awesome.

00:10:16.240 --> 00:10:21.920
Another one to put it in something sort of out of normal scope, maybe for people like

00:10:21.920 --> 00:10:25.360
the database one might be something you think of is colors.

00:10:25.360 --> 00:10:25.940
Yeah.

00:10:25.940 --> 00:10:26.980
Colorama.

00:10:26.980 --> 00:10:31.140
So if using something like Colorama, where you're like, I want to change the color of the

00:10:31.140 --> 00:10:33.260
text for this block, right?

00:10:33.260 --> 00:10:36.220
So you, there's all sorts of colors and cool stuff.

00:10:36.220 --> 00:10:40.720
It's like a lightweight version of rich, but just for colors, you can do things like print

00:10:40.720 --> 00:10:45.040
foreground dot red, and it'll do some sort of every bit of text that comes after that

00:10:45.040 --> 00:10:46.720
will be red or whatever.

00:10:46.720 --> 00:10:51.460
So you can create a context block that is like a colored block of output.

00:10:51.460 --> 00:10:54.820
And then there's a reset all style dot reset all you can do.

00:10:54.820 --> 00:10:57.920
So you just, in the open, you pass in the new color settings.

00:10:57.920 --> 00:11:00.660
You do all your print statements and whatever deep down.

00:11:00.660 --> 00:11:04.760
And then on the exit, you just say print style dot reset all out of Colorama.

00:11:04.900 --> 00:11:09.320
And it's, it's undone, like the color vanishes or you capture what it is and then you reset

00:11:09.320 --> 00:11:12.080
it to the way it was before something along those lines.

00:11:12.080 --> 00:11:15.260
Anyway, this is, I really like this, that kind of stuff, right?

00:11:15.260 --> 00:11:18.440
People maybe don't think about color as a context manager, but.

00:11:18.440 --> 00:11:22.020
But it kind of is because you always have to do the thing afterwards.

00:11:22.020 --> 00:11:23.160
You always have to do this.

00:11:23.160 --> 00:11:24.460
And put it back.

00:11:24.460 --> 00:11:25.120
It's so annoying.

00:11:25.120 --> 00:11:25.460
Yeah.

00:11:25.460 --> 00:11:30.220
Anything where you have to put it back, any other data structures that, that you may

00:11:30.220 --> 00:11:31.540
have like dirty.

00:11:31.540 --> 00:11:34.540
You've got queues sitting around that you want to clean up afterwards.

00:11:34.760 --> 00:11:36.600
Those are great for context managers.

00:11:36.600 --> 00:11:37.340
Absolutely.

00:11:37.340 --> 00:11:43.980
Brandon Brainer notices that and points out that there's also concept context lib for

00:11:43.980 --> 00:11:44.600
making them.

00:11:44.600 --> 00:11:46.560
And I'm glad he brought that up.

00:11:46.560 --> 00:11:47.580
I was going to bring that up.

00:11:47.580 --> 00:11:53.640
Context lib is great, especially for quickly and doing context managers.

00:11:53.640 --> 00:11:57.300
But I think it's in, in maybe the documentation is pretty good.

00:11:57.300 --> 00:12:01.520
You can do a decorator context manager and then you can use a yield for it.

00:12:01.740 --> 00:12:05.760
But I really like the notion of, I guess you should understand both.

00:12:05.760 --> 00:12:10.700
I think people should understand how to write them with just Dunder methods and how to write

00:12:10.700 --> 00:12:13.220
them with the context manager and context lib.

00:12:13.220 --> 00:12:14.240
I think both are useful.

00:12:14.240 --> 00:12:20.000
But meant to mentally understand how the enter exit, all that stuff works, I think is important.

00:12:20.000 --> 00:12:21.240
So thanks, Brian.

00:12:21.460 --> 00:12:21.660
Yes.

00:12:21.660 --> 00:12:26.780
And let's tie the thing that I opened with and this one a little bit tighter together.

00:12:26.780 --> 00:12:32.520
Brian, there's an a enter and a exit or async with blocks.

00:12:32.520 --> 00:12:33.040
Right.

00:12:33.040 --> 00:12:38.500
So if you want an asynchronous enabled version, you just create an async, async def, a enter,

00:12:38.500 --> 00:12:40.560
then async def, a exit.

00:12:40.800 --> 00:12:47.760
And now you can do async and await stuff in your context manager, which is sort of the async equivalent

00:12:47.760 --> 00:12:49.000
of the enter and exit.

00:12:49.000 --> 00:12:49.520
Okay.

00:12:49.520 --> 00:12:57.860
And the context lib also has these async context manager options, a enter and a exit.

00:12:57.860 --> 00:12:58.220
Cool.

00:12:58.220 --> 00:12:58.660
Yeah.

00:12:58.660 --> 00:12:58.980
Perfect.

00:12:58.980 --> 00:12:59.280
Yeah.

00:12:59.280 --> 00:12:59.700
Exactly.

00:12:59.700 --> 00:13:01.020
Very nice.

00:13:01.020 --> 00:13:01.440
Very nice.

00:13:01.440 --> 00:13:02.140
All right.

00:13:02.140 --> 00:13:03.460
Let's go to the next one.

00:13:03.460 --> 00:13:03.960
Yeah.

00:13:03.960 --> 00:13:09.540
So server sent events, let's talk about server sent events, server sent events.

00:13:09.540 --> 00:13:14.940
People probably, well, they certainly know what a request responses for the web, because

00:13:14.940 --> 00:13:16.920
we do that in our browsers all the time.

00:13:16.920 --> 00:13:19.360
I enter URL, the page comes back.

00:13:19.360 --> 00:13:20.180
I click a button.

00:13:20.180 --> 00:13:21.700
It does another request.

00:13:21.700 --> 00:13:22.640
It pulls back a page.

00:13:22.640 --> 00:13:25.720
Maybe I submit a form, it posts it, and then it pulls back a page, right?

00:13:25.720 --> 00:13:32.300
Like that's traditional web interchange, but that is a stateless kind of one time.

00:13:32.300 --> 00:13:35.560
And who knows what happens after that sort of experience for the web.

00:13:35.560 --> 00:13:41.140
And so there were a bunch of different styles of like, what if the web server and the client

00:13:41.140 --> 00:13:43.660
could talk to each other type of thing, right?

00:13:43.660 --> 00:13:46.820
In the early days, this is what's called long polling.

00:13:46.820 --> 00:13:52.860
This works, but it is bad on your server for what you do is you make a request and the server

00:13:52.860 --> 00:13:54.180
doesn't respond right away.

00:13:54.180 --> 00:13:58.900
It just says, this request is going to time out in five minutes and then it'll wait.

00:13:58.900 --> 00:14:02.260
And if it has any events to send during that time, it'll respond.

00:14:02.260 --> 00:14:06.080
And then you start another long poll event cycle, right?

00:14:06.080 --> 00:14:10.480
But the problem is you've got to, for everything that might be interested, you've got an open

00:14:10.480 --> 00:14:11.960
socket just waiting.

00:14:11.960 --> 00:14:16.120
Try it like in the process, a request queue sort of thing.

00:14:16.120 --> 00:14:16.620
It's not great.

00:14:16.620 --> 00:14:21.460
And then web sockets were added and web sockets are cool because they create this connection

00:14:21.460 --> 00:14:27.680
that is bi-directional, like a binary bi-directional socket channel from the web server to the client,

00:14:27.680 --> 00:14:28.580
which is cool.

00:14:28.580 --> 00:14:35.060
Not great for IoT things, mobile devices are not necessarily super good for web sockets.

00:14:35.060 --> 00:14:36.840
It's kind of heavyweight.

00:14:36.840 --> 00:14:40.920
It's like a very sort of complex, like we're going to be able to have the client talk to

00:14:40.920 --> 00:14:44.140
the server, but also the server, the client, they can respond to each other.

00:14:44.260 --> 00:14:48.960
So a lighter weight, simpler version of that would be server sent events.

00:14:48.960 --> 00:14:49.480
Okay.

00:14:49.480 --> 00:14:50.100
Okay.

00:14:50.240 --> 00:14:53.460
So what server sent events do is it's the same idea.

00:14:53.460 --> 00:14:58.660
Like I want to have the server without the client's interaction, send messages to the client.

00:14:58.660 --> 00:15:00.880
So I could create like a dashboard or something, right?

00:15:00.880 --> 00:15:04.460
The difference with server sent events is it's not bi-directional.

00:15:04.460 --> 00:15:09.200
Only the server can send information to the client, but often for like dashboard type things,

00:15:09.200 --> 00:15:09.940
that's all you want.

00:15:09.940 --> 00:15:13.740
Like I want to pull up a bunch of pieces of information and if any of them change, let

00:15:13.740 --> 00:15:15.400
the server notify me, right?

00:15:15.400 --> 00:15:15.880
Oh yeah.

00:15:16.020 --> 00:15:20.540
I want to, I want to create a page that shows the position of all the cars in F1, their

00:15:20.540 --> 00:15:23.640
last pit stop, their tires, like all of that stuff.

00:15:23.640 --> 00:15:28.820
And like, if any of them change, I want the server to be able to let the browser know, but

00:15:28.820 --> 00:15:31.800
there's no reason the browser needs to like make a change, right?

00:15:31.800 --> 00:15:33.380
It's like, it's a watching, right?

00:15:33.380 --> 00:15:37.260
If you, so if you have this watching scenario, server sent events are like a simpler, more

00:15:37.260 --> 00:15:38.880
lightweight, awesome way to do this.

00:15:38.880 --> 00:15:39.300
Okay.

00:15:39.300 --> 00:15:41.940
We all know what SSE, server sent events are.

00:15:41.940 --> 00:15:42.480
Okay.

00:15:42.860 --> 00:15:48.320
So if you want that in Python, there's this cool library, which is not super well known,

00:15:48.320 --> 00:15:51.000
but as cool is HTTP X.

00:15:51.000 --> 00:15:57.040
So HTTP X is kind of like requests sort of maybe the modern day version of requests because it

00:15:57.040 --> 00:15:57.840
has a really great.

00:15:57.840 --> 00:16:00.440
Async and a wait story going on.

00:16:00.440 --> 00:16:08.600
So there's this extension called HTTP X dash SSE for consuming service and events with

00:16:08.600 --> 00:16:09.480
HTTP X.

00:16:09.480 --> 00:16:10.460
Oh, okay.

00:16:10.660 --> 00:16:10.900
Yeah.

00:16:10.900 --> 00:16:15.980
So if you want to be a client to one of these things in Python, to some server that's sending

00:16:15.980 --> 00:16:18.340
out these notifications and these, these updates.

00:16:18.340 --> 00:16:21.780
Well, HTTP X is an awesome way to do it because you can do async and a wait.

00:16:21.780 --> 00:16:23.420
So just a great client in general.

00:16:23.420 --> 00:16:27.980
And then here you plug this in and it has a really, really clean API to do it.

00:16:27.980 --> 00:16:32.540
So what you do is you would get the connect SSE out of it.

00:16:32.540 --> 00:16:38.300
And you just, with HTTP X, you just create a client and then you say, connect the SSE to

00:16:38.300 --> 00:16:40.140
that client to some place, gives you an event source.

00:16:40.140 --> 00:16:44.820
And then you just iterate, you just say for thing and event, and it just blocks until the

00:16:44.820 --> 00:16:45.740
server sends you an event.

00:16:45.740 --> 00:16:49.540
And it'll, I think, raise an exception if the socket's closed is what happens.

00:16:49.540 --> 00:16:53.600
So you just like loop over the events that the server's sending you when they happen.

00:16:53.860 --> 00:16:54.700
Okay, cool.

00:16:54.700 --> 00:16:55.380
Isn't that cool?

00:16:55.380 --> 00:17:00.340
So yeah, so you could like in my F1 example, you could subscribe to the changes of the race

00:17:00.340 --> 00:17:04.560
and when anything happens, you would get like, there's a new tire event and here's the data

00:17:04.560 --> 00:17:11.460
about it and the ID of the event session and all those different things just streaming to

00:17:11.460 --> 00:17:11.720
you.

00:17:11.720 --> 00:17:16.880
And it's like literally five lines of code, sorry, six lines of code with the import statement.

00:17:16.880 --> 00:17:19.120
So what does it look like on the server then?

00:17:19.120 --> 00:17:21.040
I guess that's not what this project is about.

00:17:21.200 --> 00:17:22.520
It's not your problem.

00:17:22.520 --> 00:17:29.640
However, they do say you can, you can create a server, sorry, a starlet server here and they

00:17:29.640 --> 00:17:30.960
have below an example you can use.

00:17:30.960 --> 00:17:31.400
So it's cool.

00:17:31.400 --> 00:17:33.460
They've got a Python example for both ends.

00:17:33.460 --> 00:17:34.020
Yeah.

00:17:34.020 --> 00:17:39.800
So what, what you do on the server is you create an async function and here's a async function

00:17:39.800 --> 00:17:43.020
that just yields bits of just a series of numbers.

00:17:43.020 --> 00:17:47.360
It's kind of like a really cheesy example, but it, it sleeps for about an async second.

00:17:47.640 --> 00:17:51.600
It's like a New York second, like a New York minute, but one sixtieth of it.

00:17:51.600 --> 00:17:52.580
And it doesn't block stuff.

00:17:52.580 --> 00:17:57.080
So you, for an async second, you sleep and then it yields up the data.

00:17:57.080 --> 00:17:57.280
Right.

00:17:57.280 --> 00:18:05.920
And then you can just create one of these event source responses, which comes out of the starlet

00:18:05.920 --> 00:18:10.420
SSE, which is not related to this, I believe, but it's like kind of the server implementation.

00:18:10.420 --> 00:18:11.880
And then you just set that as an endpoint.

00:18:11.880 --> 00:18:14.920
So in order to do that, they just connect to that.

00:18:14.920 --> 00:18:18.500
And then they just get these, these numbers just streaming back every second.

00:18:18.500 --> 00:18:19.480
That's pretty cool.

00:18:19.480 --> 00:18:20.220
Yeah.

00:18:20.220 --> 00:18:26.440
I mean, all of this, like if I, if I hit command minus one time, all of the, both the server

00:18:26.440 --> 00:18:28.280
and the client fit on one screen of code.

00:18:28.280 --> 00:18:28.740
Yeah.

00:18:28.740 --> 00:18:29.220
Yeah.

00:18:29.220 --> 00:18:29.500
Yeah.

00:18:29.500 --> 00:18:30.500
That's pretty neat.

00:18:30.500 --> 00:18:31.940
What else do I have to say about it?

00:18:32.600 --> 00:18:38.440
It has an async way to call it and a synchronous way to call it because that's HTTPX's style.

00:18:38.440 --> 00:18:40.120
It shows how to do it with the async.

00:18:40.120 --> 00:18:41.380
Here's your async with block.

00:18:41.380 --> 00:18:44.880
I mean, it's full of context managers this episode, and it shows you all the different

00:18:44.880 --> 00:18:45.780
things that you can do.

00:18:45.780 --> 00:18:51.100
It talks about how you to handle reconnects and, you know, all of these little projects

00:18:51.100 --> 00:18:56.180
and all these things we're talking about are, there's sort of a breadcrumbs through

00:18:56.180 --> 00:18:57.300
the trail of Python.

00:18:57.300 --> 00:19:01.160
So it says, look, if there's an error, what you might do about that?

00:19:01.260 --> 00:19:05.560
Like if you disconnect, you might want to just let it be disconnected, or you might want

00:19:05.560 --> 00:19:07.580
to try to reconnect or who knows, right?

00:19:07.580 --> 00:19:10.000
What you need to do is not really known by this library.

00:19:10.000 --> 00:19:15.100
So it just says they're just going to get an exception, but it does provide a way to resume

00:19:15.100 --> 00:19:17.780
by holding onto the last event ID.

00:19:17.780 --> 00:19:21.880
So you can say like, Hey, you know, that generator you were sending me before, like, let's keep

00:19:21.880 --> 00:19:24.020
doing that, which is kind of cool.

00:19:24.020 --> 00:19:26.240
And it'll just pick up, but here's the breadcrumbs.

00:19:26.240 --> 00:19:28.700
It says, here's how you might achieve this using stamina.

00:19:28.860 --> 00:19:35.420
And it has the operations here and it says on HTTP gives a decorator says at retry on

00:19:35.420 --> 00:19:36.680
HTTP X dot reader.

00:19:36.680 --> 00:19:39.120
And then it goes, how to redo it again.

00:19:39.120 --> 00:19:39.840
And how often.

00:19:39.980 --> 00:19:47.800
So stamina is a project by Hennick that allows you to do asynchronous retries and all sorts

00:19:47.800 --> 00:19:48.580
of cool stuff.

00:19:48.580 --> 00:19:50.580
So maybe something fun to have.

00:19:50.580 --> 00:19:51.680
We talked about stamina before.

00:19:51.680 --> 00:19:52.340
I don't believe we have.

00:19:52.340 --> 00:19:53.680
I don't think we have.

00:19:53.680 --> 00:19:54.040
We'll have to.

00:19:54.040 --> 00:19:54.900
I don't remember it either.

00:19:54.900 --> 00:19:57.720
But anyway, yeah, there's a lot of cool stuff in here, right?

00:19:57.720 --> 00:19:58.100
Yeah.

00:19:58.220 --> 00:20:01.020
And yeah, so people can go and check this out.

00:20:01.020 --> 00:20:03.780
But here's the retrying version.

00:20:03.780 --> 00:20:08.320
You can see an example of that where it just automatically will continue to keep going.

00:20:08.320 --> 00:20:11.060
So pretty cool little library here.

00:20:11.060 --> 00:20:13.240
HTTP X dash S E.

00:20:13.240 --> 00:20:15.400
It has 51 GitHub stars.

00:20:15.400 --> 00:20:16.840
I feel like it deserves more.

00:20:16.840 --> 00:20:18.660
So people can give it a look.

00:20:18.660 --> 00:20:19.040
Yeah.

00:20:19.040 --> 00:20:25.800
Well, speaking of cool projects on Python, cool projects in Python, you'll probably grab them

00:20:25.800 --> 00:20:26.800
from PyPI, right?

00:20:26.800 --> 00:20:27.940
Of course.

00:20:27.940 --> 00:20:28.600
Do a pip install.

00:20:28.960 --> 00:20:31.960
And let's take a look at stamina, for instance.

00:20:31.960 --> 00:20:36.960
In a lot of projects, one of the things you can do, you can go down and on the left-hand

00:20:36.960 --> 00:20:40.580
side, there's project description, release history, download files.

00:20:40.580 --> 00:20:41.420
Everybody has that.

00:20:41.420 --> 00:20:42.340
All of them have that.

00:20:42.340 --> 00:20:43.940
But then there's project links.

00:20:43.940 --> 00:20:45.520
And these change.

00:20:45.520 --> 00:20:46.840
They're different on different projects.

00:20:46.840 --> 00:20:51.740
So stamina's got a change log and documentation and funding and source.

00:20:51.740 --> 00:20:54.940
And they all have icons associated with it.

00:20:54.940 --> 00:20:56.840
So I don't know what we have.

00:20:57.000 --> 00:20:59.400
If we go to source, it goes to GitHub, looks like.

00:20:59.400 --> 00:21:02.120
Funding, it's a GitHub sponsors.

00:21:02.120 --> 00:21:03.060
That's pretty cool.

00:21:03.060 --> 00:21:04.120
Documentation.

00:21:04.120 --> 00:21:05.720
I'm looking at the bottom of my screen.

00:21:05.720 --> 00:21:08.980
Documentation links to stamina.hinnick.me.

00:21:08.980 --> 00:21:09.640
Okay.

00:21:09.640 --> 00:21:10.100
Interesting.

00:21:10.100 --> 00:21:11.640
Change log.

00:21:11.640 --> 00:21:14.060
Anyway, these links are great on projects.

00:21:14.060 --> 00:21:16.160
Let's take a look at, but they're different.

00:21:16.160 --> 00:21:18.620
So textual just has a homepage.

00:21:18.620 --> 00:21:19.380
Okay.

00:21:19.380 --> 00:21:24.540
HTTPX has change log homepage documentation.

00:21:25.540 --> 00:21:26.960
pytest has a bunch also.

00:21:26.960 --> 00:21:28.360
Also, it has a tracker.

00:21:28.360 --> 00:21:29.460
That's kind of neat.

00:21:29.460 --> 00:21:30.240
And Twitter.

00:21:30.240 --> 00:21:30.980
A bug in there, yeah.

00:21:30.980 --> 00:21:33.700
So how do you get these?

00:21:33.700 --> 00:21:37.680
So if you have a project, it's really helpful to put these in here.

00:21:37.680 --> 00:21:43.460
And so there's Daniel Roy Greenfield wrote a blog post or post saying,

00:21:43.460 --> 00:21:46.220
PyPI project URLs cheat sheet.

00:21:46.220 --> 00:21:48.660
So basically figured all this stuff out.

00:21:48.660 --> 00:21:53.820
It's in, it's not documented really anywhere except for here, but it's in the warehouse code.

00:21:53.820 --> 00:21:56.400
And the warehouse is the software that runs PyPI.

00:21:56.400 --> 00:22:02.580
And I'm not going to dig through this too much, but basically it's the trying to figure out what

00:22:02.580 --> 00:22:08.840
the name is the name that you put on in for a link and then which icon to use, if that's it.

00:22:08.840 --> 00:22:11.260
So there's a bunch of different icons that are available.

00:22:11.260 --> 00:22:16.760
And anyway, we don't need to look at that too much because Daniel made a cheat sheet for us.

00:22:16.820 --> 00:22:23.280
So he shows a handful of them on his post, also a link to where they all are.

00:22:23.280 --> 00:22:29.440
But then what it is, is you've got project URLs in your PyProject.toml file.

00:22:29.440 --> 00:22:36.020
And it just lists a bunch of them that you probably want, possibly like homepage, repository, changelog.

00:22:36.020 --> 00:22:42.800
Anyway, this is a really cool cheat sheet of things that you might want to use and what names to give them.

00:22:42.800 --> 00:22:50.580
So it's a name equals string with the URL and the names on the left can be anything.

00:22:50.580 --> 00:22:53.040
But if they're special things, you get an icon.

00:22:53.040 --> 00:22:54.320
So nice.

00:22:54.320 --> 00:22:57.380
Anyway, and there's even a mastodon now one now.

00:22:57.380 --> 00:22:58.080
So that's cool.

00:22:58.080 --> 00:22:58.680
Yay.

00:22:58.680 --> 00:23:00.260
You have to change the Twitter one.

00:23:00.260 --> 00:23:02.140
Twitter.

00:23:02.140 --> 00:23:03.920
Oh, it's Twitter or X.

00:23:03.920 --> 00:23:04.460
Interesting.

00:23:04.460 --> 00:23:05.020
Yeah.

00:23:05.020 --> 00:23:06.540
I think how much math that's going to break.

00:23:06.540 --> 00:23:07.940
It has to be called X everywhere now.

00:23:07.940 --> 00:23:09.300
No more algebra for you.

00:23:09.300 --> 00:23:10.620
Yeah.

00:23:10.620 --> 00:23:12.320
What a dumpster fire.

00:23:12.320 --> 00:23:12.580
Okay.

00:23:12.580 --> 00:23:18.200
Mike out in the audience points out the icons are courtesy of Font Awesome.

00:23:18.200 --> 00:23:19.720
And indeed they are.

00:23:19.720 --> 00:23:21.900
If you're not familiar with Font Awesome, check that out.

00:23:21.900 --> 00:23:25.660
So like we could come over here and search for, wait for it, GitHub.

00:23:25.660 --> 00:23:27.700
And you get all these icons here.

00:23:27.700 --> 00:23:30.200
One of them is the one that shows up.

00:23:30.200 --> 00:23:32.000
I don't remember which one of these it would be.

00:23:32.000 --> 00:23:36.240
But if, you know, so it shows you the code that you need.

00:23:36.240 --> 00:23:41.140
It's just fa brands space fa dash GitHub for the icon there.

00:23:41.140 --> 00:23:44.580
But if for some reason you're like, what if there was a merge one?

00:23:44.580 --> 00:23:45.660
I want to merge.

00:23:46.040 --> 00:23:49.080
But there's no merge that's there like on your other project, right?

00:23:49.080 --> 00:23:51.740
Then there's, there's, I don't know how many icons are in Font Awesome.

00:23:51.740 --> 00:23:52.760
Like 6,000.

00:23:52.760 --> 00:23:53.060
Yeah.

00:23:53.060 --> 00:23:55.220
6,444 in total.

00:23:55.220 --> 00:23:56.100
And maybe.

00:23:56.100 --> 00:23:57.320
No, I take that back.

00:23:57.320 --> 00:23:59.760
Cause there's new 12,000 new ones.

00:23:59.760 --> 00:24:00.760
So there's a, there's a lot.

00:24:00.760 --> 00:24:01.840
Let's just say there's a lot here.

00:24:01.840 --> 00:24:03.860
Well, the top said 26,000.

00:24:04.060 --> 00:24:04.800
So that's.

00:24:04.800 --> 00:24:05.440
There we go.

00:24:05.440 --> 00:24:06.480
Yeah.

00:24:06.480 --> 00:24:06.880
Awesome.

00:24:06.880 --> 00:24:07.420
Yeah.

00:24:07.420 --> 00:24:07.780
So.

00:24:07.780 --> 00:24:09.280
Oh, there's a fire one.

00:24:09.280 --> 00:24:10.740
There's so many good ones.

00:24:10.740 --> 00:24:12.120
That'd be a good one for Twitter now.

00:24:12.120 --> 00:24:17.640
By the way, if you go to Python bytes and you would be, I would be, you go to the bottom,

00:24:17.640 --> 00:24:18.860
like all these little icons.

00:24:18.860 --> 00:24:19.880
These are all Font Awesome.

00:24:19.880 --> 00:24:21.780
Even the little heart about made in Portland.

00:24:21.780 --> 00:24:25.300
Is Font Awesome a free thing or do you got to pay for it?

00:24:25.300 --> 00:24:25.680
You know?

00:24:25.680 --> 00:24:26.420
Yes and no.

00:24:26.420 --> 00:24:31.580
So Font Awesome is there's like, if you, if I search for GitHub again, you see that some

00:24:31.580 --> 00:24:32.680
say pro and some don't.

00:24:32.680 --> 00:24:33.080
Yeah.

00:24:33.080 --> 00:24:33.800
Oh, okay.

00:24:34.000 --> 00:24:34.240
Pro.

00:24:34.240 --> 00:24:36.180
The ones that don't say pro are free.

00:24:36.180 --> 00:24:37.640
The ones that say pro are pro.

00:24:37.640 --> 00:24:43.300
They cost like a hundred dollars a year subscription, but I have a, I bought a subscription to it

00:24:43.300 --> 00:24:44.780
and just canceled it because.

00:24:44.780 --> 00:24:46.220
You got the icons you need.

00:24:46.220 --> 00:24:47.180
I got the icon.

00:24:47.180 --> 00:24:50.040
If I'm just locked at version six for a good long while, that's fine.

00:24:50.040 --> 00:24:51.700
Maybe someday I'll buy more, but yeah.

00:24:51.700 --> 00:24:52.100
So.

00:24:52.100 --> 00:24:52.700
Okay.

00:24:52.700 --> 00:24:53.060
There you go.

00:24:53.060 --> 00:24:53.600
Nice.

00:24:53.600 --> 00:24:55.140
So yeah, that's, that's awesome.

00:24:55.140 --> 00:25:01.080
But it's cool how you, or how you pointed out Danny related that to the pyproject.tom.

00:25:01.080 --> 00:25:02.980
I had no idea that that's how those went together.

00:25:02.980 --> 00:25:03.340
It's cool.

00:25:03.660 --> 00:25:04.280
Nice.

00:25:04.280 --> 00:25:05.020
All right.

00:25:05.020 --> 00:25:05.500
All right.

00:25:05.500 --> 00:25:06.280
Well, I've got my screen up.

00:25:06.280 --> 00:25:07.240
I'm off to the next one, huh?

00:25:07.240 --> 00:25:07.820
Yeah.

00:25:07.820 --> 00:25:09.160
We're done with them, aren't we?

00:25:09.160 --> 00:25:13.520
That was, I have no more items, no more items to cover other than, other than extras.

00:25:13.900 --> 00:25:14.220
Okay.

00:25:14.220 --> 00:25:16.560
Well, I have a couple extras.

00:25:16.560 --> 00:25:20.340
So I, a couple.

00:25:20.340 --> 00:25:20.900
More people.

00:25:20.900 --> 00:25:21.820
More people.

00:25:21.820 --> 00:25:22.360
More people.

00:25:22.360 --> 00:25:23.660
More people in Python people.

00:25:23.660 --> 00:25:25.340
What did I want to say?

00:25:25.340 --> 00:25:28.500
Oh, just that I had some great feedback.

00:25:28.640 --> 00:25:31.160
So I love starting something new.

00:25:31.160 --> 00:25:33.000
It's good to provide feedback for people.

00:25:33.000 --> 00:25:38.340
And I got some wonderful feedback that the music that I stole from Test and Code is annoying

00:25:38.340 --> 00:25:41.180
on Python people because it's a completely different tone.

00:25:41.180 --> 00:25:42.360
And fair enough.

00:25:42.460 --> 00:25:47.180
So I'm going to go through and rip out all the intro music out of Python people.

00:25:47.180 --> 00:25:50.760
So, and also the next episode's coming out this week.

00:25:50.760 --> 00:25:52.920
It'll be Bob Belderbos from Pi Bites.

00:25:52.920 --> 00:25:53.900
It's a good episode.

00:25:53.900 --> 00:25:55.440
So it should be out later this week.

00:25:55.440 --> 00:25:56.480
Do you have any extras?

00:25:56.480 --> 00:25:57.480
I do.

00:25:57.480 --> 00:25:58.200
I do.

00:25:58.200 --> 00:25:58.540
I do.

00:25:58.540 --> 00:26:03.220
I have some cool announcements and some extras and all of those things.

00:26:03.220 --> 00:26:08.540
First of all, physicists achieve fusion with Net Energy Game for the second time.

00:26:08.540 --> 00:26:13.660
So, you know, the holy grail of energy is fusion, not fission, right?

00:26:13.660 --> 00:26:18.040
Just squishing stuff together like the sun does and getting heavier, heavier particles

00:26:18.040 --> 00:26:21.860
and tons of energy with no waste, no negative waste, really.

00:26:21.860 --> 00:26:24.700
I mean, there's output, but like helium or something, right?

00:26:24.700 --> 00:26:25.220
Oh, no.

00:26:25.220 --> 00:26:26.360
We need more helium anyway.

00:26:26.360 --> 00:26:30.820
I don't know, Brian, if you knew, but there's a helium shortage and a crisis of helium potentially.

00:26:30.820 --> 00:26:31.860
We'll see that someday.

00:26:31.860 --> 00:26:39.440
Anyway, the big news is the folks over at the NIF repeated this big breakthrough that they

00:26:39.440 --> 00:26:41.820
had last year at the National Ignition Facility.

00:26:41.820 --> 00:26:43.100
So congrats to them.

00:26:43.420 --> 00:26:48.760
And why am I covering this here other than, hey, it's kind of cool science, is last year

00:26:48.760 --> 00:26:54.180
after that, or actually earlier this year, I had Jay Solmanson on the show and we talked

00:26:54.180 --> 00:27:00.820
about all the Python that is behind that project at the NIF and how they use Python to help power

00:27:00.820 --> 00:27:03.980
up the whole national fusion breakthrough that they had.

00:27:03.980 --> 00:27:05.160
So very cool.

00:27:05.160 --> 00:27:09.560
If people want to learn more about that, they can listen to the episode 403 on Talk Python

00:27:09.560 --> 00:27:09.800
to Me.

00:27:09.800 --> 00:27:12.400
And just congrats to Jay and team again.

00:27:12.400 --> 00:27:12.960
That's very cool.

00:27:13.180 --> 00:27:17.920
Do they have a 1.21 gigawatt one yet?

00:27:17.920 --> 00:27:19.500
That would be good.

00:27:19.500 --> 00:27:20.440
They can't go back in time yet.

00:27:20.440 --> 00:27:20.700
No.

00:27:20.700 --> 00:27:21.260
Okay.

00:27:21.260 --> 00:27:21.980
No.

00:27:22.360 --> 00:27:28.740
But if you actually look, there's a video down there.

00:27:28.740 --> 00:27:34.280
If you actually look at the project here, the machine that it goes through, this is like

00:27:34.280 --> 00:27:42.500
a warehouse room-sized machine of lasers and coolers and mirrors and insane stuff that it

00:27:42.500 --> 00:27:48.120
goes through until it hits like a dime-sized or small marble-sized piece somewhere.

00:27:48.120 --> 00:27:49.340
There's like an insane...

00:27:49.340 --> 00:27:54.300
It's not exactly what you're asking for, but there is something insane on the other side

00:27:54.300 --> 00:27:54.860
of the devices.

00:27:54.860 --> 00:27:55.460
Yeah.

00:27:55.460 --> 00:27:57.540
We've got ways to get this into a car.

00:27:57.540 --> 00:27:58.240
Yeah.

00:27:58.240 --> 00:28:01.020
I mean, Marty McFly has got to definitely wait.

00:28:01.020 --> 00:28:01.660
Yeah.

00:28:01.660 --> 00:28:03.460
To save his parents' relationship.

00:28:03.460 --> 00:28:03.820
Okay.

00:28:03.820 --> 00:28:05.120
All right.

00:28:05.120 --> 00:28:05.540
All right.

00:28:05.540 --> 00:28:07.060
I have another bit of positive news.

00:28:07.060 --> 00:28:07.900
I think this is positive.

00:28:07.900 --> 00:28:08.940
This is very positive news.

00:28:08.940 --> 00:28:09.360
Yeah.

00:28:09.520 --> 00:28:13.640
The other positive news is, you know, I've kind of knocked on Facebook and Google.

00:28:13.640 --> 00:28:20.500
Last time, I think I was railing against Google and their DRM for websites, like their ongoing

00:28:20.500 --> 00:28:24.300
persistent premise that we must track and retarget you.

00:28:24.300 --> 00:28:26.080
So how can we make the web better?

00:28:26.080 --> 00:28:29.220
Like, no, no, that's not the assumption we need to start with.

00:28:29.220 --> 00:28:30.060
No, it's not.

00:28:30.060 --> 00:28:34.760
So I would, you know, I just want to point out maybe like a little credit, a little credit

00:28:34.760 --> 00:28:38.080
to Facebook at this time, a little, maybe a positive shout out.

00:28:38.080 --> 00:28:42.600
So there's a bunch of rules that I think are off the target by here.

00:28:42.600 --> 00:28:49.340
And for example, there were a bunch of attempts and like in Spain, there was an attempt to

00:28:49.340 --> 00:28:55.340
say, if you're going to link to a news organization, you have to pay them.

00:28:55.340 --> 00:28:56.840
Like, wait a minute.

00:28:56.840 --> 00:29:01.180
So our big platform is sending you free traffic.

00:29:01.180 --> 00:29:05.180
And to do that, we have to pay you, you know, because the newspapers are having a hard time

00:29:05.180 --> 00:29:05.680
and they're important.

00:29:05.680 --> 00:29:07.920
But maybe that's a little bit off.

00:29:08.000 --> 00:29:12.120
Probably the most outrageous of this category of them were somewhere in Europe.

00:29:12.120 --> 00:29:16.740
I can't remember if it was the EU in general or a particular company, a country rather, sorry.

00:29:16.740 --> 00:29:22.880
The, they were trying to make companies like Netflix and Google via, because of YouTube,

00:29:22.880 --> 00:29:26.980
pay for their broadband because people consume a lot of their content.

00:29:27.120 --> 00:29:28.580
So it uses a lot of their traffic.

00:29:28.580 --> 00:29:32.300
It's like, wait a minute, we're paying already to like get this to you.

00:29:32.300 --> 00:29:35.660
And then you're going to charge us to make you pay for our infrastructure.

00:29:35.660 --> 00:29:36.600
I don't know.

00:29:36.600 --> 00:29:38.400
I just, you're like, oh, no, no, no.

00:29:38.400 --> 00:29:44.880
That seems really odd to say like, you know, Netflix should pay for Europe's fiber because

00:29:44.880 --> 00:29:45.860
people watch Netflix.

00:29:45.860 --> 00:29:46.320
I don't know.

00:29:46.320 --> 00:29:48.060
That just, it seems super backwards to me.

00:29:48.500 --> 00:29:49.500
Okay.

00:29:49.500 --> 00:29:51.420
I'm going to be devil's advocate here.

00:29:51.420 --> 00:29:57.700
I think that, that if Netflix, for example, if Netflix is taking half the bandwidth or

00:29:57.700 --> 00:30:03.720
something like that, then all of the infrastructure costs, half of those costs are benefiting Netflix

00:30:03.720 --> 00:30:05.260
and they're profiting off of it.

00:30:05.380 --> 00:30:06.980
I think that's sort of legitimate.

00:30:06.980 --> 00:30:09.400
It depends on the scale, right?

00:30:09.400 --> 00:30:15.360
I think like, we are not taking a ton of bandwidth from Europe, so it would be weird

00:30:15.360 --> 00:30:16.620
for us to have to pay something.

00:30:16.620 --> 00:30:21.700
But if I'm taking a measurable percentage, that's probably maybe okay.

00:30:21.700 --> 00:30:28.000
the other side is like, I read Google news still, even though I'm not a huge fan of

00:30:28.000 --> 00:30:29.420
Google, but I read Google news.

00:30:29.420 --> 00:30:31.340
There's a lot of times where that's enough.

00:30:31.340 --> 00:30:33.160
I'm like, is there anything important happening?

00:30:33.160 --> 00:30:34.280
I'm just reading the headlines.

00:30:34.360 --> 00:30:40.220
I'm not clicking on the link and that, that benefit then for Google wouldn't be there if

00:30:40.220 --> 00:30:41.340
the newspapers weren't there.

00:30:41.340 --> 00:30:45.540
So I would say some money going to the newspapers that are providing those headlines.

00:30:45.540 --> 00:30:46.760
I think that's fair.

00:30:46.760 --> 00:30:50.480
So I certainly hear what you're saying with the news on that.

00:30:50.480 --> 00:30:52.420
we still haven't got to the topic yet.

00:30:52.420 --> 00:30:52.820
Okay.

00:30:52.820 --> 00:30:54.920
I, no, no, but I totally hear you.

00:30:54.920 --> 00:31:00.580
I think with the bandwidth, like the customers decide like no one's Netflix isn't projecting

00:31:00.580 --> 00:31:03.800
stuff onto the people in Europe and they're receiving it out of it.

00:31:03.800 --> 00:31:05.020
They, they seek it out.

00:31:05.020 --> 00:31:05.280
Right.

00:31:05.280 --> 00:31:05.860
So I don't know.

00:31:05.860 --> 00:31:10.020
I feel like, but we can, yeah, that's, I appreciate the devil's advocate.

00:31:10.020 --> 00:31:10.300
Yeah.

00:31:10.300 --> 00:31:11.140
Okay.

00:31:11.140 --> 00:31:12.500
What was the, and Google news?

00:31:12.500 --> 00:31:13.880
So here's the news though.

00:31:14.340 --> 00:31:21.580
Facebook and more generally meta is protesting a new Canadian law, obliging it to pay for

00:31:21.580 --> 00:31:28.720
news that if, so if my mom shares an article, say my mom was Canadian and she shared an article

00:31:28.720 --> 00:31:36.700
to some, some news thing, the Canadian post or whatever, then on Facebook, then Facebook

00:31:36.700 --> 00:31:38.280
would have to pay the Canadian post.

00:31:38.280 --> 00:31:39.420
Cause my mom put it there.

00:31:39.420 --> 00:31:43.880
So they're protesting it by no longer having news in Canada.

00:31:43.880 --> 00:31:46.000
News doesn't exist in Canada now.

00:31:46.000 --> 00:31:47.240
On Facebook or.

00:31:47.240 --> 00:31:47.660
Yeah.

00:31:47.660 --> 00:31:48.840
So my mom tried to post it.

00:31:48.840 --> 00:31:50.300
They were just going to like, that can't be posted.

00:31:50.300 --> 00:31:52.000
Oh, well that's weird.

00:31:52.760 --> 00:31:53.560
Isn't that weird.

00:31:53.560 --> 00:31:57.760
So I actually kind of agree with you on the Google news bit, like where a good chunk

00:31:57.760 --> 00:32:02.020
of it is there and it becomes almost a reader type service, but like Facebook doesn't do that.

00:32:02.020 --> 00:32:05.520
It just says, well, here's the, here's the thumbnail and you could click on it.

00:32:05.520 --> 00:32:10.980
But also there's a lot of, a lot of anger below it, but get their news from people sharing

00:32:10.980 --> 00:32:11.780
it on Facebook.

00:32:11.780 --> 00:32:12.580
They follow.

00:32:12.580 --> 00:32:13.540
Do they click it?

00:32:13.540 --> 00:32:16.520
That's the, do they, do they, do they often not?

00:32:16.520 --> 00:32:18.080
yeah, possibly.

00:32:18.500 --> 00:32:23.640
And is it free is the, is the bandwidth if, if like, if I share it with a million people,

00:32:23.640 --> 00:32:28.240
um, and they don't click on it, does it cost the news paper?

00:32:28.240 --> 00:32:31.640
Possibly they might be drawing it for the headline and the image and all that stuff.

00:32:31.640 --> 00:32:32.080
They might.

00:32:32.080 --> 00:32:32.360
Yeah.

00:32:32.360 --> 00:32:34.180
They probably cash it, but they might, might not.

00:32:34.180 --> 00:32:34.600
I do.

00:32:34.600 --> 00:32:38.160
So I'll leave, I'll put this out there for people to have their own opinions.

00:32:38.160 --> 00:32:42.580
but I think this is something that Facebook should stand up to.

00:32:42.580 --> 00:32:44.240
And just me not speaking for Brian.

00:32:44.240 --> 00:32:45.280
Well done Facebook.

00:32:45.280 --> 00:32:47.920
I don't think, I don't think this makes any sense.

00:32:47.980 --> 00:32:53.260
Like they're protesting this law that makes them pay if my mom were Canadian and put

00:32:53.260 --> 00:32:54.460
news into her feed.

00:32:54.460 --> 00:32:54.940
Yeah.

00:32:54.940 --> 00:32:57.120
And I'll just say, way to go Canada.

00:32:57.120 --> 00:32:58.060
I like it.

00:32:58.060 --> 00:32:59.860
Awesome.

00:32:59.860 --> 00:33:00.480
All right.

00:33:00.480 --> 00:33:00.920
Cool.

00:33:00.920 --> 00:33:02.980
That's it for all the items I got.

00:33:02.980 --> 00:33:03.920
You covered yours, right?

00:33:03.920 --> 00:33:05.000
Yes, I did.

00:33:05.000 --> 00:33:08.220
So let's do something funny before we get into fisticuffs.

00:33:08.220 --> 00:33:10.120
So before, no, never.

00:33:10.120 --> 00:33:12.420
So, well, you want to talk about fisticuffs.

00:33:12.420 --> 00:33:13.120
So let's see the joke.

00:33:13.120 --> 00:33:15.340
So this joke makes fun of a particular language.

00:33:15.460 --> 00:33:17.980
The point is not to make fun of that language.

00:33:17.980 --> 00:33:19.720
It's to make fun of AI.

00:33:19.720 --> 00:33:20.080
Okay.

00:33:20.080 --> 00:33:23.720
So people who are, want to support the AI, they can send me their angry messages.

00:33:23.720 --> 00:33:26.860
People who are fans of the language I'm about to show you, please don't.

00:33:26.860 --> 00:33:28.080
Not about that.

00:33:29.020 --> 00:33:29.280
Okay.

00:33:29.280 --> 00:33:36.140
So if you were working with a GitHub copilot, you know, a lot of times it tries to auto-suggest

00:33:36.140 --> 00:33:37.380
stuff for you, right?

00:33:37.380 --> 00:33:39.320
That didn't zoom that.

00:33:39.320 --> 00:33:41.400
It tries to auto-suggest stuff for you.

00:33:41.400 --> 00:33:42.140
Yeah.

00:33:42.440 --> 00:33:46.900
And so if you say like, this is C-sharp, people know I've done C-sharp before.

00:33:46.900 --> 00:33:48.060
I like it at all.

00:33:48.060 --> 00:33:51.480
so not make fun of it, but it's just a slash slash day.

00:33:51.480 --> 00:33:54.800
And then there's an auto-complete statement that the copilot is trying to write.

00:33:54.800 --> 00:33:55.380
What does it say?

00:33:55.380 --> 00:33:55.640
Right?

00:33:55.640 --> 00:33:59.960
It says day one of C-sharp, and I already hate it.

00:33:59.960 --> 00:34:06.200
So like how many people have written this in their like online journals or something?

00:34:06.200 --> 00:34:07.440
Yes, exactly.

00:34:07.440 --> 00:34:09.260
What in the world is going on here?

00:34:09.260 --> 00:34:18.120
So that's, there's some, there's some fun comments, but, they're not too great

00:34:18.120 --> 00:34:24.040
down here, but I just, I just thought like, you know, this, this weirdo, weirdo auto-complete,

00:34:24.040 --> 00:34:27.200
like we're going to get into this, where this kind of stuff happens all the time, right?

00:34:27.200 --> 00:34:32.580
This is kind of, the Google suggest, you know, let's see if I can get it to work here.

00:34:32.580 --> 00:34:39.120
We go to Google and type American, Americans are, you know, what does it say?

00:34:39.120 --> 00:34:39.380
Right?

00:34:39.380 --> 00:34:40.380
Struggling.

00:34:40.380 --> 00:34:41.620
Entitled.

00:34:41.620 --> 00:34:42.160
Yeah.

00:34:42.160 --> 00:34:48.700
Like C-sharp developers are, and then it'll give you like a list or let's do it with Python,

00:34:48.700 --> 00:34:49.160
right?

00:34:49.160 --> 00:34:51.420
Python, Python, right?

00:34:51.420 --> 00:34:52.380
Who are the Python?

00:34:52.380 --> 00:34:53.820
Why are they paid so much?

00:34:53.820 --> 00:34:55.140
Who hired these people?

00:34:55.140 --> 00:34:56.020
Et cetera, right?

00:34:56.080 --> 00:35:00.040
So this is the AI equivalent, but it's going to be right where you work all the time.

00:35:00.040 --> 00:35:01.920
That's funny.

00:35:01.920 --> 00:35:06.840
And Mo and, Joe out there says, I wonder what it says for day one of Python.

00:35:06.840 --> 00:35:10.840
I have no idea, but somebody had Copilot installed.

00:35:10.840 --> 00:35:11.680
They should let us know.

00:35:11.680 --> 00:35:14.060
And what maybe we'll point it out next time.

00:35:14.060 --> 00:35:15.080
Yeah.

00:35:15.080 --> 00:35:16.380
Interesting.

00:35:16.380 --> 00:35:17.920
I haven't turned it on, but.

00:35:17.920 --> 00:35:19.260
No, I haven't either.

00:35:19.260 --> 00:35:19.920
All right.

00:35:19.920 --> 00:35:20.320
All right.

00:35:20.320 --> 00:35:20.620
Well, thanks.

00:35:20.620 --> 00:35:21.500
Apparently many people do.

00:35:21.500 --> 00:35:22.540
And I really enjoy it.

00:35:22.540 --> 00:35:25.080
Like the usage numbers are kind of off the chart.

00:35:25.080 --> 00:35:31.820
Well, so yeah, I'll just say one of the people used to not like maintaining software written

00:35:31.820 --> 00:35:32.340
by others.

00:35:32.340 --> 00:35:35.200
And they mostly like writing green field code.

00:35:35.200 --> 00:35:38.480
But with Copilot, you don't have to write your first draft.

00:35:38.480 --> 00:35:43.800
You can, you can just become a permanent maintainer of software written by something.

00:35:43.800 --> 00:35:44.100
Exactly.

00:35:44.480 --> 00:35:47.280
I wrote the bullet points and now I maintain what the AI wrote.

00:35:47.280 --> 00:35:47.600
Fantastic.

00:35:47.600 --> 00:35:48.460
Exactly.

00:35:48.460 --> 00:35:50.540
Hope you understand it.

00:35:50.540 --> 00:35:51.920
Yeah, exactly.

00:35:51.920 --> 00:35:58.140
But anyway, well, thanks a lot for a great day again or a great episode.

00:35:58.140 --> 00:35:58.860
Absolutely.

00:35:58.860 --> 00:35:59.640
Thank you.

00:35:59.640 --> 00:36:00.320
See y'all later.

