#382 A Simple Game - podcast episode cover

#382 A Simple Game

May 07, 202428 minEp. 382
--:--
--:--
Listen in podcast apps:

Episode description

Topics covered in this episode:
See the full show notes for this episode on the website at pythonbytes.fm/382

Transcript

Hey, everyone. Hey, Brian. Good to be back. It's good to be back. I'm back in a place with somewhat controlled audio, although I'm having a bunch of tree work done, and one of those giant tree grinding machines is literally outside my window. However, I got a new microphone, and I believe it didn't even pick it up. It's ridiculous. So there's a bunch of onboard software stuff built into the mic, and it might not even affect us.

Does it have a bunch of AI in there so they can correct your grammar if you say something wrong? That'd be cool. That would be cool. No, but it has noise gates and noise reduction and high-pass filters and stuff like that. With that, let's go ahead and kick this off. Hello, and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 382, recorded May 7th, 2024. I don't know if you caught it last time, but I was a year behind last year.

So I said 2023 last time I was doing the show intro. But no, it is in fact 2024, despite what I believe about time. It seems like it's going too fast. Nonetheless, May 7th, 2024. I'm Michael Kennedy. And I'm Brian Okken. And this show is brought to you by Scout APM. Check them out during their segment. It really helps support the show. Connect with us on Mastodon. All three of us are over there. Links are at the top of the show notes.

If you want to be part of the live recording, pythonbytes.fm/live. Usually Tuesdays at 10 a.m. Pacific time. And finally, Brian, I know we sometimes talk about our newsletter, but people are subscribing and they're getting a lot of value out of it. So if you want an artisanal handcrafted digest of all the stuff we talked about in the show, deliver an email form so it's permanent right there. You can forward it, share it.

All you got to do is head over to pythonbytes.fm, click the newsletter link right in the center of the screen, and then bring you to the friends of the show. Keep your email private. We don't share it. We don't do anything weird with it. We just want to be able to send you stuff about the show. So people are really getting a lot out of this, Brian. I checked last week the email that you sent. Yeah. Normal.

If you're doing good, if you're lucky, if people really want to hear from you, there's a chance that about 20% of people will open emails that you send in the newsletter form to them. The one you sent was like 95% opened. That's awesome. That is so awesome. Thank you, everyone, for actually caring and subscribing. So pythonbytes.fm, click on newsletter, and sign up for it. That'd be great. Yeah. With that, yeah, go ahead. One of the things I wanted to bring up is, so now there's two ways.

Then if there's something that you heard on the show, but you can't remember what it was, you can search your inbox if you save it. Save our old emails from us. But we also, we haven't talked about it a lot, but the search box on pythonbytes.fm is excellent. It searches both the show notes and the transcript. So even if it wasn't listed, but it was said, it might find the right episode for you. So it's pretty cool. Yeah, absolutely. Yeah, I use that.

I actually use that to decide, oh, if we talked about this thing before. Three years and I already forgot about it, or should I cover it, right? Yeah, exactly. Amazing. Amazing, amazing. All right. So we jump in to the first topic. Well, I want to act on that information with a product called Act. And it's from Necto. Necto's, I think it's the person's, maybe just their name is Necto, and it's their Act.

N-E-K-T-O-S-A-C-T, but it's in the show notes or in the email that you'll get if you sign up. Anyway, what it does, it's super cool. It runs, what it's doing is it's running GitHub Actions locally. So if you could set up, you could set up this. What you have to do is you have to install it, and it's got great installation instructions. I used Homebrew, but it's got installation instructions for Chocolaty or even GitHub CLI. I could have used that or Mac boards, Scoop.

I didn't know what, I don't know what Wingate is. Anyway, getting... Wingate is, you know how on, for example, on Boutique, we have ApptGet, Debian Systems sort of thing? So that is the, for a long time, Chocolaty was the package manager. It was kind of like Homebrew, sort of external for Windows, and Wingate is like the official Microsoft package manager for Windows. Oh, okay. It's kind of a new thing.

I don't use it very much because I don't use Windows enough that I care about that stuff, but yeah, that's what it is. Cool. Well, so this project, really what it does is it's, you can run your workflows locally, but you have to install it and you have to set up Docker locally. So it could, because it uses Docker, which actually I kind of love anyway. So what it's doing is it's running your actions. It loads up a Docker image and runs your actions. But the control over it's really pretty cool.

So I should have looked this up, but there's, you can, there's different runners, but the way you run it is there's a bunch of different commands that you can run. So you can run, run your pull requests or you can run a specific job. There's a whole bunch of different, different parameters for this to be able to run different pieces. I used it just to run. I wanted to just check, check my test, test run within locally.

