WEBVTT

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

00:00:04.720 --> 00:00:11.220
This is episode 297, recorded August 16, 2022, and I am Brian Okken.

00:00:11.220 --> 00:00:12.260
I'm Michael Kennedy.

00:00:12.260 --> 00:00:15.900
It's good to be back and be with you, Michael.

00:00:15.900 --> 00:00:19.640
Yeah, it's great to be back. Not in the usual location today.

00:00:19.640 --> 00:00:23.660
You may hear some nature sound shmaiya and apologize if animals go crazy,

00:00:23.660 --> 00:00:27.040
but there's construction, which is guaranteed to be a problem in my office.

00:00:27.040 --> 00:00:29.040
So I'm sitting in the backyard. We'll see how it goes.

00:00:29.040 --> 00:00:36.600
Yeah, for people that are listening to the podcast, the live stream people get to see his lovely view from his backyard.

00:00:36.600 --> 00:00:37.640
Some nice trees.

00:00:37.640 --> 00:00:40.700
Yeah, big trees. It's all Oregon backyard here.

00:00:40.700 --> 00:00:41.760
Nice.

00:00:41.760 --> 00:00:48.820
But also, I also want to say this episode is brought to you by IRL podcast from Mozilla.

00:00:48.820 --> 00:00:53.060
So we'll tell you more about that later, but thanks to Mozilla and the IRL podcast for supporting the show.

00:00:53.060 --> 00:00:53.700
Thank you.

00:00:53.700 --> 00:00:58.300
Let's talk about writing code by not writing code.

00:00:58.300 --> 00:00:59.380
Does that sound like a good idea?

00:00:59.380 --> 00:01:01.120
Well, okay.

00:01:01.120 --> 00:01:04.000
Not in the low code, no code sense.

00:01:04.000 --> 00:01:07.340
There's actually some pretty cool tools in that space, but that's not what I'm talking about.

00:01:07.860 --> 00:01:20.760
Imagine, Brian, somebody says, we used to be a .NET shop and we have this huge database and all of our code to talk to it is in some other language or it's Ruby or it's Java or whatever.

00:01:20.760 --> 00:01:21.440
It's not Python.

00:01:21.680 --> 00:01:26.600
And you decide the best way to talk to this database is with some flavor of SQLAlchemy.

00:01:26.600 --> 00:01:28.380
SQLAlchemy straight.

00:01:28.380 --> 00:01:37.660
Or if you prefer, you could have it with data classes or you could even mix in a little sprinkling of SQL model if you're doing async and FastAPI and pydantic.

00:01:37.660 --> 00:01:41.320
Whatever choice you want to make from that perspective.

00:01:41.480 --> 00:01:53.760
If you're looking at a database with 150 tables and all sorts of gnarly relationships, you might say, well, I'm going to have to spend the next week planning out how to model those out so I get them to exactly match the database.

00:01:54.200 --> 00:01:55.200
Is it a Varchar?

00:01:55.200 --> 00:01:59.180
Is it a Varchar with a limit like Varchar 10 or, you know, what?

00:01:59.180 --> 00:02:00.560
That doesn't sound fun, does it?

00:02:00.560 --> 00:02:02.020
No, no.

00:02:02.020 --> 00:02:02.700
Not, not.

00:02:02.700 --> 00:02:05.940
I mean, at least for me, maybe some people that's a special kind of fun for them.

00:02:05.940 --> 00:02:13.320
But Josh Thurston sent over this project called SQL A for SQLAlchemy code gen.

00:02:13.320 --> 00:02:15.820
So I'm taking that he doesn't think it sounds like fun.

00:02:15.820 --> 00:02:17.900
I certainly don't think that it does either.

00:02:17.900 --> 00:02:19.800
So people should check this out.

00:02:19.800 --> 00:02:21.280
It's it looks really cool.

00:02:22.120 --> 00:02:26.920
And what you do is it's it's an automatic model generator for SQLAlchemy.

00:02:26.920 --> 00:02:29.000
What does it generate it from?

00:02:29.000 --> 00:02:33.420
So what you do is you go through and you point it at some database.

00:02:33.420 --> 00:02:34.180
OK.

00:02:34.180 --> 00:02:38.060
Just say SQL A code gen and you give it your connection string.

00:02:38.060 --> 00:02:43.160
For example, Postgres SQL colon triple slash some database connection string.

00:02:43.160 --> 00:02:49.660
And then magic happens and you have a whole bunch of Python classes that are attempted to look handwritten.

00:02:50.380 --> 00:03:04.680
So instead of taking all your time, like a week to model out the database and the relationships and all that stuff in Python, you run this one command line thing and then you have all the classes and then you can tweak them a tiny bit if you see fit.

00:03:04.680 --> 00:03:06.340
OK, so this is OK.

00:03:06.340 --> 00:03:08.000
You probably said this and I missed it.

00:03:08.000 --> 00:03:12.880
But so you already have data in a database and you're trying to hook up an application to it.

00:03:12.880 --> 00:03:13.300
Yeah.

00:03:13.300 --> 00:03:13.560
Yeah.

