Python Bytes - #382 A Simple Game

Episode Date: May 7, 2024

Topics covered in this episode: act: Run your GitHub Actions locally! portr Annotating args and kwargs in Python github badges Extras Joke See the full show notes for this episode on the websit...e at pythonbytes.fm/382

Transcript
Discussion (0)
Starting point is 00:00:00 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 free grinding machines is literally outside my window. However, 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 like software stuff built into the mic and it's wow so it might not even affect us does it have a bunch of ai in there so they can like correct your grammar if you say something wrong that'd be cool that would be cool no but it has like noise gates and noise reduction and nice high pass filters and stuff like that with that let's go ahead and kick this off hello and
Starting point is 00:00:43 welcome to python bites 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.
Starting point is 00:01:12 And I'm Brian Ocken. 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, pythonbytesm live usually tuesdays at 10 a.m pacific time and finally
Starting point is 00:01:31 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 it's permanent right there. You can forward it, share it. All you got to do is head over to PythonBuySite.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.
Starting point is 00:01:57 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 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 newsletter form to them. The one you sent was like 95% opened.
Starting point is 00:02:19 That's awesome. That is so awesome. Thank you, everyone, for actually caring and subscribing. So buy them by StatFM. Click on newsletter and sign up for it. That would so awesome. Thank you everyone for actually carrying and subscribing. So PythonBytes.fm, click on newsletter and sign up for it. That'd be great. Yeah. Yeah, go ahead. Oh, 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.
Starting point is 00:02:42 Save our old emails from us. But we also, we haven't talked about it a lot, but the search box on Python by SFM 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. Yeah, absolutely. Yeah, I use that. I actually use that to decide,
Starting point is 00:03:03 oh, if we talked about this thing before. Three years and I already forgot about it, or should I cover it, right? Yeah, exactly. Yeah, I use that. I actually use that to decide, oh, if we talked about this thing before, three years and I forgot about it, or should I cover it? Right? Yeah, exactly. Amazing. Amazing. Amazing. act and it's uh from necto nectos i think it's the person's maybe just named their name is necto and it's their act in the 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 um it what it does it's super cool it runs um what it's doing is it's running github actions locally so uh if you 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.
Starting point is 00:03:51 I used Homebrew, but it's got installation instructions for Chocolatey or even GitHub CLI. I could have used that, or MacBoards, Scoop. I didn't know what, I don't know what Wingit is. Anyway, getting-
Starting point is 00:04:03 Wingit is, you know how on, for example, on Boodoo we have apt-get, Debian systems sort of thing. So that is the, for a long time, Chocolatey was the package manager. It was kind of like Homebrew, sort of external for Windows. And Wingit is like the
Starting point is 00:04:20 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,
Starting point is 00:04:33 really what it does is 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.
Starting point is 00:04:51 But the control over it's really pretty cool. So I should have looked this up, but 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 your pull requests or you can run a specific job. There's a whole bunch of different parameters for this to be able to run different pieces. I used it just to run. I wanted to just check my test run locally. And because I wanted to play with the different test jobs and coverage um be able to
Starting point is 00:05:25 run those individually and it really was slick and it's super fast really easy to use uh it's really pretty cool it's um also open source so nice um we're gonna a link to the github repo as well so you can check it out and it's uh apparently i'm not the only one that loves it it's got 1.3 thousand stars so that's Forks. Oh, that's Forks. There's 50,000 stars. Nice. It's awesome.
Starting point is 00:05:49 This is so awesome. If you do a lot of GitHub actions, this is so cool. One, you can sort of test it and run it faster and iterate really quickly until 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 37signals people are doing
Starting point is 00:06:07 around deployment and stuff. One of the things they did recently is they moved their continuous integration. Maybe we've been using this, I don't know. Moved their continuous integration to developer machines. So instead of having one server where all the builds just queue up behind each other, it's like everybody has a super high-end computer.
Starting point is 00:06:26 It's oftentimes faster than the CI servers anyway. So run it there as like a pre-commit hook sort of thing. Or some sort of push, some kind of event locally. And so this 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 the one of their ideas for this also is to use it as a local task runner instead of like make or or things like that um which is interesting you could have workflows that aren't
Starting point is 00:06:57 reachable from ci that you can just run locally through through yeah you're already using it so 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
Starting point is 00:07:44 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 ingrock, you just say here, just everybody connected my little local dev app and click on this and see what, how you think it feels right. Or you were in a webhook, 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, hit flask or fast API or whatever it is, right? Most, I did it for webhooks a bunch recently, and also for mobile apps.
Starting point is 00:08:28 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. We were 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? through the api you know hitting breakpoints in pycharm awesome right yeah but it's more of a 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 potr which is an open source
Starting point is 00:08:58 in grok alternative so the idea is exactly the same that I just described. However, the way it works, don't watch the video. It's not very bad. Go to the docs instead. Similar, though, to ACT, it has not as many, but 2,000 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.
Starting point is 00:09:23 You need a machine. This could be a VM on the internet. 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 Cloudflare token for Wildcard because it manages subdomains automatically and GitHub credentials to log in. And then that's it.
Starting point is 00:09:51 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
Starting point is 00:10:11 and then all of a sudden you've got your very own ngrok where data also is not going through ngrok, but it's just private to you, of course, right? Because it's HTTPS over to SSL and then back. Okay. So is it setting up, like does Ngrok set up a Docker? Does it go through Dockers also?
Starting point is 00:10:32 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. You just use a CLI that like talks to that thing and then sets up a connection, an SSH connection back to you. Okay.
Starting point is 00:10:47 And then when I'm, when I'm debugging it, if I set a break point 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,
Starting point is 00:10:56 okay. Got it. Yeah. Yeah. It really does work just kind of like in grok. Yeah. Yeah. Yeah.
Starting point is 00:11:01 It's super, super similar. I haven't used it yet, but I'm, I'm looking to start trying this out. And then for the client, there's a couple ways to install it, but pretty straightforward. And then you just, instead of saying Docker, HTTP something, you say Porter HTTP something, and off you go. Nice. Okay, cool. Pretty cool. It sure is. You know what else is neat, Brian? I think Scout is neat.
Starting point is 00:11:25 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 OEM, then you say oh
Starting point is 00:12:05 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.
Starting point is 00:12:35 And I just learned this, Brian. 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. There's something on their pricing page about that. So you can start your free trial
Starting point is 00:12:52 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 pythonbyte.fm scout check them out it really supports the show indeed indeed what's next brian we've talked about type annotation a
Starting point is 00:13:15 lot and i ran across this blog post called annotating args and keyword args in python and actually i never tried that i i've mostly just if i have uh star args or star star kw 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 called about it from Redawan. I think what's his first name anyway redawan delaware cool name uh and it's the the there's some some problems with all the the ways he tried that seemed obvious like um sending passing in a dictionary that he expected apparently my pie doesn't like that um or doing like a dick that sort of describing the tuple or dictionary that
Starting point is 00:14:07 are coming in. There were issues with those the but I'm just going to hop to the end result. Apparently, I'm 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 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.
Starting point is 00:14:37 But you set up a class for your keyword args and describe what the what the types are there in your keyword under type dick 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 you think of 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.
Starting point is 00:15:13 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 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 uh insert pools um so i would have
Starting point is 00:15:31 never come up with this to create a class derived from pipe dick with multiple values to then wrap that as an unpacked of okay i'm awesome they have it yeah oh but 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 27, 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, 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.
Starting point is 00:16:16 And it's pretty awesome, Brian. It's pretty awesome. Awesome. Ever since 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
Starting point is 00:16:45 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 test category i think that's the failed indent i'm right here i think that's all just okay i don't think that this level i think the test got unintended for some reason okay uh what kind of terminal do you rock and so on okay so i'll just go i'll pick a couple just 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 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 proton
Starting point is 00:17:25 mail you can actually have those badges you can have signal telegram you said to denota how do we say that um whatsapp wechat all those things are pretty cool right for groups you have 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 um it buckets social coding i guess i don't know but you know get lab instagram pinterest quora reddit etc and then you've got some for oh the os right not just really standard ones but but like SynthOS or Deepin or whatever. But they also have their little icons that go with them, right?
Starting point is 00:18:09 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. But like mobile frameworks. So they've got like Flutter, for example. Like the app I was just talking about
Starting point is 00:18:26 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's what security platform is using is it like uh this is verified by sneak and so on anyway so if you're thinking about your next project or you get a profile or whatever i present to you many many github badges for the taking yeah see if i can get like like four rows of badges onto a project that'd be fun exactly exactly well um any other extras wait this is what 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 jenga not jingo not folks so jingo the jingo not program is a program to help people who are interested in jingo become core contributors
Starting point is 00:19:17 not just users of but contributors to the jingo 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 session two application is open. I actually interviewed Sarah, sorry, Sarah, voice, Sarah voice and Tushar Gupta about their experiences running and coordinating the first one right back on talk python in march yeah march uh 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 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. We talked all about this whole new deployment
Starting point is 00:20:17 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 this 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
Starting point is 00:21:03 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 uh anyway be careful if you're if you're doing a job interview and they say hey go uh go run some code um maybe don't um or look into it a little bit more i mean it's so bad though because it could
Starting point is 00:21:35 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 i could just awful that wouldn't yeah uh 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 pytest course is a complete pytest course is going from uh teachable to a new platform podium um and it's just the reasoning is uh that 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
Starting point is 00:22:13 teaching PyTest and other things fits better with Podia platform than with Teachable. So 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 pythontest.podia.com.
Starting point is 00:22:28 And now through Sunday, you get 25% off if you use the code Pytest. And that's P-Y-T-E-S-T. And you can find that link in the show notes also. Okay. So, and lastly, 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 uh episode 220 at python test that's getting the most out of pycon and some great in some great tips from rod ludwick rob ludwick um about you know having fun at pyCon. So check that out.
Starting point is 00:23:05 Indeed. Yeah, I'm going to be doing probably a data science panel podcast that's also going to be live streamed with the JetBrains crew over there. So that'll be a lot of fun. Yeah. And we'll 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.
Starting point is 00:23:26 Different background. All right. Awesome. All right. Is that it? I have one more. One last minute one, which I thought was cool. Just one I just threw in. I saw this on Mastodon just before we started recording. Somebody named Orion Reed posted this bookmarklet
Starting point is 00:23:41 that to visualize your DOM, it's a JavaScript bookmarklet to visualize your DOM in 3D. I love it. So cool. 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
Starting point is 00:24:31 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 programming humor it's just just a little game and it says import on our slash programming 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 it. Right.
Starting point is 00:24:52 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 C colon windows backslash system 32
Starting point is 00:25:05 ooh that's just terrible um yeah I don't think 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
Starting point is 00:25:21 that's funny just a silly little game. All right. Let's close this show out with something special. I saw this 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, no, this came from Dan Bader. He sent this over to me.
Starting point is 00:25:40 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 the MIT open source license, like for real. Okay? Okay. So it's AI generated, which is what makes it crazy.
Starting point is 00:25:54 And it probably has Python involved in there somehow. And since AI generated content can't be copyrighted, we should be safe to play it. Let's do it. So 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 bail. But end of the show is we're playing this. So here we go. obtaining a copy of this software, associated documentation files, this software, to deal in the software without restriction, including without limitation the rights to use, copy,
Starting point is 00:26:40 modify, merge, publish, distribute, sublice, and or sell copies of the software And to permit persons to whom the software is furnished to do so subject to the following conditions The above copyright notice and this commission notice Shall be included in all copies or substantial portions of the software The software is provided as is, without warranty of any kind, express or implied. Including but not limited to the warranties of merchant tabulating. Bye, everyone.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.