And because I wanted to play with the different test jobs and coverage, be able to run those individually. And it really was slick and it's super fast, really easy to use. It's really pretty cool. It's also open source. So nice. We're going to link to the GitHub repo as well. So you can check it out. And it's, apparently I'm not the only one that loves it. It's got 1.3 thousand stars. So that's forks. 50,000. Oh, that's forks. There's 50,000 stars. Nice. It's awesome. This is so awesome.

If you do a lot of with GitHub actions, this is so cool. one, you can sort of test it and run it faster and iterate really quickly till you get it dialed in, right? Yeah. Then the other thing, Brian, that might be interesting, there was, I don't know, I'm kind of inspired a lot by what the 37 signals people are doing around deployment and stuff. One of the things they did recently is they moved their continuous integration. Maybe even using this, I don't know.

Moved their continuous integration to developer machines. So instead of having, you know, one server where all the builds just queue up behind each other. It's like, everybody has a super high-end computer is oftentimes faster than the CI servers anyway. So run it there is like a pre-commit hook sort of thing. Yeah. Or, you know, some sort of push, some kind of event locally. And so this, it kind of lets you go down that workflow as well.

If you're like, we just want to distribute the compute so we can make our actions run a lot faster, at least a good chunk of them, you know? Very neat. One of their ideas for this also is to use it as a local task runner instead of like make or things like that, which is interesting. You could have workflows that aren't reachable from CI that you can just run locally through, through this if you're already using it. That's really awesome. This is great. I love it. All right.

Well, so since you brought up Docker, let's keep going. Okay. Let's keep going. I'll get there in a second. So I'm sure you're familiar with Ngrok. We've talked about how Ngrok is awesome before and it solves a super interesting problem. So Ngrok is a commercial project. I'm a big fan of it. I'm a pain user of it. We'll see if I continue to be honestly after I read this out. However, I'm a big fan of it, right? So there's all these situations where you need to easily get access.

Something on your machine in terms of an API or a website needs access to the internet just for testing or just for a demonstration purpose. Like how often are you, you're in a Zoom meeting and somebody's like, hey, I want to show you this new design and this new user interaction. So let me share my screen. And then they're like on a huge monitor and it's blurry and you're like, I think I like it. I don't know, you know.

But with Ngrok, you just say here, just everybody connect to my little local dev app and click on this and see how you think it feels, right? Or you want to debug a web hook which has to come from the internet to somewhere public so you can just fire up an Ngrok endpoint or use SSH to tunnel what would be regular web requests into your machine that turn back into web requests to hit Flask or FastAPI or whatever it is, right? I did it for web hooks a bunch recently and also for mobile apps.

Oh, yeah. When Lauren and I were building out the mobile apps, they had to talk to and just sort of do some callbacks and other things and we were testing out the API and just like, here, we'll fire up an Ngrok and he'd be on his phone running the app, clicking with it, debugging it, and it would be coming through the API hitting breakpoints in PyCharm. Awesome, right? Yeah. But it's more of an individual type of tool and also closed source and paid.

Not that those are terrible, but they are, you know, that's what they are. So I want to tell you about Porter, like P-O-T-R, which is an open source Ngrok alternative. So the idea is exactly the same that I just described. However, the way it works, don't watch the videos, they're very bad. Go to the docs instead. Similar though to Act, it has not as many, but 2000 stars. How old is it? Six months old for a six month old project. That's pretty good.

Yeah. So basically to set it up on the server, you have to have, it says a virtual machine. You need a machine. This could be, it could be a VM on the internet. It could be a VM locally. It could be a real machine sitting, you know, on a, on a beat up laptop in the corner with a public IP. Who knows? Whatever. You needed some kind of pretty lightweight machine, you know, $10, $5 digital ocean server.

You got to set up a cloud fair, Flare token for wildcard because it manages subdomains automatically and GitHub credentials to log in. And then that's it. And the idea is that it actually does, it's built for teams as well. So teams can manage different ways to call back into things and connect things and so on. So it's got like a whole team dashboard and people can set up the teams and whatnot.

But basically, you just set this up and you run a Docker container on a simple machine and then all of a sudden you've got your own, very own ingrock where data also is not going through ingrock but it's just private to you, of course, right? Because it's HTTPS over to SSL and then back. Okay. So when you're, is that, is it setting up, like ingrock, does ingrock set up a Docker? Does it go through dockers also? No. They run the server side for you.

