WEBVTT

00:00:00.001 --> 00:00:04.660
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:00:04.660 --> 00:00:09.580
This is episode 328, recorded March 21st, 2023.

00:00:09.580 --> 00:00:10.480
I'm Michael Kennedy.

00:00:10.480 --> 00:00:11.780
And I am Brian Okken.

00:00:11.780 --> 00:00:14.960
And this episode is brought to you by Microsoft for Startups Founders Hub.

00:00:14.960 --> 00:00:17.840
We have a really fun one for you again this time.

00:00:17.840 --> 00:00:19.920
Something different, so be sure to check that out.

00:00:19.920 --> 00:00:22.240
Connect with us over on Mastodon.

00:00:22.240 --> 00:00:24.400
All of the links are in the show notes.

00:00:24.400 --> 00:00:29.160
And if you are not hearing our voice at this moment live because you're part of the live stream,

00:00:29.440 --> 00:00:31.960
be sure to visit pythonbytes.fm/live.

00:00:31.960 --> 00:00:35.400
Sign up to get notified about the live streams and be part of it every now and then.

00:00:35.400 --> 00:00:35.960
It's a lot of fun.

00:00:35.960 --> 00:00:40.440
Speaking of fun, Brian, share with us this first thing you've discovered.

00:00:40.440 --> 00:00:44.000
I actually, I wanted to talk about ZipApp.

00:00:44.000 --> 00:00:45.860
Did you know about ZipApp?

00:00:45.860 --> 00:00:50.920
I have never seen ZipApp in accent, but I have heard of ZipApp.

00:00:50.920 --> 00:00:53.200
And it is a very interesting idea.

00:00:53.200 --> 00:00:55.380
New in 3.5, so it's not that old, is it?

00:00:55.380 --> 00:00:56.760
3.5 still sounds new to me.

00:00:56.760 --> 00:00:58.260
I don't care what people say about dates.

00:00:58.880 --> 00:00:59.180
Really?

00:00:59.180 --> 00:01:01.020
It sounds new to me.

00:01:01.020 --> 00:01:02.780
It has async and await.

00:01:02.780 --> 00:01:09.800
And that's the first point where I feel like it's kind of as far back as you can go and still be modern Python.

00:01:09.800 --> 00:01:10.360
Okay.

00:01:10.360 --> 00:01:11.240
I think.

00:01:11.240 --> 00:01:12.740
Don't get f-strings, but come on.

00:01:12.740 --> 00:01:13.780
Still, it's not that old.

00:01:13.780 --> 00:01:15.300
It's not something that's better.

00:01:15.300 --> 00:01:17.360
You're more lenient than I am.

00:01:17.360 --> 00:01:19.920
I'm like a 3.7 is the start of the world.

00:01:19.920 --> 00:01:21.340
But anyway.

00:01:21.440 --> 00:01:21.620
Okay.

00:01:21.620 --> 00:01:23.900
So ZipApp, it's been around for a while.

00:01:23.900 --> 00:01:26.440
So all supported Pythons use it, right?

00:01:26.440 --> 00:01:34.740
So and but apparently there was like a flub up in the announcement when it came out.

00:01:34.740 --> 00:01:37.060
So people didn't quite see it when it came out.

00:01:37.060 --> 00:01:37.900
So it's anyway.

00:01:37.900 --> 00:01:40.600
So what it is, it's in the standard library.

00:01:40.600 --> 00:01:47.160
And it's a module that provides tools to managing the creation of zip files containing Python code.

00:01:47.560 --> 00:01:52.020
And they can be directly interpreted by the Python interpreter.

00:01:52.020 --> 00:01:54.440
So it's a command line interface and an API.

00:01:54.440 --> 00:02:01.000
But the deal is you kind of take like a package or Python package you got or a file or whatever.

00:02:01.000 --> 00:02:03.880
And it creates an executable for you.

00:02:03.880 --> 00:02:08.140
Well, it's not really an executable because it doesn't have the Python part.

00:02:08.140 --> 00:02:09.820
So you still have to run it with Python.

00:02:09.820 --> 00:02:11.940
But it includes all the stuff except for Python.

00:02:12.340 --> 00:02:16.700
It's kind of like if you could hand out just a Python script and say run this.

00:02:16.700 --> 00:02:19.420
But it has dependencies and it has a lot of structure.

00:02:19.420 --> 00:02:22.520
But you don't have to make people deal with that, right?

00:02:22.520 --> 00:02:27.940
You don't have to have them create virtual environments and install stuff because it can all just take the stuff it needs.

00:02:27.940 --> 00:02:30.580
I haven't played with it enough to know if it has.

00:02:30.580 --> 00:02:31.040
Oh, yeah.

00:02:31.040 --> 00:02:32.280
It has requirements too.

00:02:32.280 --> 00:02:36.780
Install all of your applications dependencies in the app directory using pip.

00:02:36.780 --> 00:02:40.500
So, yeah, so there's like a there's a thing.

00:02:40.500 --> 00:02:46.380
There's like a tutorial inside the documentation saying how to create a standalone application with zip app.

00:02:46.380 --> 00:02:48.580
So, yes, it includes your your dependencies.

00:02:48.580 --> 00:02:50.500
And then you just create this little thing.

00:02:50.500 --> 00:02:57.080
So you can say you can give it to somebody and say run this on Python 5 or, you know, or whatever you support.

00:02:57.080 --> 00:02:58.680
And that's pretty cool.

00:02:58.680 --> 00:03:00.500
It's got all that all bundled in.

00:03:00.500 --> 00:03:04.760
I haven't tried this yet, but I didn't even know this was here until recently.

00:03:04.760 --> 00:03:08.860
Brett Cannon mentioned PYZ files.

00:03:08.860 --> 00:03:11.340
And I'm like, what the heck is a PYZ file?

00:03:11.340 --> 00:03:12.740
And I looked it up.

00:03:12.740 --> 00:03:15.940
It's these Python zip app things.