00:03:13.560 --> 00:03:16.120
Which is why I went on my theoretical theoretical example.

00:03:16.120 --> 00:03:17.060
I have a database.

00:03:17.060 --> 00:03:18.800
I have code that talks to it, but it's not Python.

00:03:18.800 --> 00:03:21.300
And so there's not really something to work from.

00:03:21.300 --> 00:03:24.340
But I've got a really complicated database that's been around for a while.

00:03:24.340 --> 00:03:25.640
It doesn't have to be complicated.

00:03:25.640 --> 00:03:30.960
But the more gnarly the database, the more you will appreciate this tool making, you know, doing it for you.

00:03:30.960 --> 00:03:32.960
I think I have this situation.

00:03:32.960 --> 00:03:34.920
I totally want to use this.

00:03:34.920 --> 00:03:35.300
Yeah.

00:03:35.300 --> 00:03:35.680
Yeah.

00:03:35.680 --> 00:03:36.200
Yeah.

00:03:36.200 --> 00:03:36.460
Yeah.

00:03:36.460 --> 00:03:39.260
So it does a bunch of neat things.

00:03:40.020 --> 00:03:47.800
It's written to read the structure of an existing database and generate the appropriate SQLAlchemy model code using the declarative style if possible.

00:03:47.800 --> 00:03:50.700
So deriving from SQLAlchemy declarative base.

00:03:50.700 --> 00:04:00.940
It's also there was some other tool called SQL Auto Code, which apparently has some limitations, such as, for example, it doesn't support Python 3 or recent versions of SQLAlchemy.

00:04:00.940 --> 00:04:03.460
That seems like a pretty large limitation, but whatever.

00:04:03.460 --> 00:04:07.060
So this supports the newest version.

00:04:07.060 --> 00:04:14.780
It produces PEP 8 compliant code, tries to make it look like you're writing code by hand so it doesn't look auto-generated.

00:04:14.780 --> 00:04:20.340
It automatically detects join table inheritance and all kinds of things.

00:04:20.340 --> 00:04:23.460
So if I scroll down here, it's got these different generators.

00:04:23.460 --> 00:04:34.620
So you can generate table objects for people who don't want to use the ORM because SQLAlchemy has these two flavors, like a low level, slightly above just raw SQL, and then the ORM, which is the one that I use all the time.

00:04:34.620 --> 00:04:39.960
By default, it uses the ORM one, but you can also use, like I said, data classes, which is pretty excellent.

00:04:39.960 --> 00:04:40.380
Yeah.

00:04:40.380 --> 00:04:50.020
Instead of, you know, in case that's what you want your code to look like, or even better than that, you can use SQL model models or using SQL model, which is the project.

00:04:50.020 --> 00:04:53.360
I'm sure we've discussed it before by Sebastian.

00:04:54.120 --> 00:05:01.120
It's based on Pydantic and Async, but then it's built really on top of SQLAlchemy.

00:05:01.120 --> 00:05:05.120
So if you're looking to do the newer version of that, you'll get this.

00:05:05.120 --> 00:05:14.760
By the way, just thinking about it while I'm looking at this, maybe I have actually a SQLAlchemy generated database, but it's written in the older style of SQLAlchemy.

00:05:15.000 --> 00:05:18.380
And it's not using SQL model and I want to just upgrade to SQL model.

00:05:18.380 --> 00:05:21.480
You might be able to use the database to just go rewrite it for me again.

00:05:21.480 --> 00:05:25.680
But in this, in this flavor, you know, or use it to generate the data class version.

00:05:25.680 --> 00:05:26.860
That actually looks pretty cool.

00:05:26.860 --> 00:05:31.560
Or do all of them and look at it and see which one you looks, looks like it's more fun to maintain.

00:05:31.560 --> 00:05:32.640
Yeah, exactly.

00:05:33.060 --> 00:05:40.540
So there's a whole bunch of options and stuff that you can use, but you can basically pass a bunch of command line arguments and stuff to change how it works.

00:05:40.540 --> 00:05:40.980
Cool.

00:05:40.980 --> 00:05:46.360
Like change how it names objects or change how it names fields, et cetera, et cetera.

00:05:46.360 --> 00:05:50.720
People, if they really want to look into it and use it, I think they all got the idea from this.

00:05:50.720 --> 00:05:52.100
Okay, cool.

00:05:52.100 --> 00:05:52.340
What do you think?

00:05:52.340 --> 00:05:52.720
Sound cool?

00:05:52.720 --> 00:05:53.340
Yeah.

00:05:53.340 --> 00:05:54.320
Looks really cool.

00:05:54.320 --> 00:05:54.720
Yeah.

00:05:54.720 --> 00:06:01.520
Anytime you've got a database, they're so hard to model because you've got to get the SQLAlchemy code to match it just right or it won't work at all.

00:06:01.860 --> 00:06:04.880
And yet, you know, do you really want to do that by hand?

00:06:04.880 --> 00:06:05.900
No, I don't.

00:06:05.900 --> 00:06:08.600
And so SQL A code gen.

00:06:08.600 --> 00:06:09.520
Thanks, Josh.