Okay. They probably use Docker but they completely manage the server side for you. You just use a CLI that like talks to that thing and then sets up a connection, an SSH connection back to you. Okay. And then when I'm debugging it, if I set a breakpoint or something, do I need to set that in the Docker image or do I need to? No, no. The Docker image is just a pass-through. Oh, okay. Got it. Yeah, yeah. It really does work just kind of like ingrock. Yeah, yeah, yeah. It's super, super similar.

I haven't used it yet but I'm looking to start trying this out and then for the client, you just, there's a couple ways to install it but pretty straightforward and then you just, instead of saying Docker, sorry, instead of saying Docker HTTP something, you say Porter HTTP something and off you go. Nice. All right. Yeah. Pretty cool. It sure is. You know what else is neat, Brian? I think Scout is neat. Scout. Scout APM. Scout APM is pretty awesome. Let me tell you real quick about Scout APM.

They're big supporters of Python Bytes so we appreciate that very much. So if you are tired of spending hours trying to find the root cause of issues impacting your performance, then you owe it to yourself to check out Scout APM. They're a leading Python application performance monitoring tool, APM, that helps you identify and solve performance abnormalities faster and easier.

Scout APM ties bottlenecks such as memory leaks, slow database queries, background jobs, and the dreaded N plus one queries that you can end up if you do lazy loading in your ORM and then you say, oh no, why is it so slow? Why are you doing 200 database queries for what should be one? So you can find out things like that. And it links it back directly to source code so you can spend less time in the debugger and healing logs and just finding the problems and moving on.

And you'll love it because it's built for developers by developers. It makes it easy to get set up. Seriously, you can do it in less than four minutes. So that's awesome. And the best part is the pricing is straightforward. You only pay for the data that you use with no hidden overage fees or per seat pricing. And I just learned this, Brian. They also have, they provide the pro version for free to all open source projects.

So if you're an open source maintainer and you want to have Scout APM for that project, just shoot them a message or something on their pricing page about that. So you can start your free trial and get instant insights today. Visit pythonbytes.fm slash Scout. The link is in your podcast player show notes as well. And please use that link. Don't just search for them because otherwise they don't think you came from us. and then they'd stop supporting the show.

So please use our link pythonbytes.fm slash Scout. Check them out. It really supports the show. Indeed, indeed. What's next, Brian? We've talked about type annotation a lot and I ran across this blog post called Annotating Args and Keyword Args in Python. And actually, I never tried that. I've mostly just, if I have star args or star star kw args, just sort of leave it as is. I don't, I haven't tried type annotating those. So I was intrigued as to how I would do that if I wanted to do that.

And there's a article about it from Redawan, I think. What's his first name? Anyway, Redawan Delaware. Cool name. And it's the, there's some problems with all the ways he tried that seemed obvious. Like, sending, passing in a dictionary that he expected. apparently my pie doesn't like that. Or doing like a deck sort of describing the tuple or a dictionary that are coming in. There were issues with those. The, but I'm just going to hop to the end result.

Apparently, using, using information from PEP 589, 646, 655, and 692, there are features like unpack and type dict along with typing that we're used to that are part of the typing module. And the, the result is kind of cool. I mean, it's not terrible. There's a couple, there's a pre 312 and a after 312 version. I'm glad that he listed both. But you, you set up a, a class for your keyword args and describe what the, what the types are there in your keyword under type dict.

And then for the star args, it's an unpack, you say an unpack of a tuple and then the types of the tuple. So you can do good typing as to the, the types of things that you want to come into star args or keyword args, which is kind of neat to make sure that, I mean, you think of star args or keyword args as just anything can come in. But if you really don't want just anything to come in, this would be great. So I like this. Yeah, it's cool. It's a totally reasonable thing to think.

Like I want to pass one number or two numbers or a hundred numbers. but whatever it is, I want to operate on numbers, right? Yeah. Or yeah, I want in this example, it's either integers or strings that I'm going to get in or insert pools. So I would have never come up with this. The creator class derived from type dict with multiple values to then wrap that as an unpacked of, okay, I'm awesome. They have it. Yeah. But this is, this is amazing.

Yeah. Seems like there could be an easier way, but anyway, so this is pretty cool and he's got some great writing. One of the other articles that I started down this rabbit hole was a more recent article from April 27th called typos does what I thought type guard would do in Python and I don't use either type guard or typos so I'm not sure what these are. But if you are a type guard person, maybe you want to check this out. Yeah. Yeah. All right. That also looks cool. Well done. Well done.