00:03:15.940 --> 00:03:17.620
So interesting.

00:03:17.620 --> 00:03:18.700
Pretty neat.

00:03:18.700 --> 00:03:20.100
There's some examples in there.

00:03:20.100 --> 00:03:25.860
So, yeah, that's just I guess it's just if anybody was trying to think of some way,

00:03:25.860 --> 00:03:31.920
because we have talked about like lightweight ways to ship stuff to Python stuff to people.

00:03:31.920 --> 00:03:37.340
And I think it's fine to tell people to assume that most I mean, depending on your audience.

00:03:37.340 --> 00:03:41.340
But there's a lot of people that it's fine to say it's it's running Python.

00:03:41.340 --> 00:03:42.780
So you have to install Python.

00:03:42.780 --> 00:03:48.660
But then and it's easy to send a file, but sending a bunch of stuff is a little bit harder.

00:03:48.660 --> 00:03:52.840
I mean, you could if they're if they're developers, you can say, here's the repo.

00:03:53.040 --> 00:03:54.720
Just download it, install requirements.

00:03:54.720 --> 00:03:55.860
And there you go.

00:03:55.860 --> 00:03:58.760
But for a lot for a lot of people, that's a little too much.

00:03:58.760 --> 00:03:59.760
So this is kind of neat.

00:03:59.760 --> 00:04:07.100
The other use case that I think is a really cool one that I've seen is using it within CI CD pipeline.

00:04:07.100 --> 00:04:10.420
So if you have a stage that's that you want to you.

00:04:10.420 --> 00:04:13.020
All you're doing is pulling stuff in and running it anyway.

00:04:13.020 --> 00:04:15.200
Might as well just have it all zipped up already.

00:04:15.200 --> 00:04:16.400
So, yeah, it's cool.

00:04:16.400 --> 00:04:16.660
Cool.

00:04:16.660 --> 00:04:17.680
Yeah, it's super cool.

00:04:17.680 --> 00:04:19.160
Just a quick one.

00:04:19.160 --> 00:04:19.520
Yeah.

00:04:19.520 --> 00:04:22.920
Henry on the audience says Python can run zip apps files directly.

00:04:22.920 --> 00:04:26.340
PYZ files has been supported since well before 3.5.

00:04:26.340 --> 00:04:28.020
3.5 just makes it easier to do.

00:04:28.020 --> 00:04:28.740
Oh, really?

00:04:28.740 --> 00:04:29.180
OK.

00:04:29.180 --> 00:04:29.720
Yeah.

00:04:29.720 --> 00:04:30.540
Apparently.

00:04:30.540 --> 00:04:32.060
Yeah, I thought that that was true.

00:04:32.060 --> 00:04:33.820
But yeah, the zip app is really cool.

00:04:33.820 --> 00:04:34.320
Neat.

00:04:34.320 --> 00:04:34.980
Indeed.

00:04:34.980 --> 00:04:35.580
Cool.

00:04:35.580 --> 00:04:37.740
So, well, what do you have for us?

00:04:37.880 --> 00:04:46.780
I want to tell you all about maybe a use case or a story of like how you can just take Python and solve your own interesting little problems.

00:04:46.780 --> 00:04:56.880
So this comes unknowingly through Rhett Turnbull, who shared a blog post in sort of an interesting circular way over on Mastodon.

00:04:56.880 --> 00:05:03.820
It says, great blog post from EQ on reverse engineering the Apple News app with Python and nerd power.

00:05:04.180 --> 00:05:05.140
That sounds fun, right?

00:05:05.140 --> 00:05:05.700
Mm-hmm.

00:05:05.700 --> 00:05:08.140
So this is an article that you can check out.

00:05:08.140 --> 00:05:15.780
And basically it says, look, one way that's awesome to do a bunch of research and gather up a bunch of news is Apple News.

00:05:15.780 --> 00:05:18.460
And there's a way in Apple News to say read later.

00:05:18.460 --> 00:05:24.700
But because it's Apple News, it's like tries as much as possible to keep you within its little walled garden of Apple News.

00:05:24.860 --> 00:05:28.260
For example, if you share it with somebody, it doesn't share the original link.

00:05:28.260 --> 00:05:29.540
It shares the Apple News link.

00:05:29.540 --> 00:05:34.780
And, you know, if you want to access those links outside of the Apple News app, well, nope, you don't get that, right?

00:05:34.780 --> 00:05:43.320
And so this EQ person, who is the nickname or online name of Dave Bullock, says, let's see.

00:05:43.320 --> 00:05:45.420
I reached out to Rhett Turnbull.

00:05:45.420 --> 00:05:56.260
Here's the circular bit about his OXX or macOS photos Python library that he had been using to extract data from photos, which have a similar issue.

00:05:56.260 --> 00:06:02.100
And says, you seem to be familiar with like ripping stuff out of the internal of these macOS apps.

00:06:02.440 --> 00:06:03.500
What about this one?

00:06:03.500 --> 00:06:14.120
And it got a few hints and turned out that I was able to pull in some information to actually get the Apple News link out of a list of saved relator things hidden somewhere.

00:06:14.120 --> 00:06:21.560
And then goes through using Python to actually Python plus beautiful soup to pull that out into something that is meaningful.

00:06:21.560 --> 00:06:24.640
And you can actually share with folks, which is pretty cool.

00:06:24.640 --> 00:06:28.520
And then it said, well, I shared this back with Rhett and Rhett's like, oh, that's awesome.

00:06:28.800 --> 00:06:34.480
How about I create a whole CLI library that lets people do that and stash it into a SQLite one?

00:06:34.480 --> 00:06:38.720
And then who knows, maybe you connect that to dataset from Simon Willison.

00:06:38.720 --> 00:06:41.060
And, you know, like it just it can just go from there.

00:06:41.060 --> 00:06:45.740
So there's Apple News to SQLite as a CLI that came out of this whole journey.

00:06:45.740 --> 00:06:54.040
But I just thought it was a really cool use case of like, look, you don't need to be trying to create the next major API service or the major web app.

