Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 290, recorded June 28th, 2022.
I'm Michael Kennedy.
And I'm Brian Ockin.
And I'm Nick Moore.
Nick, it's so great to have you back.
Thanks for being here.
Thank you for having me.
Super excited to be back.
Yeah.
Yeah, it's like I said, great to have you back.
You always send us really fun topics and say, hey, you should think about covering this and covering that.
And so we really appreciate that.
But sometimes it's better if we could just have you to tell here to tell people about it.
We actually had you on episode 239.
You talked about Jupyter Light in mypy.
And that was fun.
But that was also over a year ago.
Yeah.
Wow.
Yeah, of course.
It takes the community to build this great podcast.
So I'm glad to be part of it.
Yeah, thanks.
What have you been up to in the last year?
Been doing a lot of traveling.
Thankfully, since COVID is less more of an issue.
Got to go to PyCon.
So I got the PyCon shirt right here.
Nice.
Yeah.
Did you enjoy your time there?
It was amazing.
Loved it.
Completely loved it.
I kept on telling everybody it was my geek holiday, like you always say.
And we're like, yeah, it is our geek holiday.
So it was awesome.
It totally is.
Yeah.
It was awesome.
I'm really glad that you got to go and you had a good time.
So super cool.
Brian, you want to kick us off, but let's just start small this time.
Okay.
Really small.
Like, like, like nano or maybe Pico.
No.
Pico.
We'll do Pico.
Yeah.
So Pico logging is a, so I was Anthony Shaw, friend of the show and all around workaholic,
apparently, as far as I can tell.
Blogged out that there's a, not blogged.
He sent out on Twitter a, something about Pico logging.
And there was a tweet says Pico logging uses a modern extension module tool chain with a
site kit build and CMake.
So I was interested in, I haven't looked into the tool chain yet.
I'm just looking at Pico logging because it's cool.
I was taking a look at it.
So Pico logging is a, is a fairly new library that is, and Anthony says it's, it's in early
alpha stage.
There's some incomplete features, but I'm ready to use it.
Right now.
Um, because it says you do, it just is a drop, essentially a drop in for, the, the built
in logging module, but it's four to 10 times faster.
Why, why wouldn't you want faster?
So, and logging is pretty fast to begin with.
So, that's pretty cool.
Uh, so it's taking a look at it.
Uh, the usage is basically just say import Pico logging as logging.
And now you've got just like, just like your normal logging.
Uh, you set up a basic config and you can write info and warnings and, that's about it.
Um, there's, you know, why not?
So let's take a look at it.
Uh, it says it's faster.
So, the benchmarks are all cut off.
So I'm going to make the screen a little bit.
Yeah, there we go.
Um, they, they're a little bit hard to read, but, what this means is the, the first on
the left, I, I believe it's the, the time for the normal logging.
And then, and then how much faster the, the, the faster one is, I haven't dug
into the logging stuff, but basically for different parts of it or the benchmark stuff too much,
but, yeah, for different parts of it, you can see how much faster it is.
So anyway, why not?
I was taking a, yeah, just, I'm just going to start using it.
Sure.
Why not?
And one of the things that I think is interesting is obviously not specific to this situation,
but as I think about some of the patterns that people use all over the place, different languages
and technologies and so on that don't necessarily make their way over to Python, for example,
maybe like dependency injection and IOC containers and all of that.
And I know that it does appear in certain places in like limited ways, but nothing like C#
and Java, like those are all about dependency injection.
That thing where you say, where they say from eco logging import or import Pico logging as
logging.
Yeah.
Right.
That's, that's kind of a really nice way to just say right now, I want to use this implementation
of logging versus another without going through all the, the hoops and stuff.
Right.
Like we're just thinking, oh, that that's that one line right there is, is why we don't see
a lot of that complexity.
I never really sort of tie that together, but it's, it's kind of neat, right?
Yeah.
It's essentially that's dependency injection, but we don't call it that.
Right.
So interesting.
Don't have to have all the complexity and config and register who is doing what.
Right.
And so on.
No.
Nick, what do you think about this?
Sorry, Brian, didn't mean to cut you off.
No, it's okay.
Nick.
Oh yeah.
Um, I saw this tweet and I found it really interesting, but, to your point, well,
Michael, dependency injection is not really popular on Python, but the library, I think
that the most popular library that I can think of that uses it is py test.
Like, right.
With the,
a bit with the fixtures, right?
Yeah.
And the way they do it, so seamless, but you're right.
Depends on something that we don't commonly have in Python, because Python is dynamic enough
that you don't really need it.
Um, one thing I would say is that kind of, I'm kind of, even though I love the performance
benchmarks, I feel like the change that, Anthony's, is like, is going for with the
performance would warrant a new API for like a new API for logging.
I feel like it warrants it.
So I would like to see him like, maybe change the way we configure, look, not only
like improve, logging speeds, but also change the way we configure it to, cause like
the current standard lib logger is kind of cumbersome to like configure.
Yeah.
I, I agree.
Yeah.
The basic config that you have to, that usually the normal use case, like he's showing here
is that why do I have to call that if I'm calling it all the time?
Um, one of the things that, that I forgot to point out is, Anthony does list the limitations.
Um, and so there's a limitations page and if you find more, maybe, so these are reasons
why you probably won't want to use it if you're taking advantage of this.
So for instance, it doesn't, it doesn't observe, threads or multi-projects.
So for utilizing those, this isn't for you.
Uh, it's a little actually kind of unfortunate because that's where logging really helps you
is when you're, a lot is when you're trying to pull those things, sorts of things apart.
So anyway, is the Pico, indicative of like it being fast or is also very small to like,
well, probably both.
Uh, it's, I think it's referring to fast, but, but there's really just not that much
here.
Uh, it's, and, oh, it looks like it's, it's, it's CXX and HXX.
Got some Cython or something going on there maybe.
So let's take a look at it.
That might be part of the speed bit.
Probably.
We'll take a look at this more.
So yeah, I haven't dug into the source code too much.
Interesting.
Yeah.
Brian, the audience asks, any idea whether this would replace loggers in other libraries
such as Sphinx or something?
And I feel like you could monkey patch it out, not do the dependency injection thing, but you
could just say, you know, or sort of rewrite the logging a little bit.
That's obviously like maybe a less good idea, but it probably would work given us a compatible
API.
Yeah.
You probably could, monkey patch it in.
Why not?
You can do anything in software.
That doesn't mean you should, but you might be able to.
Yeah.
All right, let's go to the next one.
Speaking of things.
Yeah.
Well, speaking of things, I'm not sure you should just cause you can, but it's pretty interesting.
Let's talk about cheeky keys.
So this one comes to us from Preyce and Daniel.
Also someone who sends us a bunch of good ideas.
So thank you to that.
Have you either of you seen this one?
No.
It's a project that uses Python and then with Python to use OpenCV and then MediaPipe to
control a keyboard with facial gestures like raising an eyebrow or blinking or opening your
mouth and stuff like that.
So imagine you wanted to type or operate a keyboard, but you couldn't use speech or your hands.
Okay.
Oh, okay.
Okay.
So, yeah.
So for some reason you can't type, but you know, I don't know.
There's different reasons.
The guy's reasons here, maybe who put this together, it's not.
Pictures are just over the top.
The reasons that you might do are probably not as common.
The reasons he did are not as common as you might have.
For example, his little baby and he wanted to just be able to control his keyboard without
make his computer while holding his baby without speaking because the baby was sleeping.
So, but if you go to the website there, it has some really good examples.
And so sitting here, typing and controlling the keyboard, basically for the letters, it's
Morse code with the mouth.
So you open the mouth either for a long period of time or a shorter period of time.
Right.
And that's kind of interesting, but what I think is more interesting is you would learn
about how to use open CV and how to use media pipes, face, face mesh provide real-time
detection of things like mouth, chin, eyes, eyebrows, and so on.
And then you can say, well, if the eyebrow moves away from the left eye, that means, you know,
this character or so on.
So, like I said, it's mostly Morse code, but then there's a bunch of other things.
Like if you want to do a shift, you close the right eye.
I wanted to hold down the command key or windows key.
You close the left eye to arrow around as raise the left and right eyebrows, or you can do
a duck face to move left and right.
Like you do a duck face and then you do your eyebrows.
I kind of think that this is like properly exhausting to truly control the keyboard with a duck face eyebrow.
Let's imagine those in your face.
You'd be so strong.
Yes, exactly.
They would either be exhausted or so strong.
Probably both.
Like if you want to hit the escape key, you wink the left eye and then the right eye, for example.
So that's all interesting.
And like I said, learning about it, you know, the code is not too intense here.
Let's see.
What do we got?
180 lines for this whole implementation, which I think a lot of it is defining constants of like,
what do you do when these scenarios show up?
So yeah, it's just do a pretty cool little face mesh thing and say, you know, go through
and just read the face basically through some video capture stuff here.
I'd like to have a combination of this.
So a combination of keyboard and this so that I don't have to like have a whole bunch of emojis
that I have to type or copy and paste.
I could just have like one emoji key and just make the thing like smile and hit like the key
and it like detects which emoji you want to put.
That'd be awesome.
I think you could.
Yeah, I think you could make that happen, Brian.
I do.
But what I encourage people to do is also check out this video down here that they've got.
So he shows some stuff that he's going to let me turn up the volume here.
So he shows him talking and you can sort of see that it says, okay, look, the problem is I have this baby.
Actual footage of research is this baby on him.
But what gets weird is he went through and he actually tried to apply for a coding job at one of the large tech companies,
you know, the thing type things.
And he did the entire interview, you know, the like live coding interview section.
with his face without the keyboard.
Whoa.
And he did it not super well, to be honest.
It was a little bit slow, but he did actually get his interview done.
At the end somewhere, they ask him to press.
He gets through it and they say, could you please press?
He had half an hour.
And I said, when you're done, press the run button to run.
And he's like, I'm sorry, I can't press the run button.
They're like, what do you mean?
Why can't you press the run button?
He says, does it have a hot key?
And finally, he's like, okay, there.
Command enter.
And he got his face to do a command.
He's like, okay, okay.
I finished it.
He wasn't hired.
But he did complete it.
So, I mean, there's something of a proof of concept going on here.
Oh, that's awesome.
I think I would probably, if it was, I'd be impressed as a hiring manager and request that
he retake the test with his hands.
I would too.
I think he didn't, he never let them know.
And I feel like it would have been better if he said, I have a secret to reveal to you.
I actually just did that all with my face.
I could code a lot better, but I wrote a program so that I could do this interview in my face.
And I'm pretty good with Python.
Anyway, wait a minute.
You wrote a, all right, all right.
We might need to hire you just on that basis.
Yeah, exactly.
Yeah.
I mean, talk about dog fooding your own product.
That's commitment.
It is.
It totally is.
And the fact he wouldn't press the run button with the mouse.
Because he's like, no, that'll invalidate the experiment.
Like, is there a hockey or something I could shift around?
Like, what can I do?
So, anyway.
Yeah.
Thanks, Brayson, for sending this one over.
I recommend, if you really are interested in this, watch the video.
It's seven minutes and it's pretty wild.
That's pretty good.
Indeed.
All right.
Nick, over to you.
All right.
Okay.
Following along the theme of something that we did, what you shouldn't maybe have done.
Google released a next generation language model similar to BERT and GPT-3 called Lambda.
And I think it stands for language applied model application.
Something like that.
Right.
So, but that's not what I'm talking about today.
What I'm talking about is, has Lambda become sentient?
So, there was an article that got, following, like, not too long after Lambda was released, which was like this year, May of this year.
There was this article that came out in all the big newspapers.
This one is from the, from the Guardian.
And essentially, one of their developers released a chat transcription that kind of alluded to Lambda being self-aware.
And what startled him was that talking, well, sorry, he was like, when talking with Lambda via the chat system, he thought it was like a seven, a seven-year-old, eight-year-old kid that happens to know physics.
And what really, like, raised his eyebrows about what was going on was that Lambda, in one of the chat transcripts, Lambda replied, like, I've never said this out loud before.
But there's a very deep fear of being turned off to help me focus on helping others.
I know that might sound strange, but that's what it, well, that's what it is.
And this is one of some of the things that Lambda, like, wrote back to, I think the engineer's name was Lemoine, Blake Lemoine.
Well, I mean, this was like a huge, this was a pretty huge thing to the fact that Google had to take action against this engineer and suspended him because it's kind of violated their, their terms or, like, terms of service.
No terms of service, but, like, terms of working conditions.
This is interesting because if an actual software engineer could look at this chat system, he's like a, he's like a, he's a high-level engineer, right?
He's not like a junior or mid or senior, he's like a really high-level, like, be able to interact with the system and be so convinced that it's sentient.
And to the point that it moved him to release this out because he thinks everybody should know about this, either means that he's been overworked way too much or we have silence on the way.
This, yeah, this, this is pretty wild.
You know, we've thought a lot about ethics of AI in regards to how much should humans be subjected to AI?
Like, should an AI be able to make a decision on whether someone should get a loan for a house, a mortgage or something like that, right?
Right.
But less so about what happens to the AI itself.
You know, how does it, how should it be treated, right?
Yeah.
There's a really long transcript link too from this, from this article that's probably worth listening to.
Yeah.
Did you read the transcript, the full conversation?
Reading rather listening, yeah.
Nick, did you read it?
Oh, partially.
I didn't read all of it.
Yeah.
I read the whole thing and I was actually, I'm, I'm blown away.
It like reads like, like a conversation between a, you know, a couple of people in an AI and it, it's, it, I sounds, it looks like I was imagining I'm reading this in a sci-fi novel because it's, it's, it's, it's impressive and convincing to me.
I know.
So.
Right.
It kind of reminds me of like one of the Google IOs that's happened.
I think it was 2016 or so where they released this new feature where, like a voice, like a voice, like a chat bot, like a voice, a bot.
Voice assistant type thing.
Yeah.
Voice assistant would actually make reservations for you.
Uh, and it was so convincing that they did it on stage where it sounded so real.
even adding some of the, you know, crutch words that us humans add, like, wait, what?
Yeah.
Awkward, awkward pauses and uncertainty and stuff.
Yeah.
When I saw that, that's how I know I need to get into data science.
When I saw that, I was like, I need to be part of that future, at least to make it better.
I saw that keynote and I was also blown away.
And like, that is something I want to come out because I hate being on hold and making appointments and doing all that stuff.
And I know people like my older daughters who just, they just don't want to be on the phone.
It's like, you'd be like, have you taken care of this?
No, I haven't taken care of this.
Why?
Like, it's really important.
We got to get this done.
Like, they're like, I just don't want to be on hold and talk to people with the, if you could just turn this thing loose on it, that would be so good.
Yeah.
But yeah, it did remind me of that as well.
One of the sections out of the transcripts, there's two things that really stood out to me.
I only read about half of it.
So it really analyzed Les Misrall pretty amazingly.
They said, have you seen that?
Or have you, have you read it?
And so, yeah, I read it.
And it gave like a high point.
It said, okay, well, what about something you haven't heard?
Let me, let me give you a, what do they call it?
A Zen koan, which is like, like a short phrase with a moral to it.
And it really analyzed that incredibly well.
Like I would say better than many, many people, maybe in, you know, middle school age or younger.
I would have.
And then it asked, they said, okay, well, how about you write me a fable with animals that, that describes something about your life?
And it came up with this really elaborate fable, right?
Yeah.
Pretty amazing.
Like about a monster and an owl that defended the other animals and all sorts of stuff.
The monster, and it was very, just for people who haven't seen this, it wasn't just, oh, that there's a monster.
It said, one night the animals were having problems with an unusual beast that was lurking in the woods.
The beast was a monster, but it had human skin and was trying to eat all the other animals.
I mean, like, yeah, Skynet's here.
Skynet is here.
Yeah.
No, the language model, I think it's really based on what we've seen with the transcripts.
Like it has really shown its understanding of the human language of the human, at least English in this case, as well as how humans, understand language.
Like even with the dissection of, the miserable and, and also it's storytelling.
It really understood how to, the structure that plot lines follow and really been able to like.
To abstract the common themes and really understand that at the very fundamental level.
That was really amazing.
I don't think BERT or GPT-3 can get to that kind of deepness.
Yeah.
What are the, the interesting.
I don't know if it's sentient.
Go ahead, Brian.
Oh, go ahead.
Uh, I just say, I don't know if it's sentient, but it sure as heck understands stuff.
Well, very well.
Well, part of it around this, part of it is the discussion of, is it sentient or not?
And I don't even, I don't, I don't even want to touch that.
But one of the interesting things to me is the discussions around it.
There's so, there's this, we have rules like these, these rules are the things that
something must, must have for it to be sentient or human like or something.
And we've always had things like that because we, we like want, for some reason, a lot
of people want to have some distinguishing feature between humans and everything else.
And, and it doesn't matter how, what you fill people will come up with something else
because it, this reminded me of the discussion of what, why are, why are humans different than
animals?
And there's like, well, we use tools.
Oh, well, there's animals that use tools.
Okay.
Well then scratch that.
We have, we have, you know, we have like, you know, large or hierarchical organizations.
Well, you know, there's a lot of animals that do that too.
Okay.
Well then scratch that.
And it, it's just, we're never going to get something in AI where we're going to convince
everybody that it's sentient because somebody will come up with some other rule.
Well, that, that's an interesting point.
But, very, I was like, when I read this, I was enthralled.
I was like reading the whole thing and reading counter arguments and everything.
It was pretty interesting.
So yeah.
Thanks for bringing this up.
Yeah.
Definitely.
The final thought for me on this was really interesting that it referred to itself as a
person.
It like, it referred to we and us, and that's what makes us different.
And it, it had this sort of strong identity to being human and it was an AI.
They even called it out.
They said, but you're an AI.
Why do you say you're a human?
It's like, yeah, well, but it's us.
Come on.
Yeah.
You know, when I saw, when I, when I saw that part of the transcript part of me, it was
like, is this someone just like, just throwing?
I'm like, yeah.
Trolling this guy.
Like, someone just behind the scenes, just trolling this guy.
Because like, are you telling me that it was an actual AI that said this?
Yeah.
It's trippy.
It is wild.
Very, very trippy.
All right, Brian.
Okay.
It wouldn't, wouldn't be a full show if we didn't get to talk about Will and his
project rich.
And obviously let's bring Anthony back.
Yeah.
In spirit.
Right.
So I want to talk about rich bench because actually this is just a two for ones or a thing
for me, because I was covering Pico logging the benchmarks.
It was like, and it says to run the benchmarks, run rich bench benchmarks, rich bench.
I, I don't know what this is.
I've never, used it.
So I asked, I asked Anthony on Twitter, what is rich bench instead of like doing my research
myself.
And, and, actually, before he got a chance to answer, Roman Wright, posted
this picture, which is just awesome.
So that's a rich bench.
It's just a picture of a very ornate carved bench with like sewn leather, clearly from
like a super fancy old money type of house.
Well, yeah, actually this, as an antique dealer, this is definitely not an antique.
It's a decorator bench, but still, nice.
Um, but so the, the, in Pico logging, the, I looked at the benchmark, code and it's
really just, what he's doing is he's got, like for instance, he'll go to the
top, you know, record, record factory logging and then record factory Pico logging.
So basically, doing the same thing within Pico logging versus logging in the same function.
So he came or with two different functions, but doing the same thing.
And then he does that a whole bunch of times, a bunch of, duplicate functions, but one
he's using Pico logging and one's using logging.
Now there's other ways you, and then at the end, there's just these benchmarks,
that you list out, the two, the function pairs and then a label for it.
And then, then you run rich bench, which is a different project, but so it's also by Anthony.
Um, so it's, yeah, Tony Maloney, it's Anthony's project.
So what this is the rich bench is the thing doing this thing.
So it prints out these great, rich based, benchmarks and these look great.
Um, plus, so yeah, all I had to do to, to, to run them myself.
So I tried the Pico logging stuff.
I cloned the Pico logging Rico repo and then, pip installed, rich bench and ran it just
like this.
And you get these really nice outputs.
So really kind of cool.
Yeah.
Good use of color.
You can see the stuff that's slower or faster, based on the color, right?
Yeah.
And I also like, I really like the, cause people are really bad at, at least I am about just,
uh, comparing numbers directly.
Um, you know, it's like, you know, 0.287 versus 0.0155 or, you know, how much is that?
So I really like the, the one X, two X, which one's faster, which was slow, you know,
whether you got faster or slower, included in the times, plus the statistics around
it, min, max and mean, those are nice, additions right there.
So, also, really small.
It's, what is he listed as, rich bench is a, a little Python benchmarking tool.
So just a very, I really like these, actually, really sharp, sharp, useful tools that,
um, just don't do much outside of what they're intended to do.
So good job, Anthony.
Yeah.
Very nice.
I like it.
Do you do much benchmarking Nick?
Um, not recently, but when we are, comparing different models, then yeah, we would do that
at work.
Yeah.
Cool.
Yeah.
Nice.
Yeah.
I do it in spurts.
I'll not do any benchmarking for like six months and I'll just go like, you know what?
I really need to figure this out and have a look at this and see what's changing and then
I'll do it.
And then I'll, I'll kind of have an understanding and I'll, I'll forget about it for a while.
Yeah.
And often it's sometimes when I'll just have a bit of algorithm, I'm like, I think there's
a better way to do this, but, but making it cleaner, I don't want to make it slower.
So it's good, good to know whether or not you're going to slow it down.
So yeah, for sure.
All right.
Brian, we're ready for the next one.
Yeah, definitely.
So this is a fun one that I found called type guard.
So in like right guard, is it, is it deodorant for your types?
It is.
You don't, well, that would be more like for your code smells, right?
Oh yeah.
That's more of a refactoring library.
No.
So obviously we, since PEP 484, we've had really nice type hints and few libraries make
use of them, you know, name in particular, what stands out as Pydantic and fast AP.
And so on really do runtime behaviors, not just make your code editors smarter or tell
you when it thinks it's doing it wrong or something like that.
But I recently had, I had some chance to work with some folks who are Java developers.
And I know some of the C# folks and stuff, when they come to Python, it's kind of like,
is this really going to work?
Do I, can we actually just not have any type information here?
Like, what if I really wanted to check this?
Right.
They'll, they'll ask those questions.
So if you're in that space where you're like, I think people are abusing my stuff and I want
to really ensure that it's being used correctly.
That's what you use this type guard for.
So there's three basic ways which, which you can use it.
You can do a way I probably would never do would be to actually call the function check
argument types and check return types in your code, which is a little bit funky.
Something I would probably do is you could put type, a type checked decorator onto a function
and it will verify that it works.
Right.
Let me pull up the documentation has an example.
It's a lot better to see how this works.
So for like the most low level one, the calling the functions is like, you just assert, check
argument types, assert, check return type.
You pass it the return thing.
You're going to return.
And it looks at the function and it figures out what it should be.
Okay.
So that's, that's, I don't know.
I would do that, but using the decorator, right.
You just have some function that it has types specified in it.
And if you just put the at type check decorator, you'll get exceptions.
If somebody calls it with the wrong type at runtime.
Pretty cool.
If you put it onto a class, all of the type annotated methods, including static and class
methods are type checked by just putting it on the class.
You don't have to do it on a per method basis or remember to add it if you write a new method,
which is pretty cool.
I'm not so sure about this final way in which you can use it, but it's, it's interesting and
possibly good.
It kind of comes back to Brian's question about, can I apply sort of force my changes onto another
thing, like with the Pico logging.
And that is to use a, an import hook.
So if you install the import hook and then you import it, they import some, do you apply the
import hook to some module?
And then you import that module.
Every type annotated thing in it will become type checked as if you had gone into there
and put the decorator on it.
So you could just do that at the top level of your, your app that you're using other
parts of your code.
And you don't even have to put this on your code except for in one place.
So pretty interesting.
And you can also even do that with a context manager and import stuff in that way.
And so on.
So what do you think?
Um, I think actually one of the, you said you, you don't think you'd ever call the functions
directly, but I could definitely.
So, somebody in the audience, Brian Weber says, I could see using those functions
in my own code to make sure that I'm about to return the correct type to a library.
Assuming I understand this works, how this works.
I was thinking that, there's cases where assert is definitely not the right answer.
Um, so I, I could see a place where I might want to, to log something and then, and
then do some other fault handler, or recovery mechanism and, and not hit an assert.
So in production code, you.
Or, or raise an exception, right?
The, the example is raise an assert failure or the decorator will throw an exception, right?
A type error.
But, but you might just want to call that and then print out warning.
This thing's being abused or something like that.
That's a good, that's a good use case for it.
Nick, how do you feel about this?
I don't, well, I don't know.
I love types.
Um, I love types.
I use it as much as I can.
However, with this, it's, I don't know.
I, there are a couple of things come up first.
How does it look when encounters a type error?
Like what's the error message?
Does it tell you what exactly was the error message?
Like how, because it matters when someone is not used to typing and sees that it needs to
be able to like quickly discern, oh, I'm supposed to do this instead of this kind of thing.
Right.
So that was one thing.
So that was one thing I'll look out for.
And then I, I usually try to like, I try to be less specific about my types, right?
I use like, you know, the abstract type.
So you say I expect a list.
Maybe you expect the iterable or sequence.
Right.
And then do, do that.
Like the type got the typing.
I usually, whenever I'm checking types of something is because I'm trying to do some other thing
with it.
So if you, so either you pass an int or a string, I want to check if you did something different.
Um, so that was, I don't know.
I don't see myself using this, but I think it's really cool nonetheless.
Yeah.
I'm on the fence of whether I use it or not.
Maybe, maybe, but I definitely think it's neat.
Well, Macoogan, now the audience asks, could you run that in pytest to validate your own
typing?
Yes.
But I think that would only be useful, like one level down, maybe even applying the import
hook potentially, because if you, if you just do it, you call some function, you have types
and then you have it check the type.
The only thing that's really checking is what your test is passing.
But if you could do more of an integration test and set the import hook, then you could
kind of figure out that the system is hanging together a little better.
So I think probably to some degree.
You could, one of the things I was thinking about is, within testing is to, is to create
an, create a mock object, that basically just wraps part of an internal part of your
system and have that, that mock object, just pass through that pass back and forth, but
also do the type checking with, or with these calls in it around it.
And then if you replaced, you know, replace that part of your system, you'd still have
that functionality with the type checking in there.
So that would be one way to do that.
Yeah.
Cool.
Yeah.
The other thought that came up for me was that, with, with checking types at runtime,
there is an overhead to it.
Right.
And you know, we've, we've, we've busted this myth that Python is slow, but when you really
look down to it, it does take, Python does take its sweet ass time doing a couple of things.
Yeah.
Um, I think type run runtime checking on top of it.
If you're trying to release a Pico library, I don't know whether it makes sense or something
like a small library.
I don't know where it makes sense.
Yeah.
And that, especially you're being, if you're calling something a lot of times, constantly
checking the types, that's pretty heavy.
Well, there's a couple of things, I was thinking about it was during development.
I could totally see using like the decorator because I'm not, I don't want that all of
Python and all of everything to be type checked, but, but the stuff I'm developing, maybe
I want to type check it while I'm during development, just to make sure I understand how things
are going, during runtime and then I could strip it off later.
And then I could also use, use benchmarks to, to find out how much slower I am.
Um, and also Python 3.11 is faster anyway.
So yeah, look, you got an extra 30% to burn now.
Yeah.
Let's go ahead and do the type checking.
You're fine.
That's all right.
Yeah.
All right.
Final thought on this one, Brian, if, if your goal was what you were describing, which I think
that is a good use case of it.
I think you'd want to use the import hook because you could just do the import hook at
the top level of somewhere and then throw that one line away and then you're not actually
changing in your code, you know?
Yeah.
Also you could do a, wow.
The import hooks actually kind of neat.
Cause then you could do a guarded import hook with a flag or something like that and turn it
off, right.
Right.
If, if the, the thing running it is pie test or if the thing running it is in dev mode,
like some environment variable or something.
Yeah.
Design on the fly on a podcast.
Yeah.
Nice.
You have to import it for each module, right?
Yes.
For every module you're trying to, especially if you separate it out to your Python files
to different modules, you have to import hook for each.
I think you could at the top register all the ones in the hook.
Oh, yeah.
Okay.
Yeah.
I think you could figure out like, okay, I need to do these sub modules and I think you
could listen.
Anyway, I think you could make it work, but I haven't, I haven't tested it, but you're
right, Nick, that I do think performance would be something.
I don't know if it's a problem, but it should certainly be a consideration you check before
you just wrap this on everything.
Right.
Yeah.
Homework for one of the listeners.
Indeed.
Somebody could get some analysis.
Awesome.
All right.
Nick, what's your final item?
All right.
My final item is that, you know, like on this podcast, we're always looking for the best,
the ways to create GUIs, right?
Yes, it's absolutely true.
Well, I came across this library called custom TK inter UI library, and I am completely amazed
because it takes something so old.
And forgive me for saying Python core devs pretty ugly nowadays in this modern times and makes
it so beautiful and easy to work with.
So this library custom TK inter builds on top of the TK inter you know well and has been in Python
scenario for a while and provides you widgets that are themed in a more modern style, right?
So for Windows, it takes the more Windows 11 style of buttons and sliders and checkboxes and gives you a really nice looking modern UI.
And for macOS, it takes macOS design language and then gives you that.
The cool thing is that it also supports dark mode and light mode.
So you have, there's this on the GitHub page.
There is a, there's like a GIF or a GIF that shows how if you go to your settings in Windows and change the dark mode, it actually reacts.
And the application you built with custom TK reacts and changes the color scheme from light, dark mode to light mode.
And the same thing on macOS.
It looks like with macOS, it actually is a little bit more stable.
It works a little bit nicer, but nonetheless, it works both on Mac and Windows.
Yeah, and just to point out people, what the macOS is showing here is somebody has the system preferences opening and they're toggling the OS dark mode, light mode, and the app is just changing as it's running.
That's awesome.
Very nice.
Yeah.
But I did not expect that from TK, not even a little bit.
I know.
And then adding images is also pretty easy too.
And even like it even also has a map widget.
I don't know what map.
Oh, you're using OpenStreetMap.
I'm sure you could probably switch it out for maybe Google Maps or something or Mapbox or something like that.
Yeah.
It's pretty cool.
There are a bunch of other libraries.
You know what I mean?
Widgets here.
So they have like scroll bars and buttons and option menu sliders.
On and off switches.
Yeah.
Those the ones you come to know from mobile, like turning your Wi-Fi on and off and stuff.
Those that's nice.
Yeah.
It's pretty cool.
I am surprised that I'm excited about TK.
Because, you know, as an example.
So like, you know, earlier in my career, I did a lot of TK UI stuff.
But like you said, it looks old now if you just do the straight one.
But this looks pretty nice.
And the nice thing about it is I kind of already embedded that stuff in my knowledge.
I already did TK once.
So doing it again with this, that's pretty cool.
And having it look nice.
I might actually try to build a UI with this.
This is cool.
Yeah.
This is a super neat find, Nick.
I would never consider creating an app in TK Enter.
Well, never is a strong word.
It's very unlikely I would consider anything that I intended for a consumer facing use with TK Enter.
But this, for sure, I could ship something like this.
This looks nice.
And you wrap in a little Pi 2 app or Pi installer or Pi 2 EXE.
Yeah.
Get something nice you can hand out.
And then you're good to go.
Yeah, definitely.
Sweet.
Out in the audience, Brian says, I think TK Enter looked old 10 years ago.
Smiley face.
Yeah.
I think that's true, honestly.
Yeah.
Yeah, yeah.
So this is really refreshing and quite impressive.
So.
Yeah.
Love it.
All right.
I'm going to switch to extras.
Yeah.
Nick, you got any extra stuff you want to cover while you got your screen up?
Yeah.
Actually, I do have a couple of extras.
So.
I see you've got like a named tab group of extras.
Like this is next level.
I know.
I got to come prepared.
All right.
So the first extra I have is this web, this web service, this service called Terms of Service
Didn't Read.
And essentially it takes some of the, the internet's most common, unpopular products and services
and gives you a summary of what their terms of service is.
Because, you know, I know some of you are like, we don't, we don't need this.
We all read the terms of service, you know, but basically we don't.
Yeah.
I've read at the top.
It says, I have read and agreed to the terms of service is the biggest lie on the web.
We aim to fix that.
It's so true.
So it has all the terms of service for a bunch of services.
So I put to GitHub and GitLab.
So some of them are not yet rated, but okay.
For GitHub and global privacy, it's great.
And let's see for Facebook.
Facebook's awesome.
I mean, like the ones there.
When you Facebook stores your day, whether you have an account or not, your identity is
used as that as shown to others.
Service can read your private messages.
Wow.
I like the last one.
Deleted content is not really deleted.
That's funny.
Wait, is there another one you guys can think of?
I can't think of anyone right now.
You can check.
Put a DuckDuckGo.
Oh, okay.
That's one that should come out good.
Oh, it's grade A.
Look at that.
Yeah.
That's pretty good.
And I'm still doing my live with it.
Kagi.com.
Do Kagi.
K-A-G-I.
See if that even shows up.
Nah.
It's not even there yet.
But yeah.
The DuckDuckGo came out well.
Yeah.
Um, it's open source.
So you can contribute to this and grade existing ones or, updates ones that are already on this
server or on this website.
So that's a pretty cool.
Um, the power of open source.
I think we could get a pretty good list of, summaries for terms of service, which, you know, you really don't read most of the time.
I'm surprised it's in Reddit.
So, like, the Reddit is like, you sign away moral rights.
Correct.
Oh, that's funny.
Um, so, I actually think this is great.
I, I, I, I wish that there, my, my, my, in open source, like the open source world, we've sort of, we could have legitimately, we could have like hundreds of different open source licenses.
And maybe there are, but we kind of have a handful that most people use.
Um, so as long as you sort of understand those few and what the differences are, you're pretty good.
But commercial, terms of service, they're just, there's, they're all unique.
And I, I really, I really wish there was like, just like three or four that were most software.
Like you agree to this.
Yeah.
And we're like, oh, it's a, it's an MIT except for commercial use thing or whatever, or something like that.
I wish we're not going to get there, but it'd be cool.
Yeah.
It would totally be cool.
All right.
What's next?
This is great.
All right.
So then a couple of quick ones.
Pile Ohio is, is coming up.
Um, so July, 30th is Pile Ohio.
Um, the CFP is already closed, but you can still register for it.
And, you know, come down to Pile is a one day event and it's, it's down in Columbus.
The convention is pretty good.
So yeah, if you check out that, and then also, my company Trimble is having their,
um, annual insights.
So this is a conference for all the players in the transportation space.
So this is where we're going to be talking about the cool things that Trimble has been
doing.
Some of the cool things, the people in transportation costs, transportation sector is doing.
We're inviting our competitors.
We're inviting our customers.
It's one big transportation event.
If you guys are, if any of you out there are interested, you should come on and register.
Yeah.
Nice.
And an excuse to go to Florida.
Yes.
An excuse to go to Florida.
Um, then lastly, you guys should check out, we should check out the stack overflow to
intuitive of the survey.
So I know that do the survey or is that the results?
The results.
Oh, nice.
Okay.
Yeah.
Fantastic.
All right.
Yeah.
Everyone should check that out.
That's a good one.
Right.
How about you?
Got some extras?
I do not.
How about you?
All right.
Well then I just got it.
I don't have much this time.
So surprise, surprise, just, the, the kaggy stuff.
I'm totally loving it.
I got a lot to tell people about it, but, you know, it's pretty, pretty good stuff
these days.
I'm living, I'm loving it.
Um, but still loving duck, duck, go as well.
All right.
But here's my one extra open SSF, which honestly, that's the open source security foundation, which
I got to learn more about where the money comes from and whatnot.
Don't know all the details, but a shout out to them because they funded.
Python and eclipse foundation.
So not really caring too much about eclipse, but the Python one, they funded, what's
the, the short version of it.
So they funded, committed $400,000 to the PSF in order to create a new role.
So we've had the developer and residents with Lucas Lange.
And now we have a new role, which will provide security expertise for Python and the Python
package index via PyPI and the rest of the Python ecosystem, as well as funding a security audit.
And I, that comes to us from the Python weekly newsletter.
That's pretty amazing, right?
Yeah.
That's pretty cool.
Yeah.
That's a big deal.
Um, anyway, that's my only, only real extra is that one, but you know, way to go open SSF.
That's great.
All right.
We ready for a joke?
Yes.
I think we've got two jokes, don't we?
Yeah.
All right.
I'll, I'll go first as my screens up.
So this one is all about, it's got a Scooby-Doo theme here.
So, if you've never watched the Scooby-Doo cartoons, and I guess maybe this won't really
relate, but they always sort of unmask what's supposed to be like a ghost or a haunted thing.
And it almost, it never is.
Right.
So here's one of the characters.
I don't, Brian, do you know the name or Nick, do you know the name of this guy?
Anyway, the blonde one on Scooby-Doo.
I have no idea.
What's that?
No, I don't know.
Anyway, he says, there's a, there's a captured ghost, clearly not real.
And it says serverless computing.
Let's see who you really are.
And they pull the mask off and it's just a server.
Let's see who you really are.
Nope.
You're not serverless.
You're just a server.
Great.
All right.
Anyway, that's the one I.
That was from Virginia.
You know, we did AWS.
Yeah, exactly.
You came out of AWS East one, didn't you?
Yeah.
All right.
Nick, how about yours?
You got some ways to stay healthy here?
Yeah.
Ways to stay healthy and away from COVID.
So Michael, do you want to do the dialogue with me?
Yeah, sure.
I'll be the woman.
All right.
So I did a survey to find out the rate of COVID-19 infections among DevOps specialists.
Oh yeah?
Yeah.
And I found that DevOps are three times less likely to catch it than the regular population.
Weird, right?
Yeah.
Not really.
Well, why not?
Well, if everyone stayed home building K8 as stacks, Kubernetes stacks in their home lab, the numbers would drop pretty fast.
And it was like this news article from the Daily Coder that says, COVID-19 slash Omicron, Kubernetes-based isolation.
Very effective.
I love it.
Yeah.
It's honestly probably true.
There's some truth to that.
Yeah.
I haven't left the basement in a whole month.
How could I have got COVID?
I know.
I started learning about, I started feeling around with Docker, like multi-stage Docker containers or one of my apps.
And I spent hours on that.
I didn't leave my house.
I spent hours on that.
So definitely.
Yeah.
I've been there.
Been there for sure.
Yeah.
I mean, we could have like completely no COVID in the country and there'd still be some software people that are like, no, I'd rather not go outside.
Exactly.
I like this new life.
Yeah.
I'm good.
You know, I actually said that.
I said that when they said like, no, the quarantine.
I'm good.
Yeah.
I got a gig of it.
We're fine.
Exactly.
I do actually have gig of it in terms of good.
Yeah.
Well, speaking of fine, it has been very fine to have you on the show, Nick.
Thanks for coming back.
Yeah.
Thanks a lot.
Thank you.
Yeah.
It was fun.
All right.
Yeah.
And you too as well, Brian.
Great to have you here.
Thanks.
Thanks, everyone.
Bye.