All right. I have one more item for us here and it's pretty awesome, Brian. It's pretty awesome. Awesome. Ever since the, the guy behind just path got thinking about, hey, people should use the featured on Python bytes episode number badge. I'm like, oh, there's probably more to these badges than I give them credit. I mean, I know I've seen plenty of badges, but there's a lot of badges. So this is a GitHub repo with a thousand stars that is a curated list of GitHub badges for your project.

And let me tell you, what are you interested in, Brian? You want to talk about contacts? You want to talk about groups, socials, operating systems? Where are you streaming? What kind of tests? What kind of food do you want, for example? Well, that's under the tests category. I think that's the failed indent I'm right here. I think that's all just one thing. I don't think that's this level. I think the test got unindented for some reason. Okay. What kind of terminal do you rock? And so on.

Okay. So I'll just go, I'll pick a couple just to give people a sense because I don't want to just read a list of a bunch. But like, for example, you see the scroll bar, Brian? I mean, this is a lot. So under contact, you've obviously got email, but you've got, if you want to be specific, say, hit me in my Gmail or hit me up on my ProtonMail. You can actually have those as badges.

You can have Signal, Telegram, Tutanota, Noda, however you say that, WhatsApp, WeChat, all those things are pretty cool, right? For groups, you know, Slack, Discord, Zoom. Apparently, I think Zoom is getting into like, kind of trying to be more Slack-like, even though I never use it for that. Reddit and so on. Under social, that would be Bitbuckets? Social coding, I guess. I don't know. But, you know, GitLab, Instagram, Pinterest, Quora, Reddit, et cetera.

And then you've got some for the OS, right? Not just really standard ones, but, you know, like CentOS or Deepin or, you know, whatever. But they also have their little icons that go with them, right? Like the red hat is red, but it also has the hat. That is the red hat one. And I'll just go down a little bit and find some more of the uncommon ones down here. ETL, that sounds boring. like mobile frameworks.

So they've got like Flutter, for example, like the app I was just talking about earlier that Talk Python is built on Flutter. We could have that or Ionic or Cordova or, you know, Xamarin, whatever you want. So, isn't that cool? Yeah, that's pretty fun. What security platform is using? Is it like, this is verified by Snyk? And so on. Anyway, so if you're thinking about your next project or your GitHub profile or whatever, I present to you many, many GitHub badges for the taking.

Yeah, let's see if I can get like, like four rows of badges onto a project. That'd be fun. Exactly. Exactly. Well, any other extras? Wait, this is one that wasn't your extra. That's not an extra, but I do have extras. Okay. I'll go, I'll go ahead and go through them since I already got my stuff on the screen for us. All right. So this one comes from the Django Not folks.

So the Django Not program is a program to help people who are interested in Django become core contributors, not just users of, but contributors to the Django code base. So it's kind of like a mentorship program around that, which is excellent. And you must act soon. You have six days to apply. So the, the session two application is open. I actually interviewed Sarah, sorry, Sarah, Boyce, Sarah Boyce, and Tushar Gupta about their experiences running and coordinating the first one, right?

back on Talk Python in March. Yeah. March this year. So if you want to hear more about it and you think maybe I want to apply to it, well, you've got six days to do so, to be part of it. It doesn't cost anything, but there is an application process, which is cool. That was fun. And then I was on Django chat, the Django chat podcast with Will and Carlton. And we talked all, yeah, I do too. Those guys are both great.

And we talked all about this whole, new deployment style and self-hosted open source and all these different things that I've been sort of talking on and off on about the show here. But we spent a good chunk of the show just talking about, you know, how, how am I running things for Talk Python and for Python bytes and for a bunch of other stuff. And then what are some external projects and some of the other advice? And it's just really fun.

So we had a good time talking to people can check that out. Extras for you. Yeah. I'm going to start off with some bad news and then some good news. So I came across this. It's from bleeping computer, but I saw it on a whole bunch of websites. Fake job interviews, targets developers with new Python backdoor. And it's just, it's just awful. It's nefarious and evil. And I, you know, the idea of a lot of viruses is to try to get people to run code, you know, sneak in stuff to run code.

They're just going straight to developers and saying, Hey, as part of the interview process, we'd like you to download like this repo and run the code in there. And then I don't know what they're telling to do after that, but it's too late at that point. At that point, they've just run the virus. So that's just awful. Anyway, be careful. If you're, if you're doing a job interview and they say, Hey, go, go run some code. Maybe don't, or look into it a little bit more.