00:06:54.040 --> 00:06:56.200
Here's just a fun way to like, I've got this problem.

00:06:56.200 --> 00:06:59.900
I've got the structured data and maybe Python can solve my problem here.

00:06:59.900 --> 00:07:01.340
Yeah, usually can.

00:07:01.340 --> 00:07:01.800
Yeah.

00:07:01.800 --> 00:07:03.240
Anyway, a lot of fun.

00:07:03.240 --> 00:07:04.160
People can check this out.

00:07:04.200 --> 00:07:13.900
And I think if you're looking for ways to get better with Python or practice with Python or do interesting little projects, maybe this will inspire you because it's it's not a ton of work for this.

00:07:13.900 --> 00:07:14.080
Right.

00:07:14.080 --> 00:07:14.540
Yeah.

00:07:14.540 --> 00:07:16.400
We need nerd power t-shirts.

00:07:16.400 --> 00:07:17.280
Nerd power.

00:07:17.280 --> 00:07:17.900
I think.

00:07:17.900 --> 00:07:18.260
Nerd.

00:07:18.260 --> 00:07:19.280
Oh, yes.

00:07:19.600 --> 00:07:25.040
I got some t-shirt stuff to share with you at the end as part of our joke.

00:07:25.040 --> 00:07:27.420
So I don't know if there's a nerd power one out there.

00:07:27.420 --> 00:07:28.840
Just real quickly on the audience.

00:07:28.840 --> 00:07:35.700
Fabio asks, a while ago, I talked about a testing a paid search engine that was Kagi that I've been using.

00:07:35.700 --> 00:07:36.680
I'm still using Kagi.

00:07:36.680 --> 00:07:38.620
I've been enjoying Kagi a lot.

00:07:38.620 --> 00:07:39.600
So that's the one.

00:07:39.600 --> 00:07:43.460
Brian, we ready to tell folks about our sponsor before we move on?

00:07:43.460 --> 00:07:44.720
I think that's a good idea.

00:07:44.720 --> 00:07:45.920
I do as well.

00:07:45.920 --> 00:07:49.000
And as promised, I got something fun for you this time.

00:07:49.000 --> 00:07:52.360
So remember, this one is brought to you by Microsoft for Startup Founders Hub.

00:07:52.360 --> 00:08:00.140
One of the really important things you get is access to the open access and credits to the OpenAI APIs and the Azure OpenAI service.

00:08:00.140 --> 00:08:05.900
So I said, hey, let's take the boring or in the straightforward ad that we had written originally.

00:08:05.900 --> 00:08:08.760
And I asked OpenAI to rewrite it.

00:08:08.760 --> 00:08:15.340
So I said, hey, OpenAI, can you rewrite the Founders Hub ad as an American football coach trying to motivate his team?

00:08:15.340 --> 00:08:16.780
So where do we get back?

00:08:16.780 --> 00:08:18.300
Attention all startup founders.

00:08:18.480 --> 00:08:19.540
This is a call to action.

00:08:19.540 --> 00:08:21.280
Are you ready to reach the next level?

00:08:21.280 --> 00:08:21.940
Then listen up.

00:08:21.940 --> 00:08:29.420
Microsoft for Startup Founders Hub is offering a rare opportunity, a chance to get in the game with OpenAI APIs and Azure OpenAI service.

00:08:29.420 --> 00:08:33.760
These tools that will take you to new heights with the power of generative AI at your fingertips.

00:08:34.300 --> 00:08:35.300
But it's not just the technology.

00:08:35.300 --> 00:08:35.880
But it's not just the technology.

00:08:35.880 --> 00:08:36.820
It's the support system.

00:08:36.820 --> 00:08:41.920
You get $150,000 in Azure credits and the richest deal from any cloud provider.

00:08:41.920 --> 00:08:44.020
And tech support, man, it's top notch.

00:08:44.020 --> 00:08:46.240
The team at Microsoft will give you guidance.

00:08:46.240 --> 00:08:49.960
The guidance you need to make the big plays with one-on-one technical advisory.

00:08:50.520 --> 00:08:56.980
And you'll get a network of mentors, seasoned players in the startup world who will be out there to help you navigate the field and make the tough calls.

00:08:56.980 --> 00:09:00.460
You'll get expert help on product fundraising, go-to-market, and more.

00:09:00.460 --> 00:09:03.780
This is your chance, startup founders, to get in the game and make a big impact.

00:09:03.780 --> 00:09:07.820
There's no funding requirement whether you're in idea phase or further along.

00:09:08.080 --> 00:09:11.680
All you do is sign up and get ready to unleash the power of AI in your startup.

00:09:11.680 --> 00:09:12.760
So what are you waiting for?

00:09:12.760 --> 00:09:18.160
Head over to pythonbytes.fm/foundershub 2022 and join Microsoft for Startups Founders Hub today.

00:09:18.160 --> 00:09:19.020
The time is now.

00:09:19.020 --> 00:09:19.800
The game is on.

00:09:19.800 --> 00:09:21.420
You've got the tools you need to succeed.

00:09:21.420 --> 00:09:21.860
Yeah.

00:09:21.860 --> 00:09:27.560
Thank you, Microsoft for Startups, for sponsoring the show and OpenAI for bringing home the championship.

00:09:27.560 --> 00:09:28.260
There we go.

00:09:28.260 --> 00:09:29.220
Nice.

00:09:29.220 --> 00:09:30.240
That's fun, right?

00:09:30.240 --> 00:09:31.200
That's good.

00:09:31.200 --> 00:09:31.800
Yeah.

00:09:31.800 --> 00:09:32.420
Love it.

00:09:32.420 --> 00:09:32.920
Okay.

00:09:32.920 --> 00:09:34.540
I also love context managers.

00:09:34.540 --> 00:09:34.920
How about you?

00:09:34.920 --> 00:09:42.180
I do, but just an interesting suggestion from the audience of would it be different if Ted Lasso wrote it?

