WEBVTT

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

00:00:05.560 --> 00:00:11.380
This is episode 439, recorded July 6, 2025, and I am Brian Atkin.

00:00:11.660 --> 00:00:12.500
And I am Michael Kennedy.

00:00:12.920 --> 00:00:18.360
And this episode is sponsored by Sentry. Listen to their spot later in the show. Thanks, Sentry.

00:00:18.680 --> 00:00:22.280
Also connect with us if you'd like to send us items or just say hey.

00:00:23.360 --> 00:00:28.940
We are on Bluesky and Mastodon, and Michael's even on X still.

00:00:29.000 --> 00:00:35.980
So the links to all of us are in the show notes and at pythonbytes.fm.

00:00:36.380 --> 00:00:57.820
And also speaking of pythonbytes.fm, why don't you head on over there and sign up for the mailing list because we will send an email to you soon after, hopefully soon after, we release the episode and we send out all the links for everything we cover plus extra information and some background information.

00:00:57.900 --> 00:00:58.600
It's really good.

00:00:59.320 --> 00:01:00.460
We're pretty proud of the email.

00:01:00.760 --> 00:01:02.260
So please sign up for that.

00:01:02.900 --> 00:01:18.600
And if you'd like to watch us live or just watch the video post live, after live, whatever that is, the afterlife, no, later on, you can go to pythonbytes.fm/live and there's a link to our YouTube stuff.

00:01:19.120 --> 00:01:19.980
So that'd be awesome.

00:01:20.320 --> 00:01:20.700
So thanks.

00:01:21.560 --> 00:01:23.100
Let's kick it off, Michael.

00:01:24.040 --> 00:01:24.500
Let's do it.

00:01:24.580 --> 00:01:27.180
All right, so I want to start by saying thank you.

00:01:27.560 --> 00:01:29.360
TY, I don't know if it means thank you or not.

00:01:29.840 --> 00:01:32.560
TY, the type checker, and also prefix this, Brian.

00:01:32.900 --> 00:01:37.400
This is kind of going to be the astral show, just so people are aware.

00:01:38.040 --> 00:01:38.160
Yeah.

00:01:38.320 --> 00:01:38.540
There's

00:01:38.540 --> 00:01:45.780
a couple of topics that we're going to cover, and this first and second one comes to us from Skylar Casco.

00:01:45.860 --> 00:01:47.300
So thank you, Skylar, for sending this in.

00:01:47.340 --> 00:01:50.260
We always appreciate when people are like, hey, have you seen this?

00:01:50.700 --> 00:01:51.100
Probably no.

00:01:51.560 --> 00:01:52.660
Sometimes yes, but probably no.

00:01:53.140 --> 00:01:56.860
All right, so I want to talk about ty from the Astral folks.

00:01:57.420 --> 00:02:03.060
TY is very similar in what it brings to the table is what Ruff did.

00:02:03.660 --> 00:02:07.920
So, you know, Astral, they make uv, Ruff, and now ty.

00:02:08.640 --> 00:02:13.640
And Ruff didn't fundamentally change how we check our code, right?

00:02:13.680 --> 00:02:17.760
We had black, which honestly kind of did, and a bunch of tools that that brought together.

00:02:18.260 --> 00:02:22.960
But the real difference here was that rough makes linting almost instant.

00:02:23.360 --> 00:02:29.020
And it's like, when you run ruff, you got to double check and make sure it's actually on the directory.

00:02:29.180 --> 00:02:31.540
You're like, did that, you know, I just hit enter and it's done.

00:02:31.680 --> 00:02:33.140
But there were 20,000 lines of code.

00:02:33.160 --> 00:02:35.180
Like, how did this, did it actually do anything?

00:02:35.380 --> 00:02:36.180
I'm not sure it did anything.

00:02:36.800 --> 00:02:37.600
But in fact, it did.

00:02:37.640 --> 00:02:41.040
And it's very similar with ty, but for type checking.

00:02:41.440 --> 00:02:44.720
So we've had type checking, type checkers like mypy and so on.

00:02:44.780 --> 00:02:47.200
But they've really struggled on super large code bases.

00:02:47.860 --> 00:02:50.540
And being faster in general is also really nice, right?

00:02:50.940 --> 00:02:52.600
So we've talked about ty before.

00:02:53.120 --> 00:02:58.760
I've actually had Charlie and Carl Meyer on Talk Python To Me, and we dove into it.

00:02:58.760 --> 00:03:02.320
So if you all want a super detailed dive, you can go check that out.

00:03:02.780 --> 00:03:03.920
But what is the news?

00:03:04.020 --> 00:03:06.880
The news is the documentation for ty is up.