00:06:09.520 --> 00:06:11.460
Well, I am going to talk about package.

00:06:11.460 --> 00:06:20.240
I've been, my headspace is in packaging lately because I'm preparing a talk for next month and it's going to have some packaging stuff in it.

00:06:20.240 --> 00:06:22.140
So this is really exciting.

00:06:22.140 --> 00:06:25.780
I heard from Juan Luis Cano Rodriguez.

00:06:25.780 --> 00:06:26.820
Rodriguez?

00:06:26.820 --> 00:06:27.480
Sorry.

00:06:28.000 --> 00:06:36.020
SetupTool664.00 is out and it ships with PEP660 editable installs.

00:06:36.020 --> 00:06:40.680
So this, the big headline is not that, although that's really cool.

00:06:40.680 --> 00:06:46.040
It's that most projects don't need a setup.py or a setup.cfg anymore.

00:06:46.040 --> 00:06:48.340
Those can be gone.

00:06:48.760 --> 00:06:57.080
And not that setup.py was evil, but it kind of was evil because what it does is it runs Python, runs Python while you install something.

00:06:57.080 --> 00:06:59.680
Like when used normally, it's fine.

00:06:59.780 --> 00:07:05.820
But it has this tremendous gaping hole for abusing things at different levels.

00:07:05.820 --> 00:07:06.500
Yeah.

00:07:06.500 --> 00:07:08.420
And the, the, okay.

00:07:08.420 --> 00:07:16.340
So the caveat on this is the reason why it has that is sometimes it goes out and compiles stuff if it's not just pure Python stuff.

00:07:16.340 --> 00:07:19.020
But you don't need that for that.

00:07:19.020 --> 00:07:25.280
You, you, a lot of projects, most projects don't need that anymore because they're not really compiling stuff.

00:07:25.280 --> 00:07:31.920
If they're on during pip install, they're, they're compiling stuff ahead of time and they have their separate wheels for different architectures.

00:07:31.920 --> 00:07:33.860
So I like that model better.

00:07:33.860 --> 00:07:37.820
So anyway, the, I'm like pretty excited about this.

00:07:37.820 --> 00:07:42.120
So there's a, so yeah, congrats to the pipe PA for getting that done.

00:07:42.120 --> 00:07:46.580
We've got, there's an article called development mode, editable installs.

00:07:46.580 --> 00:07:54.260
So here you've got pip install editable that works with setup tools without a setup.py.

00:07:54.780 --> 00:07:56.620
Used to have, have to have a shim.

00:07:56.620 --> 00:07:59.420
So everything can be in piproject.toml now.

00:07:59.420 --> 00:08:08.020
And, and so one of the cool things, and I actually discovered this also at the same time I was researching packaging stuff.

00:08:08.020 --> 00:08:12.260
The pipe PA has this really cool guide packaging Python projects.

00:08:12.260 --> 00:08:16.420
And they, what's neat is they keep it up to date fairly well.

00:08:16.420 --> 00:08:23.040
And this whole tutorial, it's a simple, so you got a simple Python project and you want to try to learn how to package.

00:08:23.480 --> 00:08:25.600
They have this, this page here.

00:08:25.600 --> 00:08:26.300
It's nice.

00:08:26.300 --> 00:08:29.420
There's no mention of setup.py or setup.cfg.

00:08:29.420 --> 00:08:31.120
It's all pyproject.toml.

00:08:31.120 --> 00:08:31.600
Oh, wow.

00:08:31.600 --> 00:08:32.740
That's awesome.

00:08:32.740 --> 00:08:34.060
Here's how you do it.

00:08:34.060 --> 00:08:37.900
And you don't even talk about the older, more troublesome way.

00:08:38.440 --> 00:08:38.680
Yeah.

00:08:38.680 --> 00:08:44.500
And since setup tools and pip are not part of Python proper, they're separate things.

00:08:44.500 --> 00:08:51.180
Well, I mean, you get pip when you, when you download Python, but you get a version and you usually upgrade anyway.

00:08:51.180 --> 00:08:52.900
But setup tools is separate.

00:08:53.080 --> 00:08:56.740
So they can move at a faster pace than Python itself.

00:08:56.740 --> 00:08:57.620
Oh, right.

00:08:57.620 --> 00:08:58.040
Okay.

00:08:58.040 --> 00:08:58.780
Excellent.

00:08:58.780 --> 00:09:00.540
Well, this is great news.

00:09:00.540 --> 00:09:06.340
Anything that makes the supply chain side of Python stronger is good.

00:09:06.340 --> 00:09:06.720
Yep.

00:09:06.720 --> 00:09:07.280
Indeed.

00:09:08.200 --> 00:09:12.560
Well, before we move on to the next thing, Brian, let me tell you about our sponsor.

00:09:12.560 --> 00:09:13.460
All right.

00:09:13.640 --> 00:09:19.220
So this episode of Python Bytes is brought to you by the IRL podcast, an original podcast from Mozilla.

00:09:19.220 --> 00:09:24.920
If you're like me and Brian, we care about ideas behind technology, not just the tech itself.