00:09:42.180 --> 00:09:43.120
Oh, I bet it would.

00:09:43.120 --> 00:09:45.500
Well, you know, there's always next week.

00:09:45.500 --> 00:09:48.040
Yeah.

00:09:48.040 --> 00:09:50.620
So let's talk about context managers.

00:09:50.620 --> 00:10:01.100
So I have used, I love context managers, and I've used context lib, context manager decorator to create context managers.

00:10:01.100 --> 00:10:07.580
And if you've never tried it, it's like the easiest way to make a context manager.

00:10:07.580 --> 00:10:16.480
With context manager, you decorate a function with the decorator context manager, and then you put a yield in the middle of it or anywhere in it.

00:10:16.480 --> 00:10:17.380
It can even loop.

00:10:17.380 --> 00:10:19.420
Wait, maybe it can't loop.

00:10:19.420 --> 00:10:20.540
No, that's something else.

00:10:20.540 --> 00:10:21.900
That's a generator.

00:10:22.520 --> 00:10:30.440
No, context manager, you put a yield in it, but it can be in the middle of like an exception block or tri-accept or something else.

00:10:30.440 --> 00:10:36.560
And then, so it runs the first part, and then after the width block, it tears it down with the teardown.

00:10:36.560 --> 00:10:37.220
It's nice.

00:10:37.220 --> 00:10:41.580
I knew about this, but then I was reading an article from Trey Hunter.

00:10:41.580 --> 00:10:43.940
What is a context manager?

00:10:43.940 --> 00:10:48.280
And it's actually a really kind of nice article that talks about all the stuff.

00:10:48.280 --> 00:10:53.080
Basically, if you didn't have it, so first off, it tells you what a context manager is.

00:10:53.080 --> 00:10:57.880
And one of the ones that people are most familiar with maybe is open file as F.

00:10:57.880 --> 00:11:04.660
So with open file as F or any with block, you're using a context manager, right?

00:11:04.660 --> 00:11:08.040
So opening file is great because then it closes afterwards.

00:11:08.840 --> 00:11:12.380
And then he talks through some things.

00:11:12.380 --> 00:11:16.940
One of the next example he brings up is context lib change dir.

00:11:16.940 --> 00:11:25.220
And I don't know how I didn't know this was here, but what it does is if you use with change dir, it changes your directory.

00:11:25.220 --> 00:11:28.260
But then when you're done with the width block, it goes back.

00:11:28.260 --> 00:11:29.300
Cool.

00:11:29.300 --> 00:11:30.380
Somehow I missed that.

00:11:30.380 --> 00:11:33.240
So I was going in and looking, and there's a whole bunch of other stuff.

00:11:33.240 --> 00:11:36.720
So I did know about closing.

00:11:37.340 --> 00:11:50.020
So like the file open thing, you can anything that has a close statement in it, you can use the context manager closing to use like for line and page.

00:11:50.020 --> 00:11:50.500
Wait.

00:11:50.500 --> 00:11:59.360
With closing URL open as an example, because then when you're done for URL lib, it closes it.

00:11:59.360 --> 00:12:03.280
So anything that has a, you have to do a close command afterwards, you can use closing.

00:12:03.560 --> 00:12:04.360
That's cool.

00:12:04.360 --> 00:12:07.260
But there's a, there's async closing also.

00:12:07.260 --> 00:12:07.800
Cool.

00:12:07.800 --> 00:12:09.320
There's a bunch.

00:12:09.320 --> 00:12:10.160
There's suppress.

00:12:10.160 --> 00:12:17.860
So if for a part of your code, you want to suppress a particular possible exception, you can suppress it for a little bit of your code.

00:12:17.860 --> 00:12:18.940
Super handy.

00:12:18.940 --> 00:12:23.760
Redirect standard out, but just for a little while, you can do that.

00:12:23.840 --> 00:12:27.980
Just there's, and then in really extended error.

00:12:27.980 --> 00:12:30.840
And then there's, there's our changed error, but there's a bunch of stuff in here.

00:12:30.840 --> 00:12:37.200
So I guess I encourage people to go through the, go look at the context lib and look at some of the stuff you can do.

00:12:37.200 --> 00:12:39.080
Cause there's a lot of great stuff there.

00:12:39.080 --> 00:12:39.840
So neat.

00:12:39.840 --> 00:12:40.840
That is really neat.

00:12:40.840 --> 00:12:42.880
I am a huge fan of these types of things.

00:12:42.880 --> 00:12:44.220
And hold on, don't scroll anymore.

00:12:44.220 --> 00:12:46.880
Do you see when a changed or came into existence?

00:12:46.880 --> 00:12:48.340
3.11.

00:12:48.340 --> 00:12:49.380
3.11.

00:12:49.840 --> 00:12:51.360
That might be why we don't know about it.

00:12:51.360 --> 00:12:52.100
Cause that's brand new.

00:12:52.100 --> 00:12:52.740
Yeah.

00:12:52.740 --> 00:12:53.820
Nice.

00:12:53.820 --> 00:12:58.940
But I love these types of things we say for this block of code, I want something to be true.

00:12:58.940 --> 00:13:01.560
And then afterwards, I don't want to think about how it happens.

00:13:01.560 --> 00:13:05.140
Like however I get out of here, early return, exception, done, whatever.

00:13:05.140 --> 00:13:06.900
Just undo the thing.

00:13:06.900 --> 00:13:07.600
Yeah.

00:13:07.600 --> 00:13:08.720
Really, really nice.

00:13:08.720 --> 00:13:16.880
I use some of these, I mean, not, I don't know of a built-in one for this, but that with colorama to say during this section, I want all the output to be this color.

00:13:16.880 --> 00:13:22.020
And then no matter how I leave, roll it back, the default for like text output and things like that.

00:13:22.020 --> 00:13:22.280
Right.

00:13:22.280 --> 00:13:23.420
Oh, neat.

00:13:23.420 --> 00:13:24.880
Otherwise you got to keep resetting.