00:03:07.420 --> 00:03:15.500
So if people want to check out the docs and learn more about ty, They can go over to docs.astral.sh slash ty.

00:03:16.080 --> 00:03:18.580
And there's even an online playground.

00:03:19.000 --> 00:03:30.260
And of course, there's a bit of a crossover here in the sense that you can say uvtoolinstallty to have astral installty, just like I do.

00:03:30.740 --> 00:03:37.080
Or if you just want to simply run it and say uvx, and that'll install it in like a ephemeral virtual environment sort of thing.

00:03:37.380 --> 00:03:38.980
But there's also an online playground.

00:03:39.420 --> 00:03:43.940
And this is pretty interesting because the online playground here is written in WebAssembly.

00:03:44.700 --> 00:03:50.500
So it's ty running against your Python code in the browser in WebAssembly.

00:03:50.860 --> 00:03:53.520
So that's quite neat as well, but that's not exactly the news.

00:03:53.900 --> 00:03:55.640
The news is the documentation is up.

00:03:55.860 --> 00:04:05.220
And along with that, they also have unrelated to ty exactly, but in the documentation from Astral side, migrating from a pip to a uv project.

00:04:05.350 --> 00:04:12.640
And it's a walkthrough on how you might go about using uv in its idiomatic way, I guess you would say, right?

00:04:12.920 --> 00:04:20.340
For example, like if you use pip, you probably use pip and pip compile to generate a requirement stock txt and so on, right?

00:04:20.600 --> 00:04:22.720
How do you do this kind of stuff using UV?

00:04:23.340 --> 00:04:25.860
So people can check that out as well.

00:04:26.600 --> 00:04:29.280
Yeah, I really like the migrating thing.

00:04:29.790 --> 00:04:38.700
I actually read through it and if you're not migrating, if you're just gonna use uv, I would not recommend reading this because I actually got confused a little bit.

00:04:39.020 --> 00:04:42.720
I've already moved on, but yeah, uv all the way.

00:04:44.620 --> 00:04:45.060
So

00:04:45.060 --> 00:04:46.480
what am I going to talk about?

00:04:46.640 --> 00:04:46.960
Let's see.

00:04:47.720 --> 00:04:48.820
I am going to talk.

00:04:49.000 --> 00:04:54.200
Let's just, we have a little bit of news from uv, from Astral.

00:04:55.180 --> 00:04:57.800
It's the Astral show.

00:04:58.180 --> 00:04:58.360
Yeah.

00:04:58.690 --> 00:05:04.340
So I actually picked this up from, oh, Tim, Tim, Tim.

00:05:04.680 --> 00:05:05.840
I'm blanking right now.

00:05:06.200 --> 00:05:06.560
Tim Hopper.

00:05:06.860 --> 00:05:07.320
Sorry, Tim.

00:05:08.160 --> 00:05:15.900
Tim Hopper and his Python developer tooling handbook, he posted the uv build backend is now stable.

00:05:16.190 --> 00:05:22.840
And actually, I'm pretty sure I heard about the uv build backend, but I don't remember playing with it.

00:05:22.870 --> 00:05:23.660
So I played with it.

00:05:24.540 --> 00:05:35.500
So the announcement is that for about a year, uv has had a uv build command, and it's kind of like an alternative of, What do we have?

00:05:35.760 --> 00:05:38.380
Hatchling or Flit or something like that.

00:05:39.040 --> 00:05:43.420
But now it's one of those build backends for pyproject.toml based projects.

00:05:43.900 --> 00:05:46.000
And it's pretty exciting that uv build is here.

00:05:46.360 --> 00:05:47.760
So that's the announcement.

00:05:48.020 --> 00:05:50.900
And it's also that it's stable and also fast.

00:05:51.260 --> 00:05:58.940
So Charlie Marsh posted that, he posted that it's 10 to 35 times faster than alternatives.

00:05:59.080 --> 00:06:00.160
So what is he looking at?

00:06:00.220 --> 00:06:29.620
He's looking at comparing uv to hatchling, to set up tools and to flit the thing that we don't have an answer on is what is he timing because this is just sort of uh posting the times for what he calls the back end sync that is not a command that you can send to hatchling or flit and you actually hatchling isn't a command line thing so i mean i'm not sure what's going on but i believe him that it's faster uh so it would be Kind of cool to find out what he's measuring anyway.

00:06:30.300 --> 00:06:33.460
But uv build is now available and that's cool.

00:06:33.760 --> 00:06:35.040
I'm pretty excited about that.