00:09:24.920 --> 00:09:28.060
So we know that tech has an enormous influence on society.

00:09:28.060 --> 00:09:30.100
Many of these effects are hugely beneficial.

00:09:30.100 --> 00:09:34.620
Just think about carrying all of the world's information in our pockets sort of thing.

00:09:34.620 --> 00:09:37.740
But other tech influences can have negative effects.

00:09:37.740 --> 00:09:48.940
And I really appreciate that Mozilla is always on the lookout for and working to mitigate negative influences of tech on all of us, all the tracking stuff they're doing, but a bunch of awareness things as well.

00:09:48.940 --> 00:09:52.560
And so if these ideas resonate with you, you should definitely check out the IRL podcast.

00:09:52.560 --> 00:09:54.060
It's hosted by Bridget Todd.

00:09:54.060 --> 00:09:57.880
And this season is very much in the focus of Python.

00:09:57.880 --> 00:10:00.080
It's AI in real life.

00:10:00.080 --> 00:10:02.860
So who can AI help?

00:10:02.860 --> 00:10:04.020
Who can it harm?

00:10:04.020 --> 00:10:08.760
The show features fascinating conversations with people who are working and building more trustworthy AI.

00:10:08.760 --> 00:10:12.540
For example, there's an episode about how our world is mapped with AI.

00:10:12.540 --> 00:10:17.300
And it's the data that's missing from those maps that tells as much of the story as the maps themselves.

00:10:17.300 --> 00:10:22.400
Another one's about gig workers and how they're pushing back on algorithms to create better working style.

00:10:22.400 --> 00:10:30.300
And for political junkies, there's an episode about how the role of AI plays when it comes to spreading disinformation about elections.

00:10:30.700 --> 00:10:35.880
Obviously, huge concern as just across the world for all the democracies.

00:10:35.880 --> 00:10:48.940
I also just listened to the tech we won't build, which explores when developers and data scientists should consider pushing back on projects that can be harmful to society, even though the machine learning can easily be turned on them.

00:10:49.160 --> 00:10:51.120
If this sounds interesting, try an episode for yourself.

00:10:51.120 --> 00:10:56.300
Just search for IRL on your podcast player or visit pythonbytes.fm/IRL.

00:10:56.300 --> 00:10:58.400
The link is in your podcast player show notes.

00:10:58.400 --> 00:11:00.940
Thank you so much to IRL and Mozilla for supporting the show.

00:11:00.940 --> 00:11:01.980
I've been listening to it.

00:11:01.980 --> 00:11:03.340
It's a really great show, too.

00:11:03.340 --> 00:11:03.860
Yeah.

00:11:03.860 --> 00:11:04.240
Yeah.

00:11:04.240 --> 00:11:05.480
I enjoy it as well.

00:11:05.480 --> 00:11:09.800
It's not super, super technical where it's all about APIs and stuff.

00:11:09.800 --> 00:11:11.600
You can kind of just kick back and enjoy it.

00:11:11.600 --> 00:11:14.140
Not like this podcast where we're super technical.

00:11:15.300 --> 00:11:15.740
Exactly.

00:11:15.740 --> 00:11:17.100
Yeah.

00:11:17.100 --> 00:11:19.720
We talk about a bunch of technical things, sometimes not too deeply, huh?

00:11:19.720 --> 00:11:20.840
Oh, I like it.

00:11:20.840 --> 00:11:21.680
I like our level.

00:11:21.680 --> 00:11:23.080
Yeah, I do, too.

00:11:23.080 --> 00:11:23.520
I do, too.

00:11:23.520 --> 00:11:29.580
Before we get on to the next topic, I just want to do a quick audience comment from Anna here.

00:11:29.580 --> 00:11:30.800
It says, hello from London, UK.

00:11:30.800 --> 00:11:33.440
SQL code gen sounds like it could save a lot of headaches.

00:11:33.440 --> 00:11:35.140
Yeah, I think it's going to be great.

00:11:35.140 --> 00:11:35.500
Yeah.

00:11:35.900 --> 00:11:41.000
And feedback for the tutorial that you highlighted, Brian, on python.org.

00:11:41.000 --> 00:11:41.560
Yep.

00:11:41.560 --> 00:11:45.580
Henry Schreiner says, it took around six months for my rewrite of that page to get accepted.

00:11:45.580 --> 00:11:47.360
Well, thank you for all the hard work, Henry.

00:11:47.360 --> 00:11:47.840
That's awesome.

00:11:47.840 --> 00:11:48.920
Great job.

00:11:48.920 --> 00:11:49.900
It looks great.

00:11:49.900 --> 00:11:50.580
Yeah.

00:11:50.580 --> 00:11:51.340
Very, very cool.

00:11:51.340 --> 00:11:55.460
Previously, I had talked about async cache.

00:11:55.460 --> 00:11:56.060
Remember that?

00:11:56.060 --> 00:12:00.500
Where it's like the functools, LRU cache, but a little bit more.

00:12:00.980 --> 00:12:02.920
However, you can apply it to async methods.