00:13:24.880 --> 00:13:25.620
Like, oh, I'm returning here.

00:13:25.620 --> 00:13:27.020
So I got to reset here and here.

00:13:27.020 --> 00:13:28.060
And it's just like, nope.

00:13:28.060 --> 00:13:29.560
In this block, it's blue.

00:13:29.560 --> 00:13:30.620
Now it's not blue.

00:13:30.620 --> 00:13:31.040
Right.

00:13:31.040 --> 00:13:31.880
Those kinds of things.

00:13:31.880 --> 00:13:32.680
I just love it.

00:13:32.680 --> 00:13:35.860
So having these built in, I didn't realize there are so many built in.

00:13:35.860 --> 00:13:36.300
This is great.

00:13:36.300 --> 00:13:36.720
Yeah.

00:13:36.720 --> 00:13:38.280
That's a cool use case.

00:13:38.280 --> 00:13:39.000
I like that.

00:13:39.000 --> 00:13:39.540
Yeah.

00:13:39.540 --> 00:13:40.220
Thanks.

00:13:40.220 --> 00:13:41.360
Indeed.

00:13:41.360 --> 00:13:41.640
Indeed.

00:13:41.640 --> 00:13:41.800
Indeed.

00:13:41.800 --> 00:13:49.040
So this next item here that I got for us, Brian, this is a follow-up to a question.

00:13:49.040 --> 00:13:53.440
When you talked about Knox, somebody asked, can I use that with poetry?

00:13:53.440 --> 00:13:56.880
And we didn't know for sure, but you can bet the audience knows.

00:13:56.880 --> 00:13:57.400
Yeah.

00:13:58.180 --> 00:13:58.660
Yeah.

00:13:58.660 --> 00:14:05.280
So yes, in fact, there is a Knox-poetry library that you can use.

00:14:05.280 --> 00:14:07.040
And it's super simple.

00:14:07.040 --> 00:14:12.960
So the way Knox works, quick reminder for folks who maybe didn't listen or didn't listen that

00:14:12.960 --> 00:14:17.120
closely or just forgot from last week is you create a session for some operation.

00:14:17.120 --> 00:14:20.860
And you say, this session is going to run Python 3.10 or 3.9 together.

00:14:20.860 --> 00:14:21.120
Right.

00:14:21.340 --> 00:14:23.680
And then you just say, session install what you need to.

00:14:23.680 --> 00:14:29.540
For example, here, the example on this page says, install pytest and install the local package

00:14:29.540 --> 00:14:31.820
that you're working with plus its dependencies.

00:14:31.820 --> 00:14:33.500
And then run pytest.

00:14:33.500 --> 00:14:35.740
The problem was, there's a couple issues.

00:14:35.740 --> 00:14:44.060
If you don't have something that understands poetry, then you end up, the package with just

00:14:44.060 --> 00:14:47.960
the wheel metadata and not the lock file gets installed, which means you don't get the

00:14:47.960 --> 00:14:53.060
pinned versions installed that you're hoping for, the dependency constraints that you're

00:14:53.060 --> 00:14:53.600
hoping for.

00:14:53.600 --> 00:14:55.800
You just get whatever the latest of those are.

00:14:55.800 --> 00:14:58.220
pytest wouldn't be constrained.

00:14:58.220 --> 00:15:02.160
Poetry would be installed as a build backend every time.

00:15:02.160 --> 00:15:04.340
There's just a bunch of stuff that's a little bit lumsier.

00:15:04.340 --> 00:15:10.000
So what you get here is you basically get a library that you say, sort of from Knox import

00:15:10.000 --> 00:15:12.460
session, you say from Knox poetry import session.

00:15:12.460 --> 00:15:18.200
And this is a wrapper proxy to the underlying Knox session that configures things to make

00:15:18.200 --> 00:15:19.140
sure that poetry works.

00:15:19.140 --> 00:15:24.880
So for example, the install will use the lock file that poetry uses and other types of things.

00:15:24.880 --> 00:15:25.600
There's a bunch of stuff.

00:15:25.600 --> 00:15:27.840
It'll build the wheel from the local package.

00:15:27.840 --> 00:15:33.220
It'll install the wheel as a pytest package and then invoke pytest to run the test against

00:15:33.220 --> 00:15:33.980
that installation.

00:15:33.980 --> 00:15:34.860
That's pretty cool.

00:15:35.180 --> 00:15:40.280
So it also has some other types of things that you can put on it here.

00:15:40.280 --> 00:15:41.020
Where do they go?

00:15:41.020 --> 00:15:43.460
There's a bunch of poetry specific things.

00:15:43.460 --> 00:15:45.280
You can say session dot poetry dot.

00:15:45.280 --> 00:15:46.560
There it is.

00:15:46.560 --> 00:15:52.500
Like session dot poetry dot install root or session dot poetry dot build package as a wheel

00:15:52.500 --> 00:15:54.320
or a disk and export requirements.

00:15:54.320 --> 00:15:55.160
All these different things.

00:15:55.160 --> 00:15:59.640
If you want to leverage the fact that it is actually poetry or you can just use this wrapper

00:15:59.640 --> 00:16:03.220
and write exactly the same code, but it now works correctly with your project.

00:16:03.640 --> 00:16:04.000
Oh, nice.

00:16:04.000 --> 00:16:04.460
Yeah.

00:16:04.460 --> 00:16:04.800
I like it.

00:16:04.800 --> 00:16:11.300
This is from, came to us from not one, but two people said, hey, you guys, John Hagen and

00:16:11.300 --> 00:16:12.040
Mark Pruitt.

00:16:12.040 --> 00:16:15.700
So thank you both for sending in your particular use cases for that.

00:16:15.700 --> 00:16:25.420
And it also comes to us from Claudio Jolowitz, who created the hyper modern Python project cookie

00:16:25.420 --> 00:16:25.700
cutter.

00:16:25.700 --> 00:16:28.400
And this is part of that to support that project.