00:06:36.060 --> 00:06:50.400
Along those lines, if you're switching kind of along the lines of with that, that Michael brought up, if you're switching to uv and you'd kind of like to know what's so great about all of this, I recommend checking out Hinnick's video series.

00:06:50.710 --> 00:06:53.960
So he just released the second part in a uv series.

00:06:54.500 --> 00:06:58.920
And this one is making Python local workflows fast and boring in 2025.

00:06:59.640 --> 00:07:01.360
And he's talking about uv workflows.

00:07:01.820 --> 00:07:02.740
So it's a great video.

00:07:02.980 --> 00:07:04.580
I mean, I assume it's a great video.

00:07:04.800 --> 00:07:05.460
It's 40 minutes long.

00:07:05.520 --> 00:07:08.440
I haven't actually watched it yet, but I watched the first one.

00:07:08.660 --> 00:07:09.580
Yeah, his videos are great.

00:07:09.840 --> 00:07:10.640
So yeah, check them out.

00:07:11.380 --> 00:07:11.560
Indeed.

00:07:11.820 --> 00:07:15.280
And Brian, our sponsor, also very great.

00:07:15.680 --> 00:07:16.420
Let me tell you about them.

00:07:16.540 --> 00:07:16.880
How about that?

00:07:17.460 --> 00:07:17.780
That'd be great.

00:07:18.160 --> 00:07:18.220
Yeah.

00:07:18.360 --> 00:07:21.100
So this episode is brought to you by Sentry.

00:07:21.860 --> 00:07:23.480
And I'm a huge fan of Sentry.

00:07:23.980 --> 00:07:25.560
use them with all of our software.

00:07:26.140 --> 00:07:30.940
And they've been incredibly valuable for tracking down errors in our web apps and other code that we've run.

00:07:31.360 --> 00:07:32.340
I think everything's fine.

00:07:32.440 --> 00:07:33.100
You get a notification.

00:07:33.780 --> 00:07:34.680
There is an error.

00:07:34.860 --> 00:07:37.220
You're like, hmm, I guess that is a problem.

00:07:37.720 --> 00:07:39.040
You know, and it doesn't have to be in your code.

00:07:39.040 --> 00:07:44.160
It could be something like you've upgraded a dependency and now there's some kind of problem that's occurred.

00:07:44.580 --> 00:07:46.600
I've certainly got that notification as well.

00:07:46.940 --> 00:07:52.320
And I've learned about users encountering bugs over at Talk Python and for the courses and stuff.

00:07:52.680 --> 00:07:57.440
And then I'll reach out to them and say, sorry, I saw you ran into this bug that we fixed.

00:07:57.520 --> 00:07:59.360
And they haven't even contacted me yet.

00:07:59.400 --> 00:08:02.620
They're like, okay, awesome, kind of creepy, but amazing.

00:08:02.840 --> 00:08:04.080
No, it's good to know, right?

00:08:04.220 --> 00:08:06.520
Right away and be able to be on top of things.

00:08:06.920 --> 00:08:08.360
So how might you set this up?

00:08:08.500 --> 00:08:11.160
Well, they've been adding more and more capabilities and features.

00:08:11.400 --> 00:08:26.180
So I want to walk everyone really quickly through the idea of setting up monitoring and distributed tracing for a Python web app, which means like across API calls or across the JavaScript front end and the Python backend, you can correlate errors.

00:08:26.370 --> 00:08:28.660
So you can see like the whole operation, right?

00:08:28.900 --> 00:08:33.900
So let's imagine we have a Flask app with a React front end and we wanna make sure there's no errors during the checkout process.

00:08:34.400 --> 00:08:39.060
I don't know about you, but anytime money and payments are involved, I get a little extra nervous writing that code.

00:08:39.219 --> 00:08:40.780
So knowing what's going on, very good.

00:08:41.120 --> 00:08:48.560
So you start by enabling distributed tracing and error monitoring on your Flask backend and your React front end, Super easy, just a few lines of code.

00:08:49.180 --> 00:08:54.800
Next, you wanna add enough context to the front end and back end actions that you can correlate them into a single request.

00:08:55.020 --> 00:08:57.720
So add a little bit of information to like know what's happening.

00:08:58.120 --> 00:09:07.980
You enrich the spans, this is the sentry construct across these calls with business contacts like a session ID or a user or whatever.

00:09:08.720 --> 00:09:10.700
And then you can see the requests live in a dashboard.

00:09:10.980 --> 00:09:12.720
So you build a real-time sentry dashboard.

00:09:12.910 --> 00:09:22.840
You spin up one using span metrics to track key, attributes like cart size, checkout duration, and you have just one pane for performance and error data.

00:09:23.050 --> 00:09:23.560
And that's it.