00:12:02.920 --> 00:12:07.200
Owen Lamont said, you may also be interested in AIO cache.

00:12:07.200 --> 00:12:12.660
What this one does is this lets you use proper distributed backends for caching.

00:12:12.660 --> 00:12:19.820
So, for example, if you're on a web app, you might have five, six, ten, maybe many more worker processes,

00:12:19.820 --> 00:12:26.300
either on one machine using the supervisor mode of like G-Unicorn, or it could be even across different computers.

00:12:26.580 --> 00:12:32.160
If you're using that in-memory version of cache, every time the request goes to a different part of your site,

00:12:32.160 --> 00:12:37.480
or different runtime, different process running your site, you've got to recompute it, right?

00:12:37.480 --> 00:12:40.340
Well, this one also supports Redis and Memcached.

00:12:40.340 --> 00:12:41.220
Oh, sweet.

00:12:41.220 --> 00:12:41.840
Or Memcached.

00:12:41.840 --> 00:12:45.980
And it has a common API across all of them, which is pretty fantastic.

00:12:45.980 --> 00:12:48.260
And they're all async and awaitable, which is cool.

00:12:48.260 --> 00:12:55.820
So, it aims for simplicity rather than trying to highlight all the nuances of that particular, say, to Redis versus the others.

00:12:55.820 --> 00:13:02.780
So, it has an add, a get, a set, a multi-get if you need to say, give me the values corresponding to these four IDs,

00:13:02.780 --> 00:13:10.340
or does this thing exist or not, delete, clear, even increment a value, like how many people view this page, increment that in the cache.

00:13:10.340 --> 00:13:15.180
And it's shared across, like I said, ten worker processes across machines instantly.

00:13:15.180 --> 00:13:16.000
How cool is that?

00:13:16.000 --> 00:13:16.380
That's pretty cool.

00:13:16.380 --> 00:13:18.300
Yeah, so, super easy to work with.

00:13:18.300 --> 00:13:26.140
You can install it, but then you should also reference probably the specialization that you're using or the backend that you're using.

00:13:26.140 --> 00:13:31.160
So, for example, you can say pip install AIO cache, but if you want to use Redis, it's bracket Redis.

00:13:31.160 --> 00:13:35.740
If you want to use Redis and Memcached, you might say, you know, bracket Redis, Memcached.

00:13:35.740 --> 00:13:37.860
They have message pack and different formatting.

00:13:37.860 --> 00:13:42.080
So, depending on how you're using it, you might have to install some dependencies, okay?

00:13:42.080 --> 00:13:45.780
The optional install mechanism of pip is pretty cool, though.

00:13:46.220 --> 00:13:46.860
It is.

00:13:46.860 --> 00:13:47.500
It is pretty cool.

00:13:47.500 --> 00:13:50.740
So, you just import asyncIO, easy.

00:13:50.740 --> 00:13:56.520
And then you import AOCache, and you've got to, you know, just basically run your loop somewhere.

00:13:56.520 --> 00:14:02.920
Or if you're using something like FastAPI, just that thing's generating or managing the loop for you, so you don't have to worry about it.

00:14:02.920 --> 00:14:08.040
So, you can just say await cache.set, key, comma, value, await, cache.get key.

00:14:08.040 --> 00:14:09.900
Sounds pretty straightforward, right?

00:14:09.900 --> 00:14:11.980
You can even use it as a decorator.

00:14:11.980 --> 00:14:21.700
So, if you put at cache on a function, you can give it time to live, the target, which is Redis, the key to use for that particular thing, and so on.

00:14:21.760 --> 00:14:22.880
And then off it goes.

00:14:22.880 --> 00:14:23.660
It's the serializer.

00:14:23.660 --> 00:14:25.940
You have pickles, or you have message pack, or JSON.

00:14:25.940 --> 00:14:27.800
And then, there you go.

00:14:27.800 --> 00:14:28.520
Pretty cool, huh?

00:14:28.520 --> 00:14:29.600
So, does it...

00:14:29.600 --> 00:14:29.800
Okay.

00:14:29.800 --> 00:14:33.820
So, for a function, does it cache the input and output of that function, then?

00:14:33.820 --> 00:14:35.860
I think it caches the output.

00:14:35.860 --> 00:14:36.620
Okay.

00:14:37.540 --> 00:14:43.260
But it doesn't look like it varies by argument.

00:14:43.260 --> 00:14:44.660
At least in this example, it's not very...

00:14:44.660 --> 00:14:45.540
At least, yeah.

00:14:45.540 --> 00:14:47.300
And I don't see how you would...

00:14:47.300 --> 00:14:49.220
Like, this key is the lookup value, right?

00:14:49.220 --> 00:14:52.460
So, you might call that cache call key result or something.

00:14:52.460 --> 00:14:56.100
I don't see how you dynamically do that.

00:14:56.100 --> 00:14:57.220
It's got to be, like, a void.

00:14:57.220 --> 00:14:58.860
But, you know, a lot of times, that's...

00:14:58.860 --> 00:15:02.120
You just, like, show me all the products in this database or whatever, right?

00:15:02.120 --> 00:15:02.520
Yeah.