I mean, it's so bad though, because it could just be, well, all you got to do is pip install the requirements and take this project and then add this little feature and show us how you did it. Right. that already runs arbitrary code from the internet. Yeah. Oh yeah. It could just awful. That wouldn't. Yeah. Yikes. Anyway. Okay. So that's bad news. Good news. Good news is this, this is the week that I'm going to switch the course.

Uh, the PI test course is a complete PI test course is going from a teachable to a new platform podium. Um, and it's just, the reasoning is, uh, the, you don't want to hear the reasoning, but mostly it's the future of the, that I'm working with for more courses and more things I want to do with people teaching PI test and other things fits better with podia platform than, then, uh, then with teachable. So, uh, to, to sort of celebrate the switch, I haven't made the switch yet.

It's going to happen this week, but you can already get to this new one. It's at Python test. Podia.com. And now through Sunday, uh, you get 25% off if you use the code PI test and, um, and that's P Y T E S T. And you can, um, find that link in the show notes also. Okay. So, uh, and lastly, um, I know PyCon is coming up. I won't be at PyCon, but I, um, I know a lot of great people will be. And so to celebrate PyCon, I have a episode two 20 at Python test.

That's getting the most out of PyCon and some great, and some great tips from Rob Lubwick, Rob Ludwick, um, about, you know, having fun at PyCon. So check that out. Indeed. Yeah. I'm going to be doing, um, probably a data science panel podcast. That's also going to be live streamed with, uh, the jet brains crew over there. So that'll be a lot of fun.

Yeah. And I will probably do Python bytes, but since you're not there, probably not an open space in person one, probably just sneak away to a quiet spot and we'll do it like this. Different background. All right. Awesome. All right. Is that it? I had one more, one last minute one, which I thought was cool. Just a, one I just threw in. Um, I saw this on Amazon just before we started recording. Somebody named Orion Reed, uh, posted this, uh, bookmarklet, um, that, uh, to visualize, uh, your DOM.

it's a JavaScript book market bookmarklet to visualize your DOM in 3d. I love it. So cool. So it, it may seem just like silly, who cares? But if you're looking at why is this thing overlapping that thing? What about Z ordering? Or why is, you know, this is actually contained in that versus next to that, like all that kind of stuff you would see from this 3d rotational thing. It's beautiful. Yeah. It's pretty, pretty neat. So I'll link to that. That's all my extras.

So, uh, there's a question out there, Brian. This is an important one. Uh, who will carry the Python staff of power at PyCon and Brian, who will do this? I don't know. I don't know. I know, but I think there's going to be a great disturbance in the forest is what I'm feeling. Speaking of which, how about a joke? Yeah. I have two jokes for people. One, very heartfelt and sincere. And we're going to close out the show with that. But first one, a sneaky little game.

So this comes from Reddit and it's just on our slash program and humor. It's just, just a little game. And it says import random import OS randomly get a number. Guess equals input. Silly game. Guess the number between one and 10 and it converts it to an end. Right? So you would think of course, if gas equals number, you won else. Sorry. You try again. No, if gas equals number print, you won else. OS dot remove. So you could do it. It's just terrible. It would really work.

It would really work, but you could do it. Like you could delete your user profile, you know, like stuff that doesn't require admin access. Oh boy. That's funny. Just a silly little game. All right. Let's close this show out with something special. I saw this come, come through the news a little bit. So I think this is going to be a lot of fun, Brian. I came across this. Actually, you know, this came from Dan Bader. He sent this over to me.

Just said, I think it was this said you wouldn't believe this. Check this out. And it's called permission granted. A sad girl sings, sings the MIT open source license. Like for real. Okay. Okay. So it's AI generated, which is what makes it crazy. And it probably has Python involved in there somehow. And since AI generated content can't be copyrighted, we should be safe to plate. Let's do it. Let's do it. We're going to close out the show. It's two minutes. You can listen to it if you want.

If not, feel free to mail, but into the show is we're playing this. So here we go. Permission is hereby granted free of charge. To any person obtaining a copy of this software, associated documentation files, the software to deal in the software without risk. and to do so. And to permit persons to whom the software is furnished to do so, subject to the following conditions.

The above copyright notice, the above copyright notice, and this permission notice, shall be included in all copies or substantial portions of the software. The software is provided. software is provided as is, without warranty of any kind, express or implied. according to the warrant, according to the warranties.

The warranties of merchant tabulating, the law is, the law is provided in all kinds of documents, and the law is provided in all kinds of documents, and the law is provided in all kinds of documents, and the law is provided in all kinds of documents, law enforcement. So copyright holders, be liable for any claim, damages or other liability, whether in an action of contract, toward or otherwise.

Transcript source: Provided by creator in RSS feed: download file