00:09:23.700 --> 00:09:34.520
If an error happens, you open the error at Sentry and you get end to end request data and error tracebacks to easily spot what's going on both on the JavaScript and the Python side.

00:09:34.860 --> 00:09:39.800
So if your app and your customers matter to you, you'll definitely want to set up Sentry like we have.

00:09:40.080 --> 00:09:46.180
Visit pythonbytes.fm/sentry and use the code PYTHONBYTES, all caps, just one word.

00:09:46.460 --> 00:09:49.460
That's pythonbytes.fm/century, code pythonbytes.

00:09:49.800 --> 00:09:51.540
The link is in your podcast player show notes.

00:09:51.600 --> 00:09:54.180
And thank you to Century for supporting the show.

00:09:54.820 --> 00:09:55.040
Awesome.

00:09:55.520 --> 00:10:02.000
I want to move on to something that is sort of, I guess, maybe nerdy, Boolean expressions.

00:10:03.300 --> 00:10:04.980
As if the show wasn't already nerdy, right?

00:10:07.400 --> 00:10:09.420
So we've got Trey Hunter's article.

00:10:10.040 --> 00:10:12.320
And I kind of love what Trey Hunter's been doing lately.

00:10:12.480 --> 00:10:13.760
He's been writing some good stuff.

00:10:14.160 --> 00:10:16.320
So refactoring long Boolean expressions.

00:10:17.700 --> 00:10:22.740
And there's lots of reasons why I love this article, but we'll just walk through a little bit of it.

00:10:23.700 --> 00:10:27.080
First of all, he's introducing people to Morgan's Law, which I love.

00:10:28.420 --> 00:10:30.120
So here's the idea.

00:10:30.360 --> 00:10:45.480
You've got a Boolean expression, and his example, it's a pretty good example, is if you've got events and users, you've got sort of a web app sort of a thing going on, And you want to check to see if a user is verified.

00:10:46.060 --> 00:10:50.500
And the event they're looking at, the date of the event is in the future.

00:10:50.640 --> 00:10:51.720
So it's greater than now.

00:10:52.200 --> 00:10:53.240
And maybe it's not full.

00:10:53.280 --> 00:10:56.040
So maybe you're doing like people signing up for something.

00:10:57.300 --> 00:11:00.720
And this is a reasonable Boolean expression.

00:11:01.340 --> 00:11:03.000
But how do I, it's not that readable.

00:11:03.240 --> 00:11:05.060
So let's try to make it more readable.

00:11:05.220 --> 00:11:06.980
And that's what he's looking at.

00:11:07.120 --> 00:11:08.080
Here's how to break this up.

00:11:08.380 --> 00:11:13.340
And one of the things that I love about this is this seems, It's just sort of basic math.

00:11:14.079 --> 00:11:20.200
If by basic math, your math includes Boolean algebra and things like that.

00:11:20.830 --> 00:11:27.120
But a lot of people come from Python, not from a CS background, which is totally valid, of course.

00:11:28.080 --> 00:11:30.940
But how to manipulate and and or.

00:11:31.340 --> 00:11:37.260
When I say Boolean expression, it's just truthy things, true and false things with and and or and things like that.

00:11:38.360 --> 00:11:40.820
So he walks through some of the things you could do.

00:11:41.100 --> 00:11:43.120
You could just split up the lines.

00:11:43.260 --> 00:11:49.540
So you could just use parentheses around your expression, and then you can split the different expressions up on multiple lines.

00:11:49.980 --> 00:11:58.560
And then he's also saying you could either do it like this, where the and at the beginning, or you could say user verified and, and then go to the next line.

00:11:58.800 --> 00:12:01.380
The event date is less than, or is greater than now.

00:12:01.980 --> 00:12:04.600
And you go into the next line, not full.

00:12:04.940 --> 00:12:07.660
Okay, so you can put the and in the beginning or the end.

00:12:07.940 --> 00:12:09.040
It's really up to you.

00:12:09.180 --> 00:12:12.780
However, I didn't realize that PEP 8 had made a call on this.

00:12:13.160 --> 00:12:16.940
PEP 8 recommends putting things like and and or at the beginning of the line.

00:12:18.380 --> 00:12:19.700
And just so it's consistent.

00:12:19.900 --> 00:12:24.820
I don't know if it really matters, but I guess I kind of agree that it's a little more readable this way.

00:12:25.200 --> 00:12:25.940
So I like that.

00:12:26.580 --> 00:12:38.200
The other thing that's kind of neat about this that we will lose a little bit is that Boolean operations and expressions are short-circuited in Python.