00:15:02.520 --> 00:15:02.980
Yeah.

00:15:02.980 --> 00:15:03.600
Cool.

00:15:03.600 --> 00:15:04.040
Cool.

00:15:04.040 --> 00:15:05.020
Yeah, pretty neat, huh?

00:15:05.020 --> 00:15:06.400
Very neat.

00:15:06.400 --> 00:15:06.880
Yeah.

00:15:07.000 --> 00:15:08.780
And then you have different...

00:15:08.780 --> 00:15:10.120
Three basic ideas to think about.

00:15:10.120 --> 00:15:10.960
You have these backends.

00:15:10.960 --> 00:15:13.880
So, you have Redis backed by AIO Redis.

00:15:13.880 --> 00:15:16.640
You have Memcache backed by AIO Memcache.

00:15:16.640 --> 00:15:17.660
And then serializers.

00:15:17.660 --> 00:15:21.900
Like, you can serialize just string, pickle, JSON, message pack.

00:15:21.900 --> 00:15:23.300
But you can also build your own.

00:15:23.300 --> 00:15:24.820
And you can also plug in.

00:15:24.820 --> 00:15:27.980
There's a bunch of examples and documentation people can check out.

00:15:27.980 --> 00:15:29.240
So, this looks really neat to me.

00:15:29.240 --> 00:15:29.680
Yeah.

00:15:29.680 --> 00:15:30.380
Nice.

00:15:30.380 --> 00:15:32.540
It's not quite something that I need.

00:15:32.540 --> 00:15:35.340
But if I did need it, I would definitely go...

00:15:35.340 --> 00:15:35.620
I know.

00:15:36.460 --> 00:15:37.320
And I'd be all over it.

00:15:37.320 --> 00:15:37.680
Yeah.

00:15:37.680 --> 00:15:45.440
Regarding the level of detail we have in our podcast, SE Steve says, I only listen to podcasts

00:15:45.440 --> 00:15:46.040
about APIs.

00:15:46.040 --> 00:15:47.520
Nice.

00:15:47.520 --> 00:15:49.160
Nice, nice.

00:15:50.080 --> 00:15:51.040
What's your last one, Brian?

00:15:51.040 --> 00:15:56.020
My last one is, well, the Python Packaging Project.

00:15:56.020 --> 00:15:57.460
Packaging Python Project.

00:15:57.460 --> 00:15:57.940
Same thing.

00:15:57.940 --> 00:15:59.300
No, I have a new one.

00:15:59.300 --> 00:16:00.860
But I got it from this.

00:16:00.860 --> 00:16:06.740
So, when I was reading this article or this tutorial again, I came across something I wasn't familiar with.

00:16:06.740 --> 00:16:07.940
So, I had to go check it out.

00:16:07.940 --> 00:16:14.040
So, down with creating a PyProject.toml, one of the options is Hatchling.

00:16:14.040 --> 00:16:15.760
Hatchling?

00:16:15.760 --> 00:16:16.320
Yeah.

00:16:16.460 --> 00:16:17.420
I've heard of Hatch.

00:16:17.420 --> 00:16:19.160
Is this somehow related to Hatch?

00:16:19.160 --> 00:16:20.440
Yeah, it is Hatch.

00:16:20.440 --> 00:16:22.120
So, have we already covered Hatch?

00:16:22.120 --> 00:16:25.120
Actually, no, I don't think we have here, but I love the idea of it.

00:16:25.120 --> 00:16:25.680
Okay.

00:16:25.840 --> 00:16:32.400
So, Hatch is a modern, extensible Python project manager with a whole bunch of cool features,

00:16:32.400 --> 00:16:39.160
like a standardized build system and reproducible builds by default, and environment management,

00:16:39.160 --> 00:16:40.780
which, you know, okay.

00:16:40.780 --> 00:16:45.360
So, I'm not sure if this is similar to Poetry's environment manager or not.

00:16:45.360 --> 00:16:46.520
I haven't played with it much.

00:16:46.520 --> 00:16:50.040
But you don't actually have to care, which is nice.

00:16:50.120 --> 00:16:53.440
Because poetry, you have to care about it, because that's part of the whole thing.

00:16:53.440 --> 00:16:58.380
Anyway, publishing is easy to PyPI and other sources.

00:16:58.380 --> 00:17:03.960
Version management, project generation with same defaults, which I haven't tried that, so

00:17:03.960 --> 00:17:04.640
I want to try that.

00:17:04.640 --> 00:17:10.020
And supposedly a responsive CLI that's two to three times faster than equivalent tools.

00:17:10.200 --> 00:17:11.840
So, this I definitely need to try.

00:17:11.840 --> 00:17:19.140
So, this is, I would think it's similar on the line of Flit, I think, but with some extra

00:17:19.140 --> 00:17:20.360
things thrown in.

00:17:20.360 --> 00:17:26.160
And one of the reasons why I love Flit now is because even though Setup Tools does now support

00:17:26.160 --> 00:17:31.440
PyProject Tommel properly, completely, Flit's like twice as fast for building stuff.

