Python Bytes - #290 Sentient AI? If so, then what?
Episode Date: June 28, 2022Topics covered in this episode: picologging CheekyKeys richbench typeguard Extras Joke See the full show notes for this episode on the website at pythonbytes.fm/290...
Transcript
Discussion (0)
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 am Brian Ocken.
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, and 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 Jupiter light in my pie and that was
fun, but that was also over a year ago. Yeah. 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, yeah.
Did you enjoy your time there?
It was amazing.
Loved it. Completely loved it. I 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, you know,
we're like, yeah,
it is our geek holiday.
So it was awesome.
It totally is, yeah.
Totally awesome.
Well, 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. 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 blog.
He sent out on Twitter something about Pico logging.
And there was a tweet that says Pico logging uses a modern extension module tool chain
with a scikit 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 fairly new library that is,
and Anthony says it's in early alpha stage.
There's some incomplete features, but I'm ready to use it right now
because it says you do, it just is a drop,
essentially a drop in for 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.
So it's taking a look at it.
The usage is basically just say import Pico logging as logging. And now you've got just like your normal logging.
You set up a basic config and you can write info and warnings
and that's about it.
There's, you know, why not?
So let's take a look at it.
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.
They're a little bit hard to read. But what this means is the first on the left, I believe it's the time for the normal
logging. And then and then how much faster the the faster one is, I haven't dug into the logging
stuff. But basically, for different parts of 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 um 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 sharp and Java, like those are all about dependency injection. That thing where you
say, where they say from Pico 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 hoops and stuff, right?
Like, I'm just thinking, you know, that one line right there is why we don't see a lot of that complexity.
I never really sort of tied that together, but it's kind of neat, right?
Yeah, 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's 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 PyTest, right, with the, um,
A bit with the fixtures, right?
Yeah.
And the way they do it so seamless, but you're right.
Dependency injection is 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 thing I would say is that even though I love the performance benchmarks, I feel
like the change that Anthony is going for with the performance would warrant a new
API for logging.
I feel like it warrants it.
So I would like to see him maybe change the way we configure.
Look, not only I can improve logging speeds,
but also change the way we configure it too.
Because the current standard lib logger is kind of cumbersome to configure.
Yeah, I agree.
Yeah, the basic config 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, the basic config 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?
One of the things that I
forgot to point out is Anthony
does list the limitations
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 observe threads or multiprocessing or log process globals.
So if you're utilizing those, this isn't for you.
It's actually kind of unfortunate because that's where logging really helps you a lot,
is when you're trying to pull those sorts of things apart. So, anyway.
Is the pickle indicative of it being fast,
or is it also very small?
Well, probably both.
I think it's referring to fast, but there's really just not that much here.
And, oh, it looks like it's CX's it's cxx and hxs or something going
on there maybe oh so take a look 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 yes yeah brian audience
asks uh 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 of course sort of rewrite the logging a little bit that's obviously like maybe a less
good idea but it probably would work given it's a compatible api yeah you probably could uh 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 because you can but
it's pretty interesting let's talk about cheeky keys so this one comes to us from praise and
daniel also someone who sends us a bunch of good ideas.
So thank you for that.
Have you either, have you seen this one?
No.
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.
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 the 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, for example, his little baby and he wanted to just be able to
control his keyboard without making 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 uh 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 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 is
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 if you left those on 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?
480 lines for this whole implementation, which I think a lot of it is defining constants of like, what do you when when these scenarios show up so yeah it's just do a pretty cool little
face mesh thing and say um you know go through and 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 so that i don't have to like have a whole bunch of uh 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 yeah i do uh 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.
It's 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 Fang 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 they 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 hotkey?
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. Uh, he wasn't hired, but,
but he did complete it. So, I mean, there's, there's something of a proof of concept
going on here. Oh, that's awesome. I, 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 so
i mean talk about bugging about putting your own product that's that's commitment like it is the
fact it totally is and the fact he wouldn't press the run button
the mouse because he's like no that'll that'll invalidate the experiment like is there a hockey
or something i could shift around like what can i do so anyway uh yeah thanks prasen for sending
this one over uh i recommend if you really are interested in this watch the video it's seven
minutes and it's it's pretty wild that's pretty good indeed all right nick over to you
all right okay um following along the theme of something that we did what you shouldn't maybe
have done um google released a next generation language model similar to bert andT-3 called Lambda. And I think it stands for language applied, language applied
the 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 of 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 was from The Guardian.
And essentially, one of their developers released a chat transcription
that kind of alluded to Lambda being self-aware.
What startled him was that talking, kind of alluded to Lambda being self-aware.
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-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 transcript, 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 the, well, that's what it is.
And this is one of some of the things that, uh, Lambda, um, said, like wrote
back to, um, the engineer's name was, uh, Lemoyne, uh, Blake Lemoyne.
Well, I mean, this was like a huge, uh, this was a pretty huge thing, um, to the
fact that we'll have to take action against this engineer and suspended him
because they it's kind of violated their, um, their terms of, in terms of service,
not terms of service, but like terms of working conditions.
So this is interesting because if a actual software engineer
could look at this chat system, he's like a, he's like 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 silent on the way.
This, yeah, 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 to, from this, uh,
from this article.
That's probably worth listening to.
Yeah.
Yeah.
Did you read the transcript?
The full conversation?
Reading rather than listening.
Yeah.
Um,
Nick,
did you read it?
Oh,
partially.
I did read all of it.
Yeah.
I read the whole thing and I was,
um,
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 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.
A voice assistant type thing.
Yeah.
A voice assistant would actually make reservations for you. And it was so convincing that they did it on stage where it sounded so real, even adding
some of the crotch words that us humans add, like, oh, 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, not to.
I saw that keynote and I was also blown away. And I'm 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, 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, of that as well. One of the sections out of the transcripts, uh, there's two things that
really stood out to me. I only read about half of it.
So it really analyzed Les Miserables pretty amazingly. They said, have you seen that? Or
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 give you a, what do they call it? A Zen koan, which is like a short phrase with a moral to it.
And it really analyzed that incredibly well. I would say better than many people maybe in
middle school age or younger. And then it asked, they said, okay, well, how about you write me a
fable with animals that describes something about your life?
And it came up with this really elaborate fable, right?
Yeah.
Pretty amazing.
About a monster and an owl that defended the other animals and all sorts of stuff.
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.
It has really shown its understanding of the human language, at least English in this case, as well as how humans understand language. the miserab and and also its storytelling it really understood how to the structure that
plot lines follow and really being able to like abstract the common themes and really understand
that at the very fundamental level that was really amazing i don't think bert or gpt3
can get that kind of deepness yeah yeah what are the the interesting i don't know if it's sentient
go ahead brian oh go ahead uh i just i don't know if it's sentient but it sure as heck understands
stuff well very well well part around this part of it is the discussion of is it sentient or not
and i don't even 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, um, we have rules like these,
these rules are the things that something must, uh, 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,
uh, a lot of people want to have some distinguishing feature between humans and everything else.
And it doesn't matter what you fill.
People will come up with something else.
Because this reminded me of the discussion of 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 large hierarchical we have like um 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's
an interesting point but um 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 referred to we and us, and that's what makes us different.
And 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 i thought when i saw when i when i
saw that part of the transcript part of me me was like, is this someone just like just trolling, like, yeah, trolling this guy?
Like someone's just behind the scene 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 be a full show if we didn't get to talk about Will and his project Rich.
And obviously, let's bring Anthony back in spirit.
Right.
So I want to talk about Rich Bench because actually this is just a two for ones thing for me.
Because when I was covering Pico logging, the benchmarks, it was like, it says to run the benchmarks, run Rich Bench benchmarks.
Rich Bench, I don't know what this is.
I've never used it.
So I asked Anthony on Twitter, what is rich bench?
Instead of like doing my research myself.
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.
But so in Pico logging, 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 factory logging,
and then record factory Pico logging.
So basically doing the same thing within Pico logging versus logging in the same function.
So it came with two different functions, but doing the same thing.
And then it does that a whole bunch of times, a bunch of duplicate functions,
but one that's using Pico logging and one's using logging.
Now there's other ways.
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 you run rich bench, which is a different project.
But so it's also by Anthony.
So, yeah, Tony Bellini, 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.
Plus, so yeah, all I had to do to run them myself.
So I tried the Pico logging stuff.
I cloned the Pico logging 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 so yeah good use of color you can see the stuff that's slower
or faster uh based on the color right yeah and i also like i really like the because people are
really bad at at least i am about just uh comparing numbers directly um know, it's like, you know, 0.287 versus 0.0155,
or, you know, how much is that?
So I really like the 1x, 2x, which one's faster, which one's slower,
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.
Also, really small.
What is he listed as?
RichBench is a little Python benchmarking tool.
So just a very, I really like these, actually,
really sharp, useful tools that 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 benchmark 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 um comparing different models
then yeah we would do that at work yeah 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 kind of have an understanding
and 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 making it cleaner, I don't want to make it slower.
So it's good to know whether or not you're going to slow it down.
Yeah, for sure.
All right.
All right, Brian, we ready for the next one?
Yeah, definitely.
So this is a fun one that I found called TypeGuard.
Like RightGuard?
Is it deodorant for your types?
It is.
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
is pydantic and fast api 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 some
chance to work with some folks who are Java developers, and I know some of the C Sharp folks
and stuff. When they come to Python, it's kind of like, is this really going to work? Can we
actually just not have any type information here?
Like, what if I really wanted to check this?
Like 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, you know, ensure that it's being used correctly.
That's what you use this type guard for.
So there's three basic ways which, uh, 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 a type checked decorator onto a function,
and it will verify that it works right. Let me pull up the documentation. It 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 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 an import hook. So if you
install the import hook, and then you import it, import some, so 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 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 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 the functions directly but i could definitely so 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. So I could see a place where I might want to log something
and then do some other fault handler or recovery mechanism
and not hit an assert.
So in production code, you-
Or raise an exception, right?
The example is raise an assert failure
or the decorator will throw an exception, right?
A type error.
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 use case for it.
Nick, how do you feel about this?
I don't know.
I love types.
How do you do?
I love types.
I use it as much as I can.
However, with this, I don't know.
A couple of things come up.
First, how does it look when it encounters a type error?
What's the error message?
Does it tell you what exactly was the error message?
Because it matters when someone is not used to typing and sees that.
It needs to be able to quickly discern,
oh, I'm supposed to do this instead of this kind of thing.
So that's 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 the list, maybe you expect the iterable or sequence.
Right.
And then do, do that.
Like the type Like the typing,
and 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.
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 to already use it or not. Maybe, maybe, but I definitely think it's neat. nonetheless. Yeah. I'm on the fence of whether to use it or not.
Maybe, maybe, but I definitely think it's neat.
Well, Makuga, 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 just do it, you call some function, you have types
and then you have it check the type.
The only thing it'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. within testing is to create a mock object that basically just wraps part of an internal part of your system
and have that mock object just pass back and forth,
but also do the type checking with these calls in it around it.
And then if you replaced 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 checking types at runtime,
there is an overhead to it, right?
And 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 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 especially you're being if you're calling
something a lot of times constantly checking the 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 the decorator
because I don't want all of Python
and all of everything to be type checked,
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 run time and then I can strip it off later
and then I could
also use
benchmarks to
find out how much slower I am
and also Python 3.11
is faster anyway so
yeah look you got an extra 30%
to burn now yeah yeah
go ahead and do the type checking.
You're fine.
That's all right.
Yeah.
All right.
Final thought on this one.
Brian, 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 changing your code, you know?
Yeah.
Also you could do a, wow, the import hook's 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 PyTest 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.
Imported for each module, right?
Yes.
That's why every module you're trying to, especially if you separate it out to your
Python files, different modules, you have to import hook for each.
I think you could at the top register all the ones in the hook.
Okay.
Yeah.
I think you could figure out like, okay, I need to do these sub modules and I think you could list them all. Anyway, I think you could figure out like okay i need to do
these sub modules and i think you could listen anyway i think i think you could make it work
but i haven't i haven't tested 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 all right
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, that'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 TKinter builds on top of the TKinter you know well, and it's been in Python 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 nonetheless it works both on mac and windows yeah just to point out people what the
mac os 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 Enter. Not even a little bit.
I know.
And then adding images is also
pretty easy too.
So and even like it even also has
a map widget.
I don't know what map.
I thought you were using Open
Street Map.
I'm sure you could probably
switch it out for maybe Google
Maps or something or Mapbox. Um, it's pretty cool. There are a bunch of other, um, libraries, I mean,
widgets here. So they have like scroll bars and buttons and option menus, sliders, a bunch
of on off switches. Like those, those, uh, the ones you come to know from mobile like turning
your wi-fi on and off and stuff those that's nice yeah yeah it's pretty cool i am surprised that i'm
excited about tk uh with this um because you know uh as an example so like you know earlier in my career, I did a lot of TK UI stuff. Um, but it, like you said,
it, it looks old now if you just do the straight one, uh, but this looks pretty nice. And, uh,
the nice thing about it is I already, I kind of already embedded that stuff in my knowledge.
I already did TK once. So doing it again with this, um's pretty cool and having it look nice uh i might i might
actually try 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 or a consumer facing use with t inter, but this for sure, this, I could
ship something like this.
This looks nice.
And you wrap in a little Pi 2 app or Pi installer, Pi 2 EXE, 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 inter looked old 10 years ago.
Smiley face. Yeah, I think that's true. Honestly. Yeah. Yeah.
Yeah. So this, this is really refreshing and quite impressive. So yeah.
Love it. All right. I'm a 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.
I see you've got like a named tab group of extras. Like this is next level.
I know. I know. Better come prepared. Better come prepared.
All right. So the first extra I have is this web, this web service called Terms of Service Didn't Read. And essentially, it takes some of 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 need this.
We all read the terms of service, you know.
But basically, we don't.
Yeah, right at the top it says, I have read and agreed to the terms of service, you know, but basically we don't. Yeah. Right 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.
That's so true.
So true.
So it has all the terms of service for a bunch of services.
So GitHub and GitLab.
So some of them are not yet rated, but okay.
For GitHub and Google privacy, it's rate B.
And let's see for Facebook.
Facebook's awesome.
I mean, like the ones there.
When you Facebook stores your data, whether you have an account or not, your identity is used as that has shown to others.
Service can read your private messages.
Wow.
I like the last one.
Deleted content is not really deleted.
Wait, is there another one you guys can think of? I can't think of anyone right now. 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.
We can check.
Put 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
nah
it's not even there yet
but yeah
the DuckDuckGo
came out well
yeah
yeah
it's open source
so you can
contribute to this
and
grade existing ones
or
update ones
that
are already on this
on this website
so that's pretty cool.
With the power of OpenSource,
I think we could get a pretty good list
of summaries for terms of service,
which we know you really don't read most of the time.
I'm surprised to see Reddit.
The Reddit is like you sign away moral rights.
So I actually think this is great.
I wish that there, 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.
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 of 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
we're not going to get there but it'd be cool yeah 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 Ohio is coming up. So July 30th is Pai, Ohio.
The CFP is already closed,
but you can still register for it.
And, you know, come down to Pai.
It's a one-day event.
And it's down in Columbus.
The convention is pretty good.
So yeah, you should check out that.
And then also my company, Trimble,
is having their 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 the transportation sector is doing.
We're inviting our competitors. We're inviting our customers. So the cool thing the people in the transportation sector is doing,
we're inviting our competitors, we're inviting our customers.
It's one big transportation event.
If any of you out there are interested, you should come and register.
Yeah. Nice.
And an excuse to go to Florida.
Yes, an excuse to go to Florida.
Then lastly, you guys should check out,
we should check out the Stack Overflow to develop a survey.
Is that do the survey or is that the results?
The results.
Oh, nice.
Okay.
Yeah.
Yeah.
Fantastic.
All right.
Yeah.
Everyone should check that out.
That's a good one.
All right.
Brian, 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 CAGI 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 loving it, but still loving DuckDuckGo as well.
All right.
But here's my one extra.
OpenSSF, 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 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 in residence
with Lukas Lenga.
And now we have a new role,
which will provide security expertise for Python
and the Python Packet Index via PyPI
and the rest of the Python ecosystem,
as well as funding a security
audit. And 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. Anyway, that's my only real extra is that one. But you know,
Waygo 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 go first as my screen's 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.
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 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 says servers. 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
The rules from Virginia. No, we did AWS.
Yeah, exactly. You came out of AWS East one, didn't you?
Yeah. You came out of AWS East 1, didn't you?
Yeah.
All right, Nick, how about yours?
You got some ways to stay healthy here?
Yeah, ways to stay healthy and keep away from COVID.
So, Michael, do you want to do the dialogue with me?
Yeah, sure.
I'll be the woman.
All right.
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?
Not really.
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
is very effective.
I love it.
It's honestly
probably true.
There's some truth to that
yeah
I've left the basement
in a whole month
how could I have
got going
I know
I started learning
about
I started feeling
around with
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 uh some software people that are like no i'd rather
not go outside exactly i like this new life yeah i'm good yeah so you know i actually said that i said that
when they said like you know the quarantine i'm good yeah i got gigabit internet we're fine
exactly i do actually have gigabit internet so i'm good yeah well speaking of fine it's been
very fun to have you on the show Nick thanks for coming back
yeah thanks a lot
yeah it was fun
you too as well Brian great to have you
here thanks everyone
bye