00:12:38.580 --> 00:12:46.260
So with the ands, that means that all of these expressions have to be true for this to be the entire thing to be true.

00:12:46.500 --> 00:12:53.180
So if I get to user verified and that's false, if the user is not verified, I don't evaluate the rest of it.

00:12:53.190 --> 00:12:56.640
I just know that this is going to be false that Python does.

00:12:57.500 --> 00:12:58.820
And so Python won't run it.

00:12:59.880 --> 00:13:00.560
Hold that thought.

00:13:00.780 --> 00:13:02.480
It's going to make sense later.

00:13:02.920 --> 00:13:13.840
One of the things we can do to make this simpler is to just go ahead and evaluate all of the expressions and assign those to variables like user is verified and then combine those with ands.

00:13:14.100 --> 00:13:25.660
That's easier to read. But if if any of these evaluations are lengthy things, we don't want to do this because because the we lose the short circuiting.

00:13:25.960 --> 00:13:33.340
We've evaluated all the expressions and then we short circuit just in the ands expression and doesn't we don't get that.

00:13:33.500 --> 00:13:38.740
However, Trey says, you still can get this if you throw everything in functions.

00:13:39.040 --> 00:13:47.300
So he's got these little is verified, is in future, things like that, naming the expressions into different little functions.

00:13:47.760 --> 00:13:48.660
And this is usable.

00:13:49.140 --> 00:13:50.880
I don't think this is that readable, though.

00:13:51.120 --> 00:13:53.100
But that's just me, I think.

00:13:55.280 --> 00:13:59.900
He makes it kind of all on one line, so the entire function on one line.

00:14:00.180 --> 00:14:03.340
I think that a lot of people style guides would kind of hate that

00:14:03.340 --> 00:14:09.420
but you know what I think it looks really neat the way he's got it written like this where it's just one line you kind of call the function as

00:14:09.420 --> 00:14:10.400
the test but

00:14:10.400 --> 00:14:15.780
here's the thing if you run ruff against it keeping it the astral show or you yeah or black

00:14:15.780 --> 00:14:16.740
command alt l

00:14:16.740 --> 00:14:31.860
it in pycharm it's going to wrap it and put spaces like it's just going to keep wrecking it so then you've got to write wrap that in a no format command like directive and then you're like uh okay maybe it's too much to bridge too far but yeah i get it

00:14:32.160 --> 00:14:33.080
okay yeah

00:14:33.080 --> 00:14:33.620
so

00:14:33.620 --> 00:15:42.840
the these these are cool methods um and then let's jump through the math part the math part is kind of kind of nice uh that um is the there's you can distribute knots and and stuff. And so if you're thinking that either a few things are like A or B is true, and I want to make sure that that's not the case, whatever that means, that's the same as not A and not B. So there's these distributive properties of and and or M. And he shows both whether you want neither one to be true or what? Never both. You want one of them to be true or neither, but not both so those sorts of things to distribute why does this matter it matters because like this he shows an example as a multi-line expression and that is confusing to have a not and then a parentheses of a bunch of stuff but uh if you do uh not one thing and not another thing and not the third thing that's a that's actually pretty easy to read um i think so this is a cool cool intro to to Morgan's law from for some people breaking things up so

00:15:42.840 --> 00:15:54.280
anyway yeah very nice this is the kind of stuff I like to geek out on as well like how many how many like variations or how can you restructure stuff to be so much more readable and yeah it's good yeah

00:15:54.280 --> 00:16:08.260
and I encourage people to look all the way to the end because you have to you gotta give it to him that some of this stuff is really hard to understand to glance at but because like the first one the knots just sort of hidden up at the top but anyway yeah

00:16:08.260 --> 00:16:17.560
all right yeah I would add that you know even though you might evaluate two or three things performance usually is way less important than readability

00:16:17.560 --> 00:16:18.840
maintainability and so

00:16:18.840 --> 00:16:20.260
on yeah i have

00:16:20.260 --> 00:16:21.040
to say maybe

00:16:21.040 --> 00:16:27.000
but there's like one sorry maybe there's like one or two functions but the rest of them performance doesn't matter go ahead bro yeah

00:16:27.000 --> 00:16:50.200
exactly don't pre prematurely optimize because i have to admit that the uh the example that i sort of poo-pooed on because it's um doesn't allow you to short circuit of just naming the expressions. I do this all the time for, for quick things because it's very readable to do this. So, yeah. Yeah. And we have profilers that can tell us if

00:16:50.200 --> 00:16:51.080
it's a problem, right?

00:16:51.220 --> 00:16:53.680
Yeah. Usually it's not. All right. What you got for us?