00:17:31.440 --> 00:17:34.920
But, so I definitely want to try out Hatch and try this.

00:17:35.020 --> 00:17:39.760
I did try one little small project, just converting a Flip project to Hatch, and it took me like

00:17:39.760 --> 00:17:43.100
five minutes just using, the documentation here is great.

00:17:43.100 --> 00:17:48.020
So, the excellent documentation here about how to use the different pieces of it.

00:17:48.020 --> 00:17:48.940
So, it's pretty neat.

00:17:48.940 --> 00:17:49.640
Have you tried it?

00:17:49.640 --> 00:17:50.580
I have not tried it.

00:17:50.580 --> 00:17:52.840
I've looked at it, and it looks neat to me.

00:17:52.840 --> 00:17:55.060
I don't make many packages.

00:17:55.060 --> 00:17:58.200
I more build applications and web apps and stuff.

00:17:58.200 --> 00:18:03.620
So, I'm less in the, what's the right tool to build packages properly?

00:18:03.620 --> 00:18:05.580
You know, and I know you're doing that a little bit more.

00:18:05.580 --> 00:18:07.940
So, I just want to learn from you.

00:18:07.940 --> 00:18:09.020
I guess, good mix.

00:18:09.020 --> 00:18:12.320
I do more packages and less applications, and you do more applications.

00:18:12.320 --> 00:18:13.300
So, it's good.

00:18:13.300 --> 00:18:13.540
Yeah.

00:18:13.540 --> 00:18:15.840
Some live feedback.

00:18:15.840 --> 00:18:23.020
Henry Schreiner says, you can use any PEP 6.21 backend, Hatchlane, PDM, FlitCore, and so

00:18:23.020 --> 00:18:27.540
on with Hatch or with PDM2, one of the fantastic results of standardization.

00:18:27.540 --> 00:18:31.980
And that Hatchlane does a much better job of getting source files right than FlitCore.

00:18:31.980 --> 00:18:32.580
Okay.

00:18:32.580 --> 00:18:33.320
Interesting.

00:18:33.320 --> 00:18:33.640
Yeah.

00:18:33.640 --> 00:18:39.460
Yeah, there was a lot of cool options with the Hatch that you could specify exactly which

00:18:39.460 --> 00:18:42.020
modules and packages to pick up if you need to.

00:18:42.020 --> 00:18:45.960
That's one of the things that's a little bit mysterious with Flit, how to figure it out,

00:18:45.960 --> 00:18:49.040
because it just sort of knows somehow.

00:18:49.480 --> 00:18:54.020
I think it's the stuff that's in Git, but it's interesting.

00:18:54.020 --> 00:18:59.820
So, the main thing is, is I really like, with the standardization, that Hatch is possible,

00:18:59.820 --> 00:19:06.780
that Flit's possible, that PDM is possible, that we can do new things, and they're not that

00:19:06.780 --> 00:19:07.160
different.

00:19:07.160 --> 00:19:12.560
Like, it's kind of the backend of packaging, and the frontend is the PyProject.tom.

00:19:12.560 --> 00:19:15.200
That's a better world to be in.

00:19:15.200 --> 00:19:19.200
Yeah, that separation lets there be a lot more exploration.

00:19:19.720 --> 00:19:20.380
A lot more variation.

00:19:20.380 --> 00:19:20.860
Yep.

00:19:20.860 --> 00:19:21.320
All right.

00:19:21.320 --> 00:19:23.000
Well, that's it for our items, isn't it?

00:19:23.000 --> 00:19:24.540
I think so, yeah.

00:19:24.540 --> 00:19:26.260
You got any extras?

00:19:26.260 --> 00:19:30.500
No, but hopefully I will soon.

00:19:30.500 --> 00:19:31.900
So, I've got something I'm working on.

00:19:31.900 --> 00:19:32.400
Oh, right on.

00:19:32.400 --> 00:19:32.880
Yeah.

00:19:32.880 --> 00:19:33.700
Yes, I know.

00:19:33.700 --> 00:19:35.480
I think I know what you're alluding to.

00:19:35.480 --> 00:19:37.440
Very exciting stuff coming quite soon.

00:19:37.440 --> 00:19:37.980
Yeah.

00:19:37.980 --> 00:19:38.480
How about you?

00:19:38.480 --> 00:19:39.580
I have one extra.

00:19:39.580 --> 00:19:41.000
This one's quick, but quite cool.

00:19:41.000 --> 00:19:47.640
So, I'm sitting here on my MacBook Pro with the M1, you know, MacBook Pro, the M1 Max.

00:19:47.640 --> 00:19:51.700
And until recently, I wasn't able to use PyPy.

00:19:52.000 --> 00:19:57.580
Now, PyPy is the JIT compiled, often faster version of Python.

00:19:57.580 --> 00:20:03.560
Sometimes you'll hear people say PyPy when they are referring to PyPI, but all the people

00:20:03.560 --> 00:20:05.860
who work on PyPI pronounce it that way.

00:20:05.860 --> 00:20:08.760
And it leaves space for PyPy to be pronounced it like it should.