00:16:28.400 --> 00:16:33.120
I actually had him on Python a little while ago, back in about a year ago.

00:16:33.340 --> 00:16:35.020
Do you want to hear way more about this?

00:16:35.020 --> 00:16:38.100
We probably even talked about this in passing and I was like, oh, okay.

00:16:38.100 --> 00:16:38.460
Interesting.

00:16:38.460 --> 00:16:39.380
Like didn't really.

00:16:39.380 --> 00:16:42.140
So yeah, there it is.

00:16:42.140 --> 00:16:46.220
We hear so many things like sometimes, you know, it doesn't always stick the first time,

00:16:46.220 --> 00:16:46.860
even though we try.

00:16:46.860 --> 00:16:48.320
Yeah, that happens.

00:16:48.320 --> 00:16:49.200
It does happen.

00:16:49.200 --> 00:16:49.900
All right.

00:16:49.900 --> 00:16:54.120
And it also happens that we are at the end of our main topics, but you got any extras you

00:16:54.120 --> 00:16:54.440
want to share?

00:16:54.440 --> 00:16:55.140
I do.

00:16:55.240 --> 00:16:59.080
And it kind of talks about it's a little bit similar to what we're just talking about.

00:16:59.080 --> 00:17:01.480
So I was just at Pike Cascades this weekend.

00:17:01.480 --> 00:17:03.700
This last weekend just got back.

00:17:03.700 --> 00:17:05.080
I took the train back yesterday.

00:17:05.080 --> 00:17:06.440
It's a lovely ride.

00:17:06.440 --> 00:17:06.580
How was the train ride?

00:17:06.580 --> 00:17:07.560
Did you enjoy it?

00:17:07.640 --> 00:17:09.480
Well, I did on the way back.

00:17:09.480 --> 00:17:14.360
On the way there, I kind of thought I would be able to sleep, but I didn't.

00:17:14.360 --> 00:17:15.320
I wasn't able to.

00:17:15.320 --> 00:17:20.920
So on the way back, it's a nine hour drive or nine hour train ride from eight or nine from

00:17:20.920 --> 00:17:22.000
here to Vancouver.

00:17:22.500 --> 00:17:24.360
On the way back, I'm like, I'll just work.

00:17:24.360 --> 00:17:27.540
So I just edited a bunch of audio.

00:17:27.540 --> 00:17:29.620
So I was working the whole way back.

00:17:29.620 --> 00:17:30.020
It's great.

00:17:30.020 --> 00:17:36.500
But one of the things that happened to me there was a couple of people saying, oh, yeah, we

00:17:36.500 --> 00:17:36.800
met.

00:17:36.800 --> 00:17:41.980
I was at, you know, I was at Picon, Portland or Ohio or something like that.

00:17:41.980 --> 00:17:42.400
We met.

00:17:42.400 --> 00:17:43.640
I'm like, that's wonderful.

00:17:43.640 --> 00:17:46.380
I meet so many people and I have such a bad memory.

00:17:46.380 --> 00:17:50.640
I mean, I trust and I don't I feel bad about not remembering everybody I ran into.

00:17:50.640 --> 00:17:56.220
Anyway, I'm sorry if I if I said hi and introduced myself and you already we already have done

00:17:56.220 --> 00:17:56.460
that.

00:17:56.460 --> 00:17:57.060
My apologies.

00:17:57.060 --> 00:17:57.920
I'm bad at it.

00:17:57.920 --> 00:17:59.440
It's not ideal.

00:17:59.440 --> 00:18:01.200
It's also not personal.

00:18:01.200 --> 00:18:02.560
People sometimes take it personally.

00:18:02.560 --> 00:18:05.300
It's like, well, it's really hard when you meet 400 people.

00:18:05.300 --> 00:18:05.800
Yeah.

00:18:05.800 --> 00:18:09.100
And then also the questions of you talked about this one thing.

00:18:09.100 --> 00:18:10.040
It was kind of like that.

00:18:10.040 --> 00:18:10.940
What was that again?

00:18:10.940 --> 00:18:12.720
Like, sorry.

00:18:12.720 --> 00:18:16.440
That's why I have Google or search or whatever.

00:18:16.440 --> 00:18:19.080
So I did give a talk and it's great.

00:18:19.080 --> 00:18:25.560
The the slides are up at Python test dot com slash I cascades 2023.

00:18:25.560 --> 00:18:28.600
And there are they are going to chop up the videos.

00:18:28.600 --> 00:18:31.640
And I think that's what they've told me that they're going to chop up the videos.

00:18:31.640 --> 00:18:33.860
But for now, the day one and day two is available.

00:18:33.860 --> 00:18:38.820
If you really want to watch mine, it's about sharing pytest figure fixtures.

00:18:39.820 --> 00:18:47.140
It's at what hour 22 hours, 40 minutes, 58 seconds approximately on day two.

00:18:47.140 --> 00:18:50.480
But that exact link is in our show notes as well.

00:18:50.480 --> 00:18:54.660
If you want to click through and watch 25 minutes of me talking about packaging.

00:18:54.660 --> 00:18:56.700
So it was really fun.

00:18:56.700 --> 00:18:57.800
I had a good time.

00:18:58.200 --> 00:18:59.960
Do you have any extras?

00:18:59.960 --> 00:19:02.340
Today is talk Python's birthday.

00:19:02.340 --> 00:19:04.260
I believe you got to do math.

00:19:04.260 --> 00:19:06.620
I think it's eight years old, which is nuts.

00:19:06.620 --> 00:19:07.640
It's either seven or eight.

00:19:07.640 --> 00:19:08.660
That's nuts.

00:19:08.660 --> 00:19:14.340
But the reason I thought of that is the latest episode right now is Python tips and tricks for better testing.

00:19:14.340 --> 00:19:17.060
That also brings into some of the stuff that you talked about your talk.

00:19:17.060 --> 00:19:21.580
So if people are interested, they should check out this episode and they can see a cool hat.

00:19:21.720 --> 00:19:22.160
Nice.