00:16:53.960 --> 00:17:01.240
I have just an extra. I have some extras to throw out here. Oh wait, no, I have one more item, don't I? And then, then I have an extra.

00:17:01.300 --> 00:17:08.140
So my last main item is this thing called FastAPI Machine Learning or ML Skeleton.

00:17:08.660 --> 00:17:20.020
So this is speaking to all the data science folks out there that have some kind of data science model or engine or something they want to expose as an API, right?

00:17:20.199 --> 00:17:25.660
Maybe you're not a web developer or you're not really writing a lot of API type of things.

00:17:26.220 --> 00:17:28.060
So which framework do you choose?

00:17:28.250 --> 00:17:29.880
How do you structure it and so on?

00:17:29.920 --> 00:17:41.360
So this person whose name I honestly don't know is just 8beck, the number 8beck, B-E-C, created this thing called FastAPI ML Skeletons.

00:17:41.580 --> 00:17:53.420
So what it is, is it's a template that you can start with and adapt for serving machine learning models in a production-ready, fast, and easy way powered by FastAPI.

00:17:53.940 --> 00:17:56.200
But it doesn't exactly have to be machine learning models.

00:17:56.400 --> 00:18:00.640
Anything that's sort of data science that you can put behind an API, I think would fit here.

00:18:01.040 --> 00:18:06.940
So it's tested with talks and it has example code for that and super easy to get started.

00:18:07.520 --> 00:18:14.920
There's a few, I'll come back to some, a few little interesting tips and tricks, but it comes with a sample machine learning model that predicts home prices, right?

00:18:15.140 --> 00:18:17.100
Just to have something concrete to work with.

00:18:17.860 --> 00:18:23.620
And then over here, come through and you can go to the API and they're pretty well structured, right?

00:18:23.740 --> 00:18:29.820
It uses like API router and so on, instead of jamming it all into just one file, like so many of the demos do.

00:18:29.820 --> 00:18:32.360
You're like, oh, look, it's only 10 lines of code.

00:18:32.410 --> 00:18:36.000
You're like, yeah, but if you keep expanding that way, it's going to be terrible.

00:18:36.680 --> 00:18:43.220
It comes with like open API documentation by using Pydantic models for all the exchanges.

00:18:43.700 --> 00:18:45.520
It's nice and typed and all these things.

00:18:45.680 --> 00:18:51.060
So if you're getting, it's not super new, but if you're getting into it, I ran across this and I thought, you know, this is pretty neat.

00:18:51.180 --> 00:18:53.240
Maybe this will be real valuable to some folks.

00:18:53.480 --> 00:18:58.020
And Brian, I learned something because when it says, how do you start your app?

00:18:58.260 --> 00:19:04.520
Well, what you do is you say set dash a, and then you source your env file, which is your environment variable settings.

00:19:04.740 --> 00:19:07.840
And you set plus a, I'm like, okay, what does that do?

00:19:08.820 --> 00:19:08.900
Yeah.

00:19:08.980 --> 00:19:09.360
What does that do?

00:19:10.020 --> 00:19:10.760
Are you familiar with this?

00:19:11.160 --> 00:19:11.280
No,

00:19:11.520 --> 00:19:15.060
I wasn't even, I'm like, what in the heck is that?

00:19:15.220 --> 00:19:19.320
And that alone might be worth price of entry for this, like learning about this project.

00:19:19.720 --> 00:19:34.960
So what set-a does, it says anything that you basically set as a variable in your environment, basically stays set for you, which is pretty cool.

00:19:35.420 --> 00:19:36.980
So here, what's the right?

00:19:37.260 --> 00:19:40.400
So set-a turns on the all export option.

00:19:41.000 --> 00:19:42.580
Set-o all export.

00:19:42.780 --> 00:19:47.600
From that point, every variable you assign is automatically exported to the environment.

00:19:48.180 --> 00:19:56.720
So if you just said set dash a then like foo equals bar, then it's as if you had created a script and sourced it and all that kind of stuff.

00:19:57.040 --> 00:20:00.160
So a cool way to quickly set some environment variables.

00:20:00.560 --> 00:20:04.620
Yeah, I think that's-- so getting more and more.

00:20:04.760 --> 00:20:10.280
It came up last week of possibly using DuraN for that as well.

00:20:10.820 --> 00:20:11.500
Yeah, for sure.

00:20:12.860 --> 00:20:16.460
Yeah, that's a more structured way, right, to do it for sure.

00:20:16.860 --> 00:20:19.420
But I'm glad to know how to do it manually.

00:20:19.700 --> 00:20:20.000
That's cool.

00:20:20.440 --> 00:20:21.160
Yeah, yeah, exactly.

