Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 262, recorded December 8th, 2021.
Oh my gosh, it's almost winter.
I'm Michael Kennedy.
And I'm Brian Okken.
And I'm Leah Cole.
Yay.
Yay. So great to have you here. Thanks for being here on the show.
Yeah, happy to be here.
You and I got a chance to discuss Airflow over on Talk Python a couple months ago, something like that.
Yeah.
Yeah, but now we'll probably do a little more Airflow over here for people who aren't familiar with that, but also just whatever you're interested in.
So great to have you here. Why don't you tell people a quick bit about yourself before we jump into the topics?
Sure. So I'm Leah and I am a developer relations engineer in Google Cloud.
And specifically, I work on Cloud Composer, which is our hosted managed product of the popular Apache Airflow project, which we'll talk about a little bit later.
And in addition to writing samples and content for that, I also work with a group of fellow engineers and we maintain all Python samples for Google Cloud.
And make sure that they stay tested up to date and are healthy and are getting reviewed for new samples.
And that's a lot of fun. That kind of fell into my lap and has been a good time.
Yeah, that's fantastic.
Yeah.
I remember Python being one of the original two supported languages on Google Cloud, right? It had sort of a special place.
Yeah. Now it's one of seven, I think.
Yeah. Cool. Well, that sounds like such a fun job. I've always imagined dev relations type of jobs to be super fun. Maybe slightly less fun in COVID because the travel and the conferences and, you know, all those kinds of things are part of it.
But still a fun job, right?
Still a good time. Every day is a little bit different. You kind of never know what's going to happen. And that's part of what I like about it.
Yeah. Awesome. Cool. Brian, I don't even know what you're going to cover. So I don't know what's going to happen. Why don't you let us know?
You don't know what I'm going to cover?
Well, I'm not looking at my docs yet.
Oh, okay. Sorry. Fighting it cold. I am super excited. pytest 7, release candidate one, is out.
Oh, that's excellent. That's big news.
It is. The last release for pytest was, or six, they've done other dot releases, but the 6.2 or 6.0 came out. 6.2, I don't know. I lost track.
We use 6.2.4 for our GCP samples.
Oh, you do?
We do.
Well, I think it was, I wrote this down. The 6.2.0 was released on December 2020. So it's been, we're ready for a new one. So 7.0 is out, the release candidate at least. And so because it's a release candidate, to install it, you have to do pip install pytest double equal 7.0.0 RC1. We've got that in the show notes.
It's also on the release announcement page for pytest. But I wanted to go through some of the cool features that I'm really excited about. There's a lot of great things in there.
But there's some little improvements with the aprox thing. So one of the things that pytest has is an aprox. So you can say floating point numbers, if you're comparing them, you should never do equal. But you can do equal aprox with pytest. And it's really pretty cool.
I didn't know that because any science you're doing is so, like double equals is the kiss of death for floating point math comparison.
Yeah. Well, the pytest of Prox does now the docs reference the NumPy comparisons, which is nice because NumPy has some really cool features around that.
But pytest out of the box does. And now also with mappings and dicts and other sets, it handles decimal types, which is nice.
Decimal types, of course, are very useful when working with money and other things that need to be exact decimals.
One of the things that's really cool is the sequences are compared better. So if you have like a list of numbers and you compare against an approximate list of another numbers, I didn't know you could do this.
It will tell you which index was wrong and by how much.
And actually not by how much, but what the expected was. And that's pretty neat.
So those are the little minor features. Most of these are kind of minor, but major for somebody, right?
So one of the things I like is that some people have mentioned fixtures or sometimes when people use a lot of fixtures, they don't know where the fixtures are.
Well, there's a couple of flags, fixtures per test and --fixtures. Both those flags are helpful to find out what fixtures you have available.
And now by default, they print the location of the path with the fixture name.
And you can also do a verbose option that prints out the full doc string, which is pretty handy.
A couple of things that I'm really excited about are a Python path that's been added.
And that was a feature I added to the project, which is fun.
Nice. It's cool to see the contributions you're making coming back out.
Yeah, it's cool. And then there's a bunch of other features that I contributed to by just saying,
this is a little weird. Can we fix this? And somebody else volunteered to fix it.
So it's nice.
That's the best kind of contribution.
Yeah.
One of the improvements in the docs, which is kind of fun, is there's an auto-generated list of...
So I've got the changelog going on here.
And I got to come back to this.
There's an auto-generated list of plugins.
And there's 963 right now.
We'll refresh it.
No, still 963.
But that's a lot.
When I first started writing the beta or the second edition of the Pi test book,
I noticed this and I wrote it down, but the number keeps changing.
So I took out the number.
I'm like, it's a lot.
There's a lot of cool plugins.
One of the things that if you'll notice when you go to the changelog,
it starts with breaking changes and then deprecations.
And I think this is around because people, when they upgrade,
they want to know if it's going to break their code or not.
I have tested a bunch of stuff and upgraded from 6 to 7.
And I haven't noticed a lot.
There was like a 6.1 to 6.2.
I can't remember what the...
There was one break a while ago in the 6x that messed some plugin authors.
But I haven't noticed any problems.
So please try these out.
I wish they would do the features first and then not the breaking changes.
Because that's...
I suspect it's the people working deep in the guts,
like the plugin authors that hit these deprecations
and not just people doing assert this equals that type of work.
Yep.
Right.
One of the things that I didn't list,
but I think a lot of people are excited about,
there's more the objects within pytest that people are using.
More of them are type hinted now so that you can do type hints with objects.
Oh, that's nice.
Yeah.
That's really nice.
So fun.
Leah, do you use pytest?
Some of these changes exciting?
We do.
We use pytest on our Python samples.
And so I actually, the one that was most exciting to me was the fixtures.
Figuring out where fixtures are is definitely something that comes into play for me,
especially when we're maintaining something that was written a while ago
by someone who might not be working on that code anymore.
Yeah.
Nice.
Yeah.
This is great.
I love the pip installable RC1.
That's great.
And before we move on, let's take a step back.
Roman Wright, author of Beanie.
Hey, Roman.
Out there in the audience says,
Hey, I'm a big fan of Google Cloud.
Oh, thank you.
For sure.
Well, I've got some fun stuff to talk about next year.
I want to talk about this thing that David Smith,
former guest co-host here on Python Bytes, sent over and said,
this looks cool.
Sam Lowe and Philip Guell released this thing called Pandas Tutor.
This is cool.
Yeah.
Previously, Philip had built Python Tutor at pythontutor.com.
Now there's pandastutor.com.
And it's all about just helping you understand what the code does.
So it basically says, look, there's this code here.
Like imagine you've got a list of dogs that have a breed, a type, a longevity,
a type is like a herding dog or a toy dog.
It goes in a purse.
Longevity, size, weight, and so on.
And you've got that as a data frame.
If you wrote dogs with a size equal, equal medium, then sort values on type and then group by,
by type and then show the median.
Well, what is that actually doing?
Like, how do I understand that?
Right.
As somebody learning Pandas, imagine I don't really have a database background.
And so I'm not sort of trying to map that over to like, okay, there's the where clause, there's
the order by clause.
And, you know, like that kind of business.
Right.
So what is happening when I write that code, either because I'm coming across it for the
first time or, which happens to me a lot, I wrote it two years ago and understood it perfectly
then.
I have no idea what it does now.
You want to know what it does?
Yeah.
That happens way too often.
Right.
So what you do is you can go and run this code over in Pandas Tutor and you say visualize
and says running a code, please wait.
And so what they do is they put a CSV bit of text in here.
Like a triple string and then use Pandas read and then just do that one line.
So that's a nice way to kind of get data in there.
And the way to think about this is steps.
It shows you what is the first step and what is the second step and so on.
So when you go there, you'll see that it has the code that we were talking about.
But then right now the effective where clause, the filter is regular font and the rest is gray.
It's like fade into the background.
And so you can actually see what the starting data frame was and the ending data frame and
then how it got in there.
And you can use the mouse over like, so what they're saying is the type is medium.
So if you hover over like a large or a small dog, there's just no arrow.
But if you hover over medium, it shows you where in the result that that thing landed.
Isn't that cool?
That's wild.
Isn't that wild?
And so then you can see size has all the values on the left and then the size is grouped on
the right and it shows medium, medium, medium, medium, because that's all that's in there.
Now, when I first looked at this, I'm like, there's a bunch of stuff on the screen.
What's going on?
I noticed the arrows, but then what it took me a minute to realize is there's multiple
steps.
So the next thing, if you scroll down, shows the same code at the top, but now the sort
values type is highlighted, right?
That's the next part of what looks like one expression in pandas.
And so now it highlights the column that it's sorting on.
And you can actually see the arrows pointing to how they were reordered in the result because
you're sorting by type.
So it's non-sporting, non-sporting, non-sporting, non-sporting, and then sporting, sporting, and
working, working, and so on.
So that was step two.
And we have a group by, this one's interesting.
It doesn't have arrows as colors.
So the group by type, again, non-sporting, sporting, and so on, you end up with these
groups.
Like here's a blue, a blue box of all the non-sporting dogs, the bulldog, the poodle, the French bulldog
is so cute.
Then you've got the golden retriever and the Labrador and the boxer, right?
So these are grouped into the colors.
And then finally you do the median and it shows how those groups reduce down to statistics.
The longevity of a non-sporting dog is less than a sporting dog, apparently, but they're
also lighter.
So anyway, what do you all think?
Oh my gosh.
I love this.
This is nice, right?
I'm a very visual learner, so I really appreciate this.
And especially if you're working with data that you kind of aren't sure what it does and
or the code, like that's pretty incredible.
I'm filing this away.
It's going to go in my team's group chat pretty much as soon as we're done recording.
In fact, yeah, it's awesome.
I think it's really good.
You know, there's so many people who are presented a notebook or presented some kind
of result and they're like, I need to understand what that means so I can keep following.
And I think, you know, throw it into here or something like this would be really helpful.
Well, and a lot of people that have spent a lot of time with databases might, it might
be obvious what these things do.
But for people that don't spend a lot of time with SQL, it's not obvious.
And so this is really nice.
Yeah, definitely.
Or if you're like trying to take some example that you have with their example data
and trying to translate it to your own data, that's something that customers do all the
time for us.
It's something I do a lot too.
Just seeing how it behaves with your stuff.
Oh, man.
You didn't write it, but you want to use it.
So how much applies.
Yeah.
Exactly.
Yeah.
So this is quite cool.
Dean out in the live stream.
Hey, Dean.
Says Pandas Tutor looks awesome.
And Robert Robertson also loving it.
It's nice.
So very cool.
Indeed.
All right.
Over to you, Leah.
All right.
So yeah, my first thing today is Apache Airflow.
So Airflow is a project that is part of the Apache Software Foundation.
It's a workflow orchestration tool that originated at Airbnb, I want to say in like 2014.
And then pretty shortly after became part of the ASF.
And it became a top level Apache project in, I want to say early 2019.
It's been a little while now, which is very exciting.
So you can use it to author these workflows as directed acyclic graphs or DAGs of tasks,
which is pretty cool.
And it's most commonly used with workflows that are like pretty static, not super frequently
changing or slowly changing just so that you can see how the workflow goes over time and
not allows you for some clarity and continuity in your workflows.
I've always sort of wondered what the role of these workflow type systems were until I realized,
you know, if you're going to build a full end to end type of workflow without a framework,
there's a lot of coordination.
And what if this fails?
Where do you restart?
What do you do?
And then the analogy for me is kind of like Flask or some web, like all I got to do is
write this little thing and everything else will come together to make sure these four
lines of my Python code run.
They run reliably.
If they fail, it gets dealt with.
Right.
It allows people to not have to understand the whole system and just go, I need you to load
up this file and put it into that database.
Can you write that code?
And that's all you got to know to be part of some complex thing.
Right.
Yeah.
It's I mean, it's not the most glamorous thing, but it is extremely useful.
I mean, I did a summer internship when I was doing my bachelor's where I wrote a cron job
that ingested some data every night.
And the only way I knew if it failed was if I looked in the target folder where it was
supposed to end up.
And if the data wasn't there.
No files.
Whoops.
That sucked.
I'm sure a lot of people have dealt with that.
And this is actually like a really common Airflow workflow, which is the extract, transform
and load the ETL workflow, which is where you have data somewhere that you want to get.
You want to do something to it or maybe not.
Maybe you just want to extract and load it.
And you want to put that result somewhere else, either locally or in the cloud for all of that.
And Airflow lets you do all of that.
And you can see the history of these jobs.
There's a UI where you can see, did it fail?
It has a helpful error message.
If it failed, it's not just, oh, gosh, the data is not there.
What do I do?
Yeah.
You've got a really cool UI where it shows all the parts of the workflow running and whether
or not they finished successfully and stuff, right?
Yeah.
And it got a makeover fairly recently.
So it's had a lot of improvements.
Yeah, that's super cool.
Another thing maybe you could talk about really quick is the connectors.
I don't remember exactly the right terminology.
There's a name for them.
Tell us, tell people about that.
That's also good to know.
So these connectors that you're thinking of, I mean, we can use the word connector to describe
what it does.
There are these things called operators in Airflow.
And an operator executes a single task.
And so that might be executing a bash script or executing a Python script.
But we also have these connectors that are grouped by providers, which might be your cloud provider
or other software providers that allow you to execute code there.
So for example, we have a ton of GCP operators.
One example might allow you to create a data prop cluster or then run a job on that data prop
cluster and maybe tear it down when you're done.
And there are providers that have operators for all the major clouds and more.
You can do it.
There's one that sends a Slack message when it's done.
So if you can dream it, it might be there.
And if not, you can make it there.
That's awesome.
What's GCP?
GCP is Google Cloud Platform or Google Cloud.
GCP might be a dated acronym.
Sorry.
Don't know.
Yeah.
So one of the advantages, I think, of that that's really cool is you don't necessarily
have to know all those APIs.
Like if I was going to connect Slack to GCP to like Azure Blob Storage to like some hosted
database, I don't have to learn all those things.
I can just sort of click it together.
Yeah.
You just have to.
There's a small amount of setup you have to do for auth, which is understandable.
You can't just like publicly go to your Azure Blob thing to grab your data.
But once you set up that connection, then your operators can talk to those things.
And if you use so you can run or host Airflow yourself.
And there are a few different ways to do that.
And then Amazon and Google both have managed hosted providers.
And there's a company, Astronomer, that also does manage hosted ones.
And so if you're in an Amazon or a Google, the advantage there is that the connections
with those operators might be a little bit simpler from the auth and networking perspective.
But other than that, you're you can still like if you're running in Cloud Composer, which
is Google's Airflow, you can still be using the Amazon or the Microsoft operators to pull
data from over there.
That's really common.
And you see it all the time and bring it do some stuff in Google Cloud and either put
it back in the other cloud or leave it in Google Cloud.
That's totally normal.
And people are doing that all the time.
Right on.
Yeah.
Cool.
I think this is neat.
And people for whom that would make sense.
You're like trying to do these sort of running in the background schedule jobs.
Or there's triggers as well.
Like a file has been uploaded or landed here.
Yeah.
Let's talk about that.
So that's actually I had written down this one example, but I'll adapt it slightly since
you mentioned triggers.
So that's another common type of operator.
These sensors where you wait for a certain condition to be true.
And they're used in data analytics workflows all the time.
So like one example workflow might be waiting for a particular file to appear in a cloud
storage or an S3 bucket.
So you'd use one of those sensors to wait for that to happen.
And then you want to do something to that data.
So let's say you then create a data prop cluster that is going to run a PySpark job on that cluster.
And then you can store the results in BigQuery at the end and then delete the cluster and like
send a Slack message when the job is done.
That's a very common ETL thing, including that sensor.
Yeah, that sounds pretty nice.
Definitely seems interesting and quite useful.
Yeah.
Brian, thoughts before we move on?
I have a question.
If you wanted to get started with something like this, I was trying to look for tutorials
and getting started and stuff like that.
Does it make sense or is it too confusing if somebody, you said you could run it on your
own machine.
Does that make sense to try it that way or should you try it with a?
Okay.
You totally can do it on your own machine.
And there's this really wonderful environment that can be found in the Airflow repository that's
called Breeze.
And it's a Dockerized version of it.
It shouldn't be run in production.
But if you're looking to try it out or if you're looking to contribute to Airflow, we highly
recommend that everyone check out the Breeze environment.
Right now, I have the community page pulled up where you can join the dev list in the Slack
if you have questions.
But if you were to go to the GitHub repo, you would see Breeze right on that first page.
Okay, cool.
Thanks.
Yeah.
Great question.
Thank you.
Yeah.
Very good one.
All right, Brian.
Are you going to give us a tutorial on Airflow or what we got going next?
Yeah.
So I was looking through the tutorials on Airflow and I noticed that right away one of the examples
used D-Dent.
How about that for a connection?
Nice connection.
Totally well planned.
Very cool.
D-Dent was suggested.
It's a text wrap tool.
It's suggested by Michael Rogers-Villet.
It's a small utility, but it's super useful.
And I kind of forget that it's, I mean, I use it all the time, but I forget to mention it
to people.
But it comes up a lot.
And the idea around D-Dent is you've got something.
Oh, I think I lost my D-Dent thing.
See if I can find it.
There it is.
The idea is you've got a multi-line string.
Like here we've got Hello World and some multiple lines and there's different spacing.
But I'm, as you notice, I want to define it within a test, within a test function or within
some other function.
And that's, so there's this extra like space at the beginning.
That's, that's in the string.
It's in the multi-line string.
And we don't want that.
We don't, we want it to be just, just no, like nothing at the beginning or the same amount
chopped off.
So one of the options that people have used before is to just define a very multi-line string
out of the function.
You just do it out of the function.
Then it's against, then it's just against the left side of your editor or whatever on column
zero.
And you don't have to worry about it, but it does bother some people that you've got this,
this variable defined outside of your function when you're just using it within one function.
So ddent is the answer.
So what ddent does is it just takes a multi-line string and strips off all the common white space
at the beginning.
That's it.
But it's a, it's super useful.
They've got a little example that we're showing here, but I, I think this is a, not a great example.
So I wrote a new example.
Oops, fell asleep.
Um, and so that the idea really is I've got a function that either, you know, print stuff
or has some output and I want to be able to compare that string and I want my comparison
to be in the function.
Um, so, so I use ddent to just write it right in my function and then I don't have
the spaces.
And then, yeah, anyway, so this is a, a high test example of how you could test a output
string.
So anyway, this really sounds like a classic example of there's a problem, like the open
source, this really bothered me.
And so I wrote something to fix it and it's, it's wonderful.
Like the time honored open source reason to make something.
But, I also want to remind people that ddent is not the only thing in text wrap and text
wrap has a whole bunch of other cool tools.
So it's, it's not huge.
It's just, but a five minute read to peruse what's in text wrap so that next time you need
to manipulate some text, it's useful.
Nice.
Yeah.
Maybe wrapping.
Yeah.
Like wrapping.
Well, it does things like, like if you've got a huge string and you want to be able to
like, one of the things is to, shorten it.
So if you, if you've got a huge string, but you really only have like eight characters to
show something like ellipsize it.
Yeah.
It does that for you.
So that's nice.
That's there too.
That's good.
Cause I've written that code.
It wasn't fun.
It didn't feel useful either.
I'm like, okay, great.
It works.
But here we go.
Uh, some audience feedback, Anthony out there.
Hey, Anthony says it's really useful.
I've still used it many times.
Nice.
Cool.
Mm hmm.
All right.
This next one comes to us from Dan Bader.
You might know him from a real Python and other things.
He and I were chatting and he said, Hey, have you heard about pip audit from trailer bits?
And I was sure that I had, and I thought we had talked about it, but then I realized, no,
I don't believe we have.
So I must've just heard about it somewhere else.
And then we haven't covered it before.
So the idea is we've heard about a lot of issues with supply chain vulnerabilities, things
getting into pip, but also Ruby gems and NPM and so on.
Sometimes that's somebody trying to be evil and putting in some typo squatting thing, or,
you know, worse than that would be if the GitHub account of a maintainer got hacked and somebody
published a package with like to the real package.
Right.
So however things might get into your dependencies, if something is going on bad there, it's better
to know than to not know.
So this pip audit is all about that.
It audits Python environments as in virtual environments and dependency trees for known
vulnerabilities.
So that's one of the things that's interesting is when you pip install things, you might be
very good about saying, Oh, I pip installed flask and I pip installed pandas.
So those are going into my requirements file or my pyproject.toml.
But did you remember to pin their versions so that things like GitHub will say your version
is wrong?
Because if it just sees flask and the recent version doesn't have a problem, it's not going
to tell you.
But the one you have installed may also the transitive closure of the dependencies.
So flask depends on it's dangerous, which depends on, I don't know.
But if there's something down that chain that has a problem, you may have not put that in
your requirements file and you may not be tracking it.
Like I might be paying careful attention to flask.
I might not care anything about it's dangerous, but that's where the problem is, right?
Yeah.
So this tool from Trail of Bits, which is a security company, basically solves that problem.
And it lets you just type pip-audit.
And for me, it's a dash r requirements.txt or whatever.
And from what I can tell, what it does is it will go create its own virtual environment
where it one by one installs each package, looks at the things that come out of that process
and then scans those.
So it's not just looking at, oh, you say you have flask and that's 201.
Great.
You're good to go.
It actually installs it because who knows what the setup.py process is doing and all
those kinds of things.
And then it scans that and it gives you a report.
So for like Talk Python training the site, we have, I don't know, 30 dependencies or something.
And it sat there and it took, I don't know, it probably took two minutes to go through and
it said, everything's good to go.
So that was good to hear, but it's pretty neat, really easy to use.
It's like an external tool, like black or something.
So it's very, a good candidate for PIPX.
And then it's just globally available to point at any environment.
What do you all think?
Oh, this is so cool.
I heard about it because one of my colleagues, Dustin Ingram, I think has been involved with
it or either it's his Twitter that I found out about it from, but he also has a really
good talk from PyCon this past year about the supply chain vulnerabilities.
That's worth checking out if you're wanting to get an idea of why this is important.
Yeah.
We've highlighted a few examples over the years, but it's definitely something you want to pay
attention to.
And that's cool that Dustin was talking about it.
He works, I think he's still working with the PyPA and works on, you know, the PyPI.org
and all those kinds of things.
So very cool warehouse.
Brian, what do you think?
I think this is cool.
I'm going to start using it right away.
This is nice.
Yeah.
I already used it once as well and everything seems good.
So here, look, I even called a flask as an example.
Say here on this particular version, there was this security vulnerability from 2019 and
same with, I guess, Jinja and all those were good.
But yeah, it just, it gives you a nice description of what went wrong.
And like in this case, it's a denial of service attack and whatnot.
So I definitely recommend people pin versions definitely in your requirements.
But what do you all think of including hashes?
I think that's something Dustin talked about in his talk.
And at the time I was like, oh, that sounds like a good idea.
And it's not something I've started doing yet.
Yeah, exactly.
That's exactly what I think.
It sounds like a good idea and I'm not doing it yet.
So anyway.
But that sounds like it's a me problem more than anything else.
Also, it seems like a good idea.
You know, I might be missing a step.
It feels like the challenge you're going to run into there, what you're preventing against
is a man in the middle attack.
Somebody can intercept what's happening with PyPI.org and sneak in some kind of broken,
hacked version.
I don't know.
I don't necessarily trust what goes into PyPI.org, but I trust PyPI.org.
So I'm not super, it's not my biggest worry.
There's like 10 other worries that make me have a hard time sleeping at night about running
stuff on the internet that precedes that.
So I haven't worried about it, but maybe I should.
It's in the queue of things to worry about.
Well, for instance, with this audit, you can pin your stuff and then have it be, check it
every once in a while and install everything and check things.
I don't see why it couldn't be a CI step.
I was actually just going to say that PipAudit, I need to bring it to my samples maintaining
group to talk about who wants to implement it and how soon we're going to do it.
And whose pager rings when it finds a problem.
Yes.
Yeah.
Nice.
Look at that, pagers from back in the day.
All right.
Well, that's all I got for that one.
We're off to Leah.
I'm so glad you mentioned pitting requirements because that is actually, that's a great segue
for managing samples for GCP.
So what I have open right now for Google Cloud is an example documentation page.
I picked Cloud Composer because it's what I work on.
And I want to give an example of where this code lives that I'm talking about that I work
with this group to maintain.
So this is a page that's about using a particular Airflow operator.
And if you were to scroll on it, you will see these code samples and they are all stored
in GitHub and then embedded in our docs.
So you can click view on GitHub on any one of them and it will take you to the linked repository.
You can look at the history, look at everything in context.
So we have thousands of samples for all of the Google Cloud products just for Python, but
we have them in other languages too.
And they're located across hundreds of repos.
This happens to be one repo that has samples for multiple products, but we have other repos
where things are stored too.
So to ensure that there's consistency and that my group of engineers, my colleagues and I
actually have time to do our work and function as humans outside of work too, we use a lot
of automation.
So we use a lot of bots to do things like keep our dependencies up to date, check for license
headers, auto-assign PRs for reviewing, syncing repositories with centralized configurations,
and even more, which is pretty great.
And this is actually where the pinning requirements comes in.
We very strongly believe in pinning requirements because it makes the samples easier to maintain
and test against.
And it's easier to go back to the product and say, hey, you just pushed a release candidate
for your product and it broke your samples.
It wasn't supposed to.
What gives?
Rather than finding out mysteriously when getting a customer issue.
So then to keep it up to date, we use a bot.
And these are some pull requests recently opened by the bot of some dependencies.
They get double-checked to make sure everything looks good by human and merged.
It's pretty great.
And then we actually have a team of engineers in DevRel that works on making GitHub bots that
we use.
And that is totally open source.
So you can see some of the ones that we use.
Like we have our license header one.
The sync repo settings allows us to have a single source of truth for our configuration for all
of our Python repos.
And then it makes sure it gets synced across all of them.
It's pretty great.
I really don't know how I would function without all of my bot friends.
This is super cool.
I can just imagine how much work it is to keep all of those different things in sync.
And I have worked recently on projects where I'm like, okay, I got to integrate this library.
I'm going to go to the documentation.
And I try to use the one or two functions that the whole thing does.
And it's like, nope, that parameter doesn't exist.
Or you're missing some parameter.
You're like, come on, at least just keep the signature, right?
You know?
And of course, it's something like star args, star star kwrs.
It's not like, oh, I can just look in my ID and see, oh, yeah.
It says it takes like, use security, use SSL, yes or no?
Like, no, it's unknown without the documentation, basically.
Yeah.
This is awesome.
Thank you.
I think so, too.
I'm very grateful to it.
And yeah, for our dependency bot, we do use an external one.
I think GitHub is the one that does Dependabot.
We, in particular, use Whitesource Renovate bot.
It's what we were using when I started.
And that works very well, too.
And they're very nice and responsive to issues.
Oh, that's fantastic.
Yeah.
Dependabot was fairly new.
And then it was bought quite recently by GitHub.
So I can imagine you were all doing something before then, yeah?
Probably.
But I know I have friends who use that, too.
And they're great.
Using a dependency bot, I would say, if you need a starter bot for any of them,
the dependency bot is a great place to start.
Yeah, that's fantastic.
I recently switched to pip-tools and PipCompile to generate my requirements with pinned versions and stuff.
Nice.
But before that, I was all about Dependabot telling me if something new was up out and seeking that.
pip-tools rocks.
Yeah.
pip-tools rocks.
I love pip-tools.
Yeah, it definitely does.
Brian, there's a lot of cool automation here.
What do you think?
I'm excited about looking through all these.
I love looking at bots because the whole idea about a bot is like the Unix philosophy of do one thing and do it well.
Yes.
Yeah.
I love that.
Have something else do it and not you do it.
Oh, yeah.
All of our bots are based on like, oh, gosh, we're doing this one thing over and over and we're not doing it well because we're doing it manually.
So how can we like use automation to make sure we're doing it consistently and to save a lot of time?
Like one of the things you've got in here that's shown right now is label sync.
So one of the nice things about one of the interesting things about different groups workflows is to have different labels that mean different things.
But when you open a new repo, it doesn't have all those labels.
So being able to sync those labels across an organization.
Like needs triage, good first contribution, all those kind of things, right?
Yeah.
As I said, we have hundreds of repos just for Python and we use things like we have labels that say what API something belongs to.
And that helps with the auto assign bot to make sure that issues and PRs get routed to the right team.
Otherwise, you're having a human do all that triage, which is fine, but doesn't scale super well in our use case.
Yeah.
And adding a label is really easy to an issue or something.
So having a bot that looks at label changes and just does an action based on that is a brilliant use of time.
Yep.
Highly recommend.
Yeah.
Fantastic.
This is great.
And you have an install link next to all of them.
Does that mean I just click that and install it into one of my repos?
I believe that is the intent.
And if it doesn't work, you should open an issue on this repo because my colleagues are very responsive.
Fantastic.
Yeah.
And we just need bots to generate bots.
Honestly, if my colleagues told me they were working on that in this repo, I wouldn't be surprised, but I don't know.
The meta bot.
Yeah.
Fantastic.
All right.
Well, how about some extras?
Brian, you got anything extra you want to?
Share while we're here before we call it a show?
No, just I'm fighting a cold.
Hopefully that'll all be over.
Yeah.
Well, maybe some sort of audit thing.
We'll check your health status.
We can run that against you.
Leah, anything else you want to share with us?
Oh, I mean, on Twitter earlier, we were talking about HTTP status codes and it reminded me of still my forever reference for HTTP status codes is HTTP.cat.
Yes, HTTP.cat is fantastic.
It's so good.
It is so good.
Let me share a few non-funny things and then we'll mix that in with our joke.
Please do.
Fantastic.
All right.
The first one has to do with, speaking of GitHub, another cool GitHub thing.
You know you could press a dot and that would do certain things.
This only works if you're signed in.
But now there's a command palette.
This idea of command palettes are becoming popular in UIs.
We've got it in VS Code.
We've got it in like superhuman, the email.
And often you get them by pressing command K or control K.
And now you have that for GitHub.
So if I were on a repo where I could do stuff to it, I could hit command K and then it will say, what do you want to do?
Search or jump to.
I could go to pages, issues.
I could look for, let's see, look for the app.
If I just type app, it'll search for those.
I could search for all sorts of things here.
And boom, it takes me and shows me all the apps.
Isn't that cool?
That's so cool.
Command palette.
Yeah, that's now a thing.
That's beautiful.
And you could just, I mean, no mouse.
I'm here.
I'm in this repo, the top level.
Command K, down arrow, two times, hit enter.
I'm on the issues.
Oh my gosh.
Love to see it.
Yeah, so that's a good one.
The other one, the other extra is Python 310.1 is out.
Released December 6th.
So as in two days ago.
Wow.
It's got a fun little snake with a hat on.
Love it.
That's really about 310.
So let me describe.
I can cover the entire release for you.
So Python 310.1 is the newest major release of the Python programming languages.
It contains many features and optimizations.
So now you all know what's in it.
It's very vague.
Apparently it has 300 commits of changes and fixes.
One thing I would, I wanted to know, are there security updates?
Yes or no?
Should I install this if I'm curious?
Should I install this now before tomorrow?
Because someone's going to start poking around.
I would love if it would say that.
There's a great thing about the major features, but that's just 310, not the point release.
Well, we'll have to check it out.
Anyway, still good.
Yeah.
We've been having fun making all of our GCP samples, making sure they're 310 compatible, which we're getting there.
It's all waiting for certain dependencies to be ready.
But a lot of fun.
Very exciting to see.
Yeah, that's awesome.
Well, you can look at the changelog.
So if you look at the 310, the changelog, you can see 310.1 and stuff.
I can.
Yeah, go up a little bit.
Full changelog there, maybe?
Yeah.
Yeah, that's true.
I can go to the changelog there and check that out.
But having a security thing would be an idea.
Yeah, just like.
A TLDR.
Yeah, exactly.
Exactly.
Cool.
Well, and also a lot of people didn't want to try 310 until we got one patch release.
So now we have one patch release.
So there's no excuse.
So now it's safe.
I have been running it for a day in production and it seems okay.
Put it on one site to see if it would hang in there.
It seems fine.
So we're all good.
Yeah.
All right.
The samples that are using it are doing fine.
They've had passing periodic builds for a while.
Yeah, fantastic.
All right.
Are you ready for some cat jokes later?
Sorry.
Yes.
I mean, we started our conversation off today talking about cats.
It's true.
Before we hit record.
So I feel like we should round that out.
Definitely.
So first of all, htpstatuses.com is a fantastic place to go learn about the real meaning or
the official meaning, let's say, of status code.
So for example, there's 100 continue.
And if you want details, you click on that and it actually pulls this all up.
Even shows you like the enum in Python.
Oh my gosh.
I love that.
Isn't that cool?
Yeah.
It gives you the meaning like 100 continue.
The initial part of a request has been received and has not yet been.
Yet been rejected by the server.
The server intends to send a final response eventually.
And so there's other ones like 200.
Okay.
201 created.
Let's see.
What else should I point out?
304 cache, not modified.
400 bad request.
Bad request.
404 not found.
403 forbidden.
500 internal server error.
Yeah.
418.
I'm a teabot.
Yeah.
And 502 bad gateway.
Okay.
So let's do yours firstly.
Please.
I put it.
I put out this joke and you said, this is good, but oh my goodness.
But yeah.
So when I was doing my computer science degree, a friend shared with me, HTTP.cat, when we
were learning about HTTP status codes.
And if you go there, you will find one cat per HTTP status code representing what is going
on.
And I'm not going to lie to you in my professional career.
I still use it as a reference because it's my favorite one.
And you can even, if you go to like HTTP.cat slash 200, it returns a JPEG of a cat that's
like, okay.
Yeah, exactly.
And you can do that for all of the status codes.
201, the cat has walked through some wet cement and that's 201 created for footprints.
Let's see what else we got in here.
Some good ones.
404 not modify.
304, sorry.
The 404, the cat is hiding under some wrapping.
Not found.
Fantastic.
Yeah.
I love this.
I had not heard about this and it's glorious.
Thank you.
Well, wait, what's it?
Does there, is there a 418?
There is.
Of course there is.
I'm a teapot.
A kitten and a teapot.
Literally inside of a teapot.
All right.
So I saw this joke by Breen, who is John Breen, and thought, that's really funny.
What he did is he put his own personal take on what status code means.
And I thought they were hilarious, but I thought, you know, let me take a shot at this as well.
A little more Python focused.
So I'll link to my tweet.
I put this set of colloquial meanings of the HTV status codes.
All right.
You all ready for this?
Yeah.
Do it.
So 200 is, what's up?
All right.
All good.
201.
Hello, creator.
304.
Not modified or cached.
It's same old, same old.
403.
Permission denied.
It's get off my lawn, kids.
That was my favorite.
404 is just, there's no message.
It's just not there.
It's just not that that's the message, but it's just blank.
500 is we're bad at APIs.
I love that.
Server error.
400 is you're bad at APIs.
Yes.
Yeah.
The real cardinal sin of APIs is 200, but in the body, there's a JSON that says error
and a reason.
Oof.
200, but with error text, we're really bad at APIs.
Yeah.
502, we're bad at deployment or DevOps because part of the infrastructure can't get to the
other part.
And Brian's favorite, 418, is it already April again?
Yeah.
Because the reason is that was actually put into the spec as an April Fool's joke and they
left it.
I'm a teapot.
I love that they left it.
I do too.
It's like import this.
Just stuff that's fun that should just always be there.
Yeah.
What's the harm?
Just leave it there.
Anthony, the live stream has some feedback for you, Leah.
These status codes using cats.
Well, I never.
I mean, where there's internet, there is cats, no?
Oh, of course.
Why we created the internet in the first place is for cats.
Exactly.
All right.
Well, I think that's it for our show.
Brian, thanks for being here as always.
Thank you.
Leah, thanks for joining us.
Thank you for having me.
Thanks for listening, everyone.
Yeah.
You bet.
See you all later.