00:19:22.160 --> 00:19:24.500
Cool.

00:19:24.500 --> 00:19:25.080
All right.

00:19:25.080 --> 00:19:28.640
That's not what I was planning on sharing, but yeah, it ties right in there.

00:19:28.640 --> 00:19:32.180
Now, what I wanted to share was one thing.

00:19:32.180 --> 00:19:36.520
So let me tell you about my router challenges here.

00:19:36.520 --> 00:19:39.920
So at my, as you know, Brian, but probably almost no one else does.

00:19:39.920 --> 00:19:42.060
I have my office above my garage.

00:19:42.060 --> 00:19:48.240
My garage is a separate building from my house and there's no Ethernet connecting this as much as I've tried to make that happen.

00:19:48.240 --> 00:19:49.420
I haven't been able to make it happen.

00:19:49.420 --> 00:19:52.560
So I'm like, well, how do I make this faster?

00:19:52.560 --> 00:19:56.080
I've been using a two node mesh network.

00:19:56.080 --> 00:19:59.920
And it turns out that people getting stuff around us have been causing a lot of interference.

00:19:59.920 --> 00:20:04.380
And so my wife needs one closer to her office and I need one closer to mine.

00:20:04.380 --> 00:20:05.760
And one's got to be plugged into the internet.

00:20:05.760 --> 00:20:08.840
And we were like kind of like disagreeing.

00:20:08.840 --> 00:20:10.000
Like I want it closer to my office.

00:20:10.000 --> 00:20:10.760
No closer to mine.

00:20:10.760 --> 00:20:11.780
Mine's a separate building.

00:20:11.780 --> 00:20:12.320
I need more.

00:20:12.320 --> 00:20:12.540
Right.

00:20:12.540 --> 00:20:14.540
And, and back and forth.

00:20:14.540 --> 00:20:17.560
And so I ended up solving this with too much money.

00:20:17.560 --> 00:20:22.060
I'm getting this thing called the Atlas Max 6E length this router.

00:20:22.060 --> 00:20:31.140
I don't know if I recommend it because it's really expensive, but it's one of the few things that both has three nodes and it's 6E Wi-Fi, not just Wi-Fi 6.

00:20:31.480 --> 00:20:31.640
Right.

00:20:31.640 --> 00:20:32.640
Good combo.

00:20:32.640 --> 00:20:34.480
So this is not really my recommendation.

00:20:34.480 --> 00:20:35.420
What I want to tell you about.

00:20:35.420 --> 00:20:45.780
My recommendation is I've always considered these mesh network things to be like, well, if I'm on Wi-Fi and that talks to one of the nodes and then the node talks to the main node at the house.

00:20:45.780 --> 00:20:47.740
That's, that's just as good.

00:20:47.820 --> 00:20:51.580
Like why would I ever say plug in ethernet to the secondary node, right?

00:20:51.580 --> 00:20:52.480
Still Wi-Fi.

00:20:52.480 --> 00:20:53.420
It's just one more hop, right?

00:20:53.420 --> 00:20:55.740
Well, I was getting a little interference in the house.

00:20:55.740 --> 00:21:04.360
I said, well, let me just try plugging in not to the thing that connects to the internet, but to the node that wirelessly across the buildings connects to the other thing that connects to the internet.

00:21:04.360 --> 00:21:05.520
Do you know what I learned?

00:21:05.520 --> 00:21:13.020
I learned something insane that I don't know if I can simulate it here across buildings.

00:21:13.020 --> 00:21:15.600
I'm apparently not getting it right now.

00:21:16.020 --> 00:21:20.760
I'm only getting a rough 570 megabit over wireless across buildings.

00:21:20.760 --> 00:21:23.520
Earlier, I was getting 800 megabit over Wi-Fi.

00:21:23.520 --> 00:21:26.420
Well, I mean, you're also streaming video at the same time.

00:21:26.420 --> 00:21:28.640
Yeah, we're streaming video and doing other stuff, right?

00:21:28.640 --> 00:21:29.300
Uploading, downloading.

00:21:29.300 --> 00:21:38.080
But so my advice to people, if you have a mesh network, even though you're connected to one of these nodes, you think, well, that's wireless to the end anyway.

00:21:38.080 --> 00:21:40.060
Like, is it really worth ethernet?

00:21:40.060 --> 00:21:40.740
Yes.

00:21:40.740 --> 00:21:43.180
It's because.net.

00:21:43.180 --> 00:21:44.080
I'll try one more.

00:21:44.080 --> 00:21:47.760
I was completely blown away by how much of a difference it makes.

00:21:47.760 --> 00:21:52.720
But yeah, it's really, really impressive to plug into these wireless things.

00:21:52.720 --> 00:21:56.020
So if you've got a mesh network, try ethernet to it, even if it doesn't matter.

00:21:56.020 --> 00:21:57.580
That's my extra.

00:21:57.580 --> 00:21:58.160
Cool.

00:21:58.160 --> 00:21:58.620
Yeah.

00:21:58.880 --> 00:22:00.060
I had to look it up.

00:22:00.060 --> 00:22:02.500
I didn't know what Wi-Fi 6E was.

00:22:02.500 --> 00:22:04.420
So I looked it up.

00:22:04.420 --> 00:22:06.040
It's 11AX.

00:22:06.040 --> 00:22:06.960
That makes sense.

00:22:07.600 --> 00:22:13.480
So I test Wi-Fi stuff, but I'm testing it on the standard side.

00:22:13.480 --> 00:22:18.140
So we get it before they decide what the buzzwords are going to be.

00:22:18.140 --> 00:22:18.900
Yeah.

00:22:18.900 --> 00:22:19.440
I see.

00:22:19.440 --> 00:22:20.100
Okay.

00:22:20.100 --> 00:22:20.680
Yeah.

00:22:20.680 --> 00:22:21.160
That's really cool.

00:22:21.280 --> 00:22:23.020
AX is really cool.