00:20:21.620 --> 00:20:24.640
Like if you're creating a little alias or something, right?

00:20:24.640 --> 00:20:27.420
You could put that at the beginning and just set a bunch of variables or whatever.

00:20:27.760 --> 00:20:28.000
Pretty sweet.

00:20:28.520 --> 00:20:33.980
Anyway, if you're looking for a FastAPI skeleton to get started with, yeah, it could be pretty cool.

00:20:34.340 --> 00:20:34.620
All right.

00:20:35.110 --> 00:20:35.900
Do you want to do your extras?

00:20:36.030 --> 00:20:36.820
I only have one extra.

00:20:36.930 --> 00:20:37.640
Yeah, sure.

00:20:37.770 --> 00:20:39.580
Me too, because I tried to jump ahead anyway.

00:20:40.220 --> 00:20:40.340
Okay.

00:20:41.540 --> 00:20:43.720
So this one comes to us from Wei Lee.

00:20:44.180 --> 00:20:55.200
And I'm going to cover this as sort of a gateway to like talk about even more stuff than like it's pretty specific, but it's an example of something that's pretty neat.

00:20:55.380 --> 00:21:01.660
So back, keeping with the astral show, Ruff has a bunch of rules for how your code should be formatted, right?

00:21:01.820 --> 00:21:05.440
And then things you should do, things you shouldn't do, maybe certain things are deprecated.

00:21:05.450 --> 00:21:06.900
You should stop doing them, right?

00:21:07.130 --> 00:21:08.140
It hurts when I do this.

00:21:08.270 --> 00:21:09.140
Okay, well, stop.

00:21:09.640 --> 00:21:14.200
But there are things like Airflow specific rules.

00:21:14.440 --> 00:21:18.060
So Airflow is a workflow engine type of thing.

00:21:18.500 --> 00:21:21.340
And if you pass, where's the settings?

00:21:21.640 --> 00:21:24.520
I guess I don't have it in the docs there, but I have it in the show notes.

00:21:24.760 --> 00:21:47.240
So if you pass certain commands to it, such as select Airflow 3, when you run ruff check --fix, it will rewrite old code that was bad into new code automatically having to do with the Airflow framework. For example, in Airflow 2, you used to say from Airflow.models import DAG.

00:21:47.580 --> 00:22:00.800
In Airflow 3, you say from Airflow.sdk import DAG, and similarly for other imports. So if you were to say that, it will actually rewrite the import statements to use the non-deprecated style. Cool, right?

00:22:01.070 --> 00:22:01.220
Yeah.

00:22:01.440 --> 00:22:18.760
Well, if you scroll down a bit, you can see there's similar things for FastAPI, bringing our two topics together, right? So there's certain things that have changed with the way you work with like response model or annotated or so on. So it'll go through and it'll change all those.

00:22:18.830 --> 00:22:29.660
Do we have a Pydantic? No, no Pydantic. We should have a Pydantic because that one changed and it's used everywhere. But anyway, there's like framework specific stuff that I think is pretty neat in the rough rule set.

00:22:30.040 --> 00:22:31.720
So thanks to Weave for sending that in.

00:22:32.120 --> 00:22:35.360
And yeah, you do Airflow or FastAPI or other things.

00:22:35.460 --> 00:22:39.780
You can turn that on to do migration across like semi-breaking changes.

00:22:40.100 --> 00:23:03.800
And I actually would just encourage people to look through the rough rules because a lot of these things used to be different tools and are different tools, but rough has pulled in rules and checks for lots of different stuff that maybe it's worth perusing around on a regular basis to see what's around and new to see if if maybe you should be checking things a little bit more closely yeah

00:23:03.800 --> 00:23:08.900
like they also have like numpy and pandas uh rules and so on watch it a prequel

00:23:08.900 --> 00:23:10.840
i just noticed that there's a pie

00:23:10.840 --> 00:23:14.960
test section i haven't looked through that i'd like to see oh very cool

00:23:14.960 --> 00:23:16.620
yeah so

00:23:16.620 --> 00:23:41.140
one of the things that's neat is um when you go into these um these rules and stuff each one of these it's not just oh here's the rule but it actually tells you does, why you should stop doing it, an example how it's bad and what it fixes. So this is actually a really good resource, which I've actually covered the rule set before is like, hey, you should go check this out just to see like what is going on with these, like do it this way, not that way.

00:23:41.540 --> 00:23:45.900
But yeah, the framework specific stuff and like pytest specific stuff is cool.

00:23:46.180 --> 00:23:51.920
And that's one of the also one of the reasons why they don't recommend turning everything on, because that's ridiculous. If you're not using