00:20:08.760 --> 00:20:13.900
So, PyPy is the fast JIT compiled version of Python.

00:20:13.900 --> 00:20:19.860
And the big news is, a couple weeks ago, they announced support for M1, which is pretty cool.

00:20:19.860 --> 00:20:22.320
So, if you're on Apple Silicon, you can now use PyPy.

00:20:22.320 --> 00:20:23.140
That's very cool.

00:20:23.140 --> 00:20:23.580
Natively.

00:20:23.580 --> 00:20:24.020
Yeah.

00:20:24.020 --> 00:20:32.180
It was done by Fajal and supported by contributions from the Open Collective, which is pretty cool.

00:20:32.180 --> 00:20:39.640
And it's based on support for ARCH64, which is ARM64 and Linux, with some variations on

00:20:39.640 --> 00:20:40.200
how this works.

00:20:40.200 --> 00:20:46.400
So, they've got 3.8 and 3.9 working on macOS ARM64 platform, which is pretty cool.

00:20:46.400 --> 00:20:49.560
So, if you're using that and you've been waiting for this, it should make your code run faster,

00:20:49.560 --> 00:20:51.380
maybe use less memory, that kind of thing.

00:20:51.380 --> 00:20:51.940
Very cool.

00:20:51.940 --> 00:21:00.340
If people are interested in PyPy, testing code on episode 190, I interviewed Carl Frederick Bowles

00:21:00.340 --> 00:21:02.000
about testing PyPy.

00:21:02.160 --> 00:21:03.280
Oh, cool.

00:21:03.280 --> 00:21:04.120
Yeah.

00:21:04.120 --> 00:21:05.220
There's a lot of testing.

00:21:05.220 --> 00:21:08.100
I mean, it's the entire Python runtime, basically.

00:21:08.100 --> 00:21:10.480
It's like in much of the standard library.

00:21:10.480 --> 00:21:11.060
That's a lot of work.

00:21:11.060 --> 00:21:11.540
Yeah.

00:21:11.540 --> 00:21:12.900
It's an interesting story.

00:21:12.900 --> 00:21:13.800
So, yeah.

00:21:13.800 --> 00:21:19.480
Would you say that testing and documentation are often really good things to add to your

00:21:19.480 --> 00:21:21.500
project that go along together in some ways?

00:21:21.500 --> 00:21:24.440
Well, hopefully you're doing it at the same time, but yes.

00:21:24.440 --> 00:21:25.080
Yes.

00:21:25.080 --> 00:21:30.900
You know, we've all worked with different types of team dynamics, the sort of flat hierarchy.

00:21:30.900 --> 00:21:34.760
People would just take over the projects, the parts of the projects that they seem best suited

00:21:34.760 --> 00:21:35.100
for.

00:21:35.100 --> 00:21:39.400
And there might be more hierarchical versions.

00:21:39.400 --> 00:21:46.560
So, our joke this week is about a somewhat dominating senior developer here.

00:21:46.840 --> 00:21:49.880
And there's a junior developer just hired onto the team.

00:21:49.880 --> 00:21:51.040
This is a picture.

00:21:51.040 --> 00:21:51.960
People can check it out.

00:21:51.960 --> 00:21:53.440
Just follow the link in the show notes.

00:21:53.440 --> 00:21:55.460
The junior asks, where's the documentation?

00:21:55.460 --> 00:22:00.040
In a very stern face, the team says, I am the documentation.

00:22:01.800 --> 00:22:06.760
Hopefully, you're not currently working in this situation, but it's pretty funny.

00:22:06.760 --> 00:22:10.000
You know, there's always bits.

00:22:10.000 --> 00:22:14.020
There's always pieces of the system that are like, well, how does this work?

00:22:14.020 --> 00:22:15.820
Oh, you've got to ask that guy.

00:22:15.820 --> 00:22:17.660
He's not even on our team anymore.

00:22:17.660 --> 00:22:19.660
Yeah, but he's the one that wrote it.

00:22:19.660 --> 00:22:21.420
And luckily, he's still with the company.

00:22:21.420 --> 00:22:22.260
So, go talk to him.

00:22:22.260 --> 00:22:22.820
Exactly.

00:22:22.820 --> 00:22:24.640
No one understands that we don't touch it anymore.

00:22:24.640 --> 00:22:25.540
It seems to still work.

00:22:25.540 --> 00:22:26.020
Yeah.

00:22:26.580 --> 00:22:26.900
Exactly.

00:22:26.900 --> 00:22:27.760
All right.

00:22:27.760 --> 00:22:29.900
Well, what seems to still be working is our podcast, Brian.

00:22:29.900 --> 00:22:30.840
It does.

00:22:30.840 --> 00:22:31.140
Thanks for being here.

00:22:31.140 --> 00:22:31.560
Yeah.

00:22:31.560 --> 00:22:32.100
Thanks for being here.

00:22:32.100 --> 00:22:32.400
Thank you.

00:22:32.400 --> 00:22:33.300
Yep.

00:22:33.300 --> 00:22:34.600
Thanks for everyone to listen.

00:22:34.600 --> 00:22:35.480
See y'all later.