00:22:23.020 --> 00:22:27.000
It's one of the, it's the first standard that, I mean, that is, now I'm getting nerding out

00:22:27.000 --> 00:22:30.880
on Wi-Fi, but it's the first standard that's not bi-directional the same.

00:22:31.120 --> 00:22:38.500
So the protocol from up from the node to your device is different than the other way.

00:22:38.500 --> 00:22:40.820
Kind of like cellular is like that too.

00:22:40.820 --> 00:22:45.500
But before AX, it was identical.

00:22:45.500 --> 00:22:51.540
The same sort of protocol and traffic and speed and everything from in both directions.

00:22:51.540 --> 00:22:52.540
But this way.

00:22:52.540 --> 00:22:53.000
Yeah.

00:22:53.000 --> 00:22:54.180
So anyway.

00:22:54.180 --> 00:22:55.060
So neat.

00:22:55.060 --> 00:22:55.540
Yeah.

00:22:55.540 --> 00:22:56.520
Anyway, really, really cool.

00:22:56.520 --> 00:22:59.840
Out in the audience, David Poole says, Linksys makes good stuff.

00:23:00.340 --> 00:23:01.880
Wired is always better than wireless.

00:23:01.880 --> 00:23:03.540
I work on Wi-Fi professionally.

00:23:03.540 --> 00:23:04.460
Yeah, for sure.

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

00:23:04.880 --> 00:23:05.400
All right.

00:23:05.400 --> 00:23:06.040
Nice.

00:23:06.040 --> 00:23:07.120
Ready for some jokes?

00:23:07.120 --> 00:23:08.100
Yeah.

00:23:08.100 --> 00:23:10.780
So I'm going to take us to an unexpected place.

00:23:10.780 --> 00:23:11.420
Etsy.

00:23:11.420 --> 00:23:12.460
You ready for this?

00:23:12.460 --> 00:23:17.620
Now, this is pretty, I considered not putting this here because it's fairly graphical.

00:23:17.620 --> 00:23:19.680
Like, you need to see it in nature.

00:23:19.680 --> 00:23:23.300
So what I'm going to do is I'm going to take our favorite one and put it as a chapter art

00:23:23.300 --> 00:23:24.220
for people to appreciate.

00:23:24.220 --> 00:23:24.560
Okay.

00:23:24.560 --> 00:23:25.140
Okay.

00:23:25.140 --> 00:23:31.440
So these are like tech signs that have words or sayings that don't necessarily match

00:23:31.440 --> 00:23:32.780
with what you might expect.

00:23:32.780 --> 00:23:37.620
So for example, here's one and it looks kind of like a RAM chip that's hot or something.

00:23:37.620 --> 00:23:39.320
And it has a little heat wave coming up.

00:23:39.320 --> 00:23:43.020
It says, caution, magic smoke cannot be reinserted once released.

00:23:43.020 --> 00:23:46.180
Isn't that awesome?

00:23:46.180 --> 00:23:47.000
Yeah.

00:23:47.440 --> 00:23:47.680
Yeah.

00:23:47.680 --> 00:23:48.360
Here's one.

00:23:48.360 --> 00:23:50.980
This is a throwback to quantum mechanics, I believe.

00:23:50.980 --> 00:23:53.920
It's a little wavy hexagonal lines and a bunch of question marks.

00:23:53.920 --> 00:23:54.720
It's uncertainty.

00:23:54.720 --> 00:23:56.260
Do not attempt to measure.

00:23:56.260 --> 00:23:59.900
This one, I think probably all of us can relate to this.

00:23:59.900 --> 00:24:02.620
I've created some of this myself and had to deal with it.

00:24:02.620 --> 00:24:05.420
It's a hexagon with some piece of technology in the middle.

00:24:05.420 --> 00:24:07.760
It says, caution, cursed technology inside.

00:24:07.760 --> 00:24:08.700
Oh, yeah.

00:24:08.700 --> 00:24:10.060
It's a pentagon in there.

00:24:10.060 --> 00:24:10.420
Cool.

00:24:10.420 --> 00:24:10.920
Nice.

00:24:10.920 --> 00:24:11.280
Yeah.

00:24:11.280 --> 00:24:11.520
Yeah.

00:24:11.520 --> 00:24:12.120
Pentagon rather.

00:24:12.120 --> 00:24:12.620
Thank you.

00:24:12.620 --> 00:24:14.380
And let's see.

00:24:14.380 --> 00:24:16.480
Maybe one more here.

00:24:16.980 --> 00:24:18.140
If we can find it.

00:24:18.140 --> 00:24:18.900
Oh, this one.

00:24:18.900 --> 00:24:19.780
This will be a good one.

00:24:19.780 --> 00:24:20.520
A Gen 2 one.

00:24:20.520 --> 00:24:21.900
It's got a Gen 2 logo in the middle.

00:24:21.900 --> 00:24:26.600
It says, warning, kernel may need recompiling in order to change sound volume.

00:24:26.600 --> 00:24:30.820
All right.

00:24:30.820 --> 00:24:32.540
Well, there you have it, folks.

00:24:32.540 --> 00:24:33.540
That's one of my jokes.

00:24:33.540 --> 00:24:34.740
There's a whole bunch of these.

00:24:34.740 --> 00:24:36.980
You can click around and enjoy them for a while.

00:24:36.980 --> 00:24:38.080
They're pretty good.

00:24:38.080 --> 00:24:38.480
Nice.

00:24:38.480 --> 00:24:39.320
These are great.

00:24:39.320 --> 00:24:39.840
They are.

00:24:39.840 --> 00:24:40.220
Cool.

00:24:40.220 --> 00:24:41.580
Well, thanks again.

00:24:41.580 --> 00:24:42.560
Wonderful episode.

00:24:42.560 --> 00:24:43.320
Sure was.

00:24:43.320 --> 00:24:44.700
Thank you, Brian, for being here.

00:24:44.700 --> 00:24:46.360
And thank you, everyone, for listening.

00:24:46.460 --> 00:24:47.040
Really appreciate it.