00:23:51.920 --> 00:23:52.360
Airflow,

00:23:52.480 --> 00:23:53.680
you don't need to turn on Airflow.

00:23:54.360 --> 00:24:07.640
So, yeah, yeah, exactly. All right. I have something completely unrelated to Python that I just wanted to bring up because I'm going to head to Oregon Country Fair this Friday and I'm totally excited about it.

00:24:07.880 --> 00:24:07.960
So,

00:24:08.620 --> 00:24:10.680
oh, that's awesome. What is it? What?

00:24:11.440 --> 00:24:12.200
Don't you live here?

00:24:12.840 --> 00:24:34.300
Okay. I do. Oregon Country Fair is a three-day celebration of art, music, and food in Veneto, Oregon once a year, and it's been going on since 1969. They have their own property. Well, they originally rented it or something, but now they own the property or have for a long time, so it can't get shut down.

00:24:35.220 --> 00:24:37.500
Anyway, it's not a county fair.

00:24:37.680 --> 00:24:38.700
It is a country fair.

00:24:38.920 --> 00:24:46.900
So it's music, art vendors, food, and all waste-free.

00:24:47.180 --> 00:24:52.040
So the only garbage that they take out is stuff that people bring in.

00:24:52.620 --> 00:24:55.140
You can throw away your candy bar wrappers if you're there.

00:24:55.320 --> 00:25:00.700
But all the food vendors are all doing containers that are biodegradable.

00:25:00.960 --> 00:25:02.840
So it's a fun event.

00:25:03.840 --> 00:25:04.580
Yeah, very cool.

00:25:04.880 --> 00:25:06.380
I missed it

00:25:06.380 --> 00:25:08.820
last year and I'm going to go this year.

00:25:09.020 --> 00:25:10.800
So some, some big names.

00:25:10.920 --> 00:25:11.040
Cool.

00:25:11.340 --> 00:25:11.580
It's fun.

00:25:12.280 --> 00:25:12.520
All right.

00:25:13.800 --> 00:25:14.720
That's our extras.

00:25:15.100 --> 00:25:15.900
Are you ready for a joke?

00:25:16.260 --> 00:25:16.680
I'm ready.

00:25:16.980 --> 00:25:20.400
This is a short joke, but I just can't stop giggling about it.

00:25:21.300 --> 00:25:25.100
I saw this Mike at, was it on blue sky?

00:25:25.390 --> 00:25:25.800
I don't know.

00:25:26.440 --> 00:25:27.140
No, I'm asked it on.

00:25:27.660 --> 00:25:30.780
So somebody named Mike sec equals official.

00:25:31.400 --> 00:25:39.000
So he said it's based on an idea of somebody else, Daedalus, and pending the release of some kind of official sticker to use.

00:25:39.320 --> 00:25:42.500
I now have applied a handy reminder label to my keyboard.

00:25:42.910 --> 00:25:43.700
What is the label?

00:25:44.060 --> 00:25:44.780
Front towards enemy.

00:25:48.040 --> 00:25:48.720
That's amazing.

00:25:49.300 --> 00:25:53.240
So it's a picture of the keyboard facing away from the developer.

00:25:54.600 --> 00:25:54.820
Yeah,

00:25:55.090 --> 00:25:56.360
towards the computer

00:25:56.360 --> 00:25:58.980
or towards whoever you're talking to or whatever.

00:25:59.620 --> 00:26:00.440
So front towards enemy.

00:26:00.560 --> 00:26:01.740
Exactly. PM maybe.

00:26:02.100 --> 00:26:06.820
And if you're thinking, I've seen that before.

00:26:07.000 --> 00:26:13.660
Wherever I've seen that, Front Towards Enemy, that's usually on the front of the Claymore mines that are directional mines.

00:26:13.900 --> 00:26:14.020
So,

00:26:14.260 --> 00:26:14.380
yeah.

00:26:14.500 --> 00:26:17.320
Oh my gosh. Crazy. I love it.

00:26:18.180 --> 00:26:20.620
All right. That is the show for us today.

00:26:21.400 --> 00:26:21.800
Awesome.

00:26:22.240 --> 00:26:23.220
Thanks for being

00:26:23.220 --> 00:26:24.140
here as always. Bye.

00:26:24.480 --> 00:26:25.180
Yeah. Thanks, Brian.

00:26:25.380 --> 00:26:30.560
And I want to encourage people who are listening, if you're not subscribed to the podcast, subscribing to Podcast Player.

00:26:30.840 --> 00:26:34.680
And if you're watching the YouTube version, be sure to subscribe and like the video.

00:26:35.140 --> 00:26:35.600
Helps a lot.

