Transcript #280: Easy terminal scripts by sourcing your PyReturn to episode page view on github
00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
00:05 This is episode 280, recorded April 19th, 2022.
00:10 I'm Michael Kennedy.
00:11 And I'm Brian Okken.
00:12 And I'm Pat Decker.
00:14 Welcome, Pat. Great to have you here.
00:15 Well, thanks for having me on.
00:17 Yeah, it's really exciting. You and I were chatting a bit about less new programming languages a bit over email.
00:24 Yeah, it'd be fun to just have you come on and share some of the things that you're passionate about and whatnot.
00:30 Tell people a bit about yourself.
00:32 I got started with computers way back in the day, high school.
00:36 I had an Apple II computer at school.
00:39 Eventually got a Commodore 64 at home.
00:41 I did Pascal on cards at Iowa State University and did a data processing program at Kirkwood in Cedar Rapids and got my first job out of there about 30 years ago or so.
00:56 So I've worked mainframe and PC, COBOL C and a little bit of Python here and there.
01:06 And it sounds like you're doing DevOps type things today.
01:08 Yeah, the company is like many gone from on site in their own data center to 80% or so So I'm running on AWS and so I get to share your same frustration with AWS interface in Python.
01:24 It's not always obvious how that works.
01:27 It's updated every week and I know the way it is updated every week has got to be some code gen is running somewhere that regenerates it and it's just never quite discoverable, right?
01:39 It's fine once you get it working as long as you don't touch it or have to understand it.
01:43 - This is not the sign of a fantastic API, but it's cool.
01:46 You get to work in AWS.
01:48 Cool, well, great to have you here.
01:50 Now, Brian, before we jump over to your first topic, I just want to say this episode is brought to you by Mergify.
01:56 I am psyched about what these guys are offering.
01:59 Mergify is super cool.
02:00 It's all about automating Git collaboration.
02:03 And I have a lot to say about Git, but I want to start with pie because I love pie.
02:09 Banana cream pie is my favorite.
02:10 I'll take a cheesecake.
02:11 Does that count as a pie?
02:13 Is that what we're talking about?
02:13 - No, we're talking about HTT, HTTpie.
02:17 And the--
02:19 - Still a good pie.
02:20 - Yeah, the website actually lists in their readme, tells you exactly how they wish you to pronounce it right off the bat, H-A-T-T-Pie.
02:29 Anyway, it's a command, it's a really cool tool.
02:31 It's a command line tool, and I think we've covered it before for interacting with, it's especially useful for APIs.
02:39 So you don't--
02:40 - It's one of the first things I install on any server on my Mac if I get a new one, like straight up, this thing is fantastic.
02:45 - Yeah, yeah, and it's so fantastic that it had 60, this is what I want to cover.
02:50 I'm sorry to laugh.
02:51 It had 54,000 stars on GitHub, and then it lost them.
02:56 - But it didn't?
02:57 - Then it didn't.
02:59 So, oof, what a cliff.
03:02 So how many does it have now?
03:04 Right now, if we look, it's got 16.1 thousand.
03:06 - Oh my gosh, it's way back.
03:08 - Yeah, actually this morning when I looked, it was just 16.0, a thousand.
03:12 So it's gotten a hundred stars just as I was researching this.
03:16 So anyway, the, that's one of the, I just, I guess what I want to shout out to these guys of, it's a cool tool.
03:25 If you're doing APIs, check it out.
03:27 And also if you've started before, restart it because they, they deserve it.
03:32 And what happened was they accidentally put their repo private for, there were, somebody was trying to do make it private, make some other test repo private, and they accidentally put the main one private, and if you're even private for a second, you lose all your stars.
03:50 Warning, don't make your public stuff private.
03:53 >> Don't do that.
03:54 >> Oops.
03:55 >> Wow. That is a good warning.
03:59 It's a great tool, but a good warning.
04:01 It does have a danger zone.
04:03 Danger zone, this is going to happen, But unfortunately, the warning is equivalent if there's zero followers and zero people interested in or you have one of the most popular things on GitHub.
04:14 Like it should be like, this is super duper important.
04:17 You're going to lose 54,000 GitHub stars.
04:19 Are you doing it?
04:21 Well, and also, I mean, if, if you work with a lot of, GitHub repos and you're like, like maybe you made something public for a talk and then you're making it private because I don't know the talks over or whatever.
04:33 Or you just don't want to maintain something like I'm just done with this thing.
04:36 I don't really want to do that.
04:36 >> If you're working with it a lot, maybe you've seen that warning so many times that you're not really reading it anymore and double-checking.
04:43 I guess this is just a warning, double-check it if you see that warning box, make sure you're on the right repo.
04:50 >> Indeed. Pat, what do you think about this?
04:53 >> It's pretty tragic.
04:54 It's like those end-user license agreements where we all see them so often, they just automatically click, I think.
05:00 >> Yeah, exactly.
05:01 the confirmation dialogues and stuff.
05:03 You're like, "Well, I have to copy this and paste that there.
05:05 I just can't continue. So I'm going to just." Instead of warning danger, I think people see, "I want to get my work done, so click here to get my work done." Then, "Oh, no. What happened?" >> Yeah.
05:16 >> Yeah. Well, Brian, I believe you have at least helped a little bit.
05:22 David, out in the audience, is starting it right now.
05:24 >> Oh, I forgot to start also. I'm going to go start.
05:26 >> You better get in there and start. Boom. All right, plus two.
05:28 >> Couldn't we?
05:28 >> I was going to start myself, but I'm not logged in any of my browsers for some reason on this account.
05:32 So no starting off to start it later.
05:35 Also a little bit out of order, but I want to also just cover this other thing.
05:40 We are generally not a hundred percent of the time 'cause there's still a little bit of long tail stuff happening, but generally we're moving our live stream of the recording, the one where David's at, I'm starting right now.
05:53 Thanks for being here, David.
05:54 That recording is now moving to Tuesdays at noon Pacific time.
05:57 So if people want to come be part of the live show, see the video version, as well as just make comments or whatever, not Wednesday, Tuesdays in general, but check for the next couple weeks 'cause it is still some pre-scheduled stuff.
06:11 - Yeah, so how do people find out when it's coming up next?
06:14 - I would say the best way is just to subscribe to the YouTube channel and then, you know, I hate to say it, but push the little bell for notifications so it'll tell you, like, hey, this thing's coming up and it'll let you know that we're gone live.
06:26 - Yep.
06:27 I don't have a great better way.
06:29 Maybe we could do a mailing list, but it's a little tricky.
06:32 >> But usually stick around on Tuesday Pacific.
06:34 Tuesday noon Pacific, we'll be recording.
06:37 >> Yeah. If you check YouTube once a week, you'll see it's scheduled pretty far out and then you can get a reminder for just that one thing.
06:42 You don't have to always get messages.
06:44 Okay. This is a fun one.
06:47 You mentioned some of the older programming languages.
06:49 When I was in college, I was studying chemistry, chemical engineering, math, all these different things, And as part of that, they said, "You're gonna have to take a programming class." I'm like, "Super, what's it gonna be?
07:01 "Like C++ or something?" Remember, this is like early '90s.
07:04 So that was a good choice then.
07:06 And they said, "No, you're gonna take "the most important programming class "you're ever gonna take in your career.
07:11 "You're gonna learn Fortran." I'm like, "Wait a minute, no, no, no.
07:15 "I don't wanna do that.
07:16 "That doesn't sound like the most important thing ever." But nonetheless, that was one of my first courses I had to take.
07:23 I only took a couple.
07:25 Eventually got to take some C++, But Fortran was where it started.
07:28 So here's an article that was recommended to us by, let me make sure I get the name right, Galin Swint.
07:34 And Galin is a PhD researcher and said, "Hey, here's a really interesting article." The article, I don't believe is by them, but it's about the sort of, I think it was something in their lab they were talking about.
07:47 It says, the title is, "The Counterintuitive Rise of Python "in Scientific Computing." Why is it counterintuitive?
07:53 Because Fortran is fast, and what you want to do is process lots of data and you want to do it fast.
07:58 So here's a really interesting story of people who were doing older stuff like Fortran and C, sort of were forced in, coerced into doing a little bit of Python and accidentally made their supercomputer stuff go like 100 times faster or something in Python rather than in C or rather than Fortran, which is a counterintuitive result, right?
08:20 - Yes, it is.
08:21 - Yeah, so I think that I'll cover a few details of this article, just pull out some highlights.
08:27 But the reason I'm bringing an article instead of like a tool or something is I think this would be interesting for people to share if they're in a situation where they're like, oh, Python is no good, this is such a slow language.
08:36 It's like doing math is like a thousand times slower than C, I don't actually know what it is.
08:40 But it's a lot, lot slower, right?
08:42 So it goes through here and here's a couple of things.
08:44 It says, in our laboratory, a polarizing debate has been raging since 2010.
08:49 Summarized by the question, Why are more and more time critical scientific computations formerly performed in Fortran now written in Python, a slower language?
08:58 Oh, Python, a slower language.
09:00 So Python does have the reputation of being slow and especially around math.
09:04 I think it's honestly, it's earned it.
09:07 Unfortunately, I would really love, sidebar, I would really love to see Python adopt something along the lines of value types that can be boxed back to Py longs.
09:18 So like, on the stack locally it's a number but it gets complicated.
09:22 But I think that would actually solve a ton of stuff.
09:24 Anyway, so yeah, plain Python is slower than Fortran.
09:28 But when you do computational stuff, you don't do plain Python.
09:32 What you do is you do numpy, scipy, dask.
09:36 All of these things are written in C with a thin coordination layer in Python as part of its API.
09:42 So here's like some graph you can see on the article.
09:46 And it says, here's like, you know, 10 to the one versus 10 to the minus two.
09:51 What is that a hundred times faster if you use Cython or Numba or NumPy and so on.
09:57 So pretty interesting.
09:58 And it also shows, guess what?
10:01 Beep, did you do the news alert?
10:02 Fortran is somewhat less popular than it used to be.
10:05 Oh no.
10:10 So there's an interesting story of this project nicknamed Projector written in, written around 2010. So modern in quotes, Fortran, by somebody named Bob.
10:24 So Bob worked on this project and there's apparently, let me find the numbers here.
10:28 It's like 1.5 thousand lines of Fortran code. So a lot of Fortran code, like a lot of complicated math bits, the kind you kind of don't want to touch after it works. And it's going to do is trying to project something, thousands of multiple, multi perforations of combustion liner onto a 3D complex shape made of millions of polygons.
10:51 So that might get complicated when you multiply those numbers together.
10:55 And it turns out, Bob soon discovered that he was gonna use NumPy and this thing called a KD tree, 'cause there's a bunch of people working in the lab that only knew Python.
11:07 So like, here's a Python version you can use.
11:09 And he thought this is gonna be rough.
11:11 It's gonna be super slow.
11:13 So he went and ran it after he got it done.
11:16 And the Fortran version ran in six hours and 30 minutes.
11:20 The Python version, four minutes.
11:22 - Wow.
11:24 - So what happened?
11:26 Is Python a hundred times faster?
11:28 No, Python is easier to work with and has many more built-in algorithms and data structures.
11:34 this KD tree thing was using a different data structure, is a different data structure that has O log N complexity.
11:42 Whereas the Fortran version, because it's so hard to write code in, they just wrote it in the simplest way they could make it work.
11:49 So O N, and when you have billions times, millions times thousands, O log N wins, even if it's in a slower language.
11:57 So if the conclusion was Fortran would have been faster if they had implemented this KD tree algorithm in it.
12:02 but the people working on it, they're like computational scientists, not PhD data structure type people, right?
12:10 They're already super busy just trying to do the programming and not working on cutting edge data structures and optimizations and stuff.
12:19 So it was very easy to try one new thing in Python, which would have been very hard in Fortran, and we got this big win.
12:25 So anyway, I think the debate about performance, developer speed versus execution speed, but also straight up execution speed.
12:33 I think it's really interesting in Python and it's hard to be nuanced enough.
12:37 It's always there's some little interesting wrinkle like this.
12:40 >> Yeah. If you're going to hand code everything anyway, it's also faster in assembly.
12:46 Just write assembly.
12:48 >> There's a downside to that.
12:51 >> Why not?
12:51 >> Yeah.
12:52 >> I've always wanted to stick to this one processor I really loved forever.
12:57 >> This is interesting. I like it.
13:00 But it sort of reads like a commercial.
13:03 So Bob was programming scientific computing and he was not happy in Fortran.
13:08 Bob tried Python and now he's happy.
13:11 >> Well, I think Bob unwillingly tried Python and eventually he was happy.
13:16 It sounded like he was dragged through it.
13:18 >> I like it.
13:19 >> Yeah. I know it does read a bit like that, but I think it's an interesting story.
13:22 Pat, what do you think? You have a bit of a historical perspective on all this.
13:26 >> Yeah. I didn't go to school for chemistry, but I bet Fortran's not popular among chemistry students, is it?
13:32 >> No, not anymore. Sure.
13:34 >> I did a little benchmark the other day.
13:37 I was trying to just see how fast some EFS storage was on AWS versus EBS.
13:44 I wrote a Python script to do that and wrote 10 million records out.
13:48 I thought, well, maybe Python is going to be slow.
13:51 I thought I'll just whip up a quick thing in Rust here.
13:54 As it turned out, Python was 10 times faster at that too.
13:58 on the same exact hardware.
14:00 And I'm not sure why that was.
14:02 I may not have done something that was optimal for Rust, but there it is 10 times faster.
14:07 - Yeah, sure, no, that's super interesting.
14:08 I've seen Python just rip across like OS type stuff like that.
14:12 It's pretty good.
14:13 All right, well, what's your first item, Pat?
14:15 Are we off to the metaverse?
14:17 Or is the metaverse off to us?
14:18 - I stumbled across this the other day.
14:20 We've had Lucas Longa on the show, the programmer in residence, And it looks like they're going to get another year due to a donation from a meta of $300,000 to the Python software foundation.
14:36 And it was specifically for that purpose.
14:39 That's a really big deal.
14:40 and, and like you said in the past, Python is very important to Meta, Facebook's parent company now, because of much of their infrastructure is built on it, PyTorch in particular.
14:54 they use it a lot.
14:56 So their internal implementation of Python is called Cinder, apparently, which I think I've seen mentioned a few times.
15:03 But they would like to see continued development, and they're going to fund it, which is awesome.
15:08 Yeah, that's really neat.
15:10 I think Cinder is a fantastic thing they've created.
15:14 And it's interesting, it's open source in the sense of, like, maybe the better term would be source open.
15:20 Like, here, we're going to put this out here.
15:22 We don't expect any contributions, and we don't want to put it out there is like a project to grow on its own, but we think it might inspire people.
15:28 So here's the source.
15:30 But what they have contained in there is amazing.
15:33 There's just so many optimizations and different things.
15:37 I think they might even have that value type thing I discussed in there, I can't remember, but yeah, that's a really cool project that they're working on.
15:46 So this is great.
15:47 You know, I think Lukas Schlenge has gone sort of full circle, right?
15:50 He was independent, he was at Instagram for a while, which is, you know, part of meta.
15:55 and then left to sort of do his own thing and found his way to this developer in residence and now Meta is sending money so that he stays there.
16:03 That's like an interesting circle, I think.
16:06 - Yeah, that's good.
16:07 It seems tenuous though that we have it like one year at a time, that we don't know if we're gonna have a developer in residence longer than another year.
16:16 - It's like a postdoc.
16:17 - Hopefully it's a game of tag with Microsoft coming next or something.
16:21 - Yeah, exactly.
16:23 That'd be great and I think there are a couple of organizations doing that.
16:25 So I know that there was a talk about having multiple folks participating in that group, which would be great because I know there's way more work than Lucas can do on himself. He's quite busy.
16:36 >> Yeah.
16:36 >> Alvaro in the audience has a fine name proposal here.
16:40 The PSF developer in residence should be called the PSF dunderder__dir__.
16:48 I hereby am opening a pep.
16:51 Well done Alvaro. No, just kidding.
16:53 I would have given more work for something silly like that.
16:56 But that's pretty awesome. The PSF Dunder, DunderDir.
16:59 Cool. Well, thank you, Pat.
17:01 Now, before we move on to the next item, let me tell you all about our sponsor today.
17:07 And like I said, I'm really excited about this.
17:08 I'm actually doing a bunch of work on some Git presentations.
17:11 And so I'm just trying to think about what's the workflow with Git and how can we work better, especially doing team type stuff.
17:20 So Mergify is a service that will help you and especially your team be way better with Git.
17:27 So it's an amazing tool to make you and your team be more productive with GitHub in particular.
17:33 It's all about leveling up pull requests.
17:35 So some of the features of their platform that you hook into your repositories are automatic merges.
17:42 So you can set up conditions for an automatic merge and Mergify will take care of merging the PR as soon as it's ready and passes all the details.
17:49 There's automatic updates.
17:51 So if you have multiple pull requests, it'll merge the pull requests serially on top of each other.
17:57 So there's no way to introduce a regression.
17:59 There's also merge queues.
18:01 So if you've got like a long CI process and things are slow or you've got lots of code, you can set up priorities and have the most important ones merge fix, like bug requests or bug fixes.
18:12 Especially if they're security fixes, they go right here, right at the front.
18:15 Do those now.
18:16 So that's awesome.
18:17 They also have something called backport.
18:19 So, Mergify will copy the pull request to other branches once it's merged, if you set that up.
18:25 So that you can ship bug fixes to multiple branches, feature branches and whatnot, automatically or even older versions, right?
18:32 Version 1.0 of your app versus 2.0, 2.2, whatever.
18:37 Have those automatically merge those bug requests, bug fixes in.
18:41 Super cool. So, Mergify does all these things automatically that you would otherwise have to do manually.
18:46 So you save time, you and your team will focus on projects that matter the most.
18:50 Mergify is coordinated with any CI and is fully integrated into GitHub.
18:55 They also have a startup program that can give your company up to $21,000 of credits.
19:00 So if you're doing a startup and you want to use them to help grow, you'll reach out to them for sure.
19:05 Do that by going to pythonbytes.fm/mergify, sign up for a demo and get started.
19:10 The link is at the top of your podcast player show notes.
19:13 So just click it.
19:14 Thanks to Mergify for supporting our show.
19:17 Very cool project.
19:18 All right, Brian, what's the next one here?
19:20 >> Well, we were talking about data science a little bit, and people using Python for data science.
19:25 But one of the things that people use when they're doing data science, plus other stuff in DevOps and whatever, is dashboards, dashboards in Python.
19:33 It's one of the powerful reasons to use it.
19:36 There's a couple of things I want to discuss around dashboards.
19:40 Both of them come via suggestions from Mark Skov-Madsen.
19:45 So thanks, Mark.
19:46 First is the easiest way to create interactive dashboard in Python.
19:50 Obviously it's their opinion, but it does look pretty easy, is to use HVplot.interactive.
19:57 So this is an article that talks about how to do this.
20:01 And it really looks nice.
20:04 This panel looks pretty good.
20:06 - Oh yeah, that's great.
20:08 - Pulling data out, you got dark and light, and you've got the controls on one side.
20:13 >> Okay.
20:14 >> This is just using some pre-canned data, but you can use obviously your own data.
20:21 But the article is pretty short, and one of the things I love about it, of course, is it's got a animated GIF to show you exactly what you're getting into.
20:30 Then also a video.
20:34 One of the authors, Sophia, just reads the, like pretty much goes through the article and talks about it and shows the demo of everything.
20:43 So that's nice.
20:44 And it's only like six minutes.
20:45 I was watching it this morning.
20:46 So really cool if you want to try.
20:49 And so HVPlot is part of the HoloViz family of tools.
20:54 So a lot of people are already using that or if you're not, check that out.
20:57 Cool stuff.
20:58 - Yeah, this looks great.
20:59 - The other-
21:00 - I always want to have good use cases for this.
21:03 And I just, I don't find myself doing lots of dashboards and stuff, but every time I see them, I'm like, "Wow, what can I build a dashboard for?
21:08 That would be great to have this." >> Well, so I have some use cases for dashboards, but I really don't want to spend a lot of time on it.
21:14 I think even though this is like six-minute video of how to get through it, I think that probably I'd have to set aside maybe a half day to figure out something to get it usable.
21:25 But it does show that once you understand what you're doing, you can throw together dashboards pretty quickly and be able to.
21:33 Well, in the demo, one of the dashboard items was in the controls is like, let's say you've got a whole bunch of columns or some different elements in a row that you, or in a column that you want to filter out.
21:48 So there's ways to filter your data so that you're looking at different stuff.
21:51 And I was like, I have exact use case for this.
21:54 So I'm pretty excited.
21:56 The other thing around plots is maybe a HV plot or dashboards is maybe HV plot isn't the right thing for you.
22:04 Well, we've got another thing is the PyData Global 2021.
22:09 There's a video stream up on YouTube called Python Dashboarding Shootout and Showdown.
22:16 And so this is a whole bunch of different presenters talking about building dashboards in Python using either dash or panel or voila or streamlet.
22:28 So watch different people do it.
22:31 So you wanna watch some, use something other than HP plot, watch this video.
22:36 One of the things I love about this is if you're only looking forward to one of them, one of the commenters on this video put up hyperlinks to each of the different sections.
22:47 So you can just hop right to the video part that you want to watch.
22:50 - Oh yeah, that's great.
22:52 So yeah, it looks good.
22:52 I love these dashboards.
22:53 It's definitely one of their powers.
22:54 - Pat. - Pat, do you do anything?
22:56 Sorry, Brian, I took out your, or.
22:58 - Well, we do have some prebuilt dashboards a model or the EKS cluster in Grafana and Elastic.
23:07 But this is another option.
23:08 It'd be good to do something ad hoc.
23:10 If it's a quick and dirty, maybe I can clip on out.
23:13 >> Brian, did you just grab a Pandas data frame and then make it interactive?
23:17 >> Not quite, but it's almost.
23:21 I mean, this is built to go really closely with Pandas data frames.
23:27 So the code is, you're doing some filtering, some pipeline processing like group buys and and selecting indices, what index you're going to use. And then, yeah, it's pretty much interactive at that point. But the some of the code around this is building the widgets for the controls.
23:46 You got to define the UI and how people interact with it. Got it.
23:49 Yeah, it's not it's but it's pretty easy. I can't imagine. I mean, it's not obvious because so you have to kind of it's good to watch a tutorial or something. But it's also not difficult and then putting it together.
24:02 Yeah, so most of the code in here is not the interactive plot because that's already happens, but it's the widgets.
24:10 >> Got it. Cool. Thanks.
24:11 All right. I think you all will be excited about this.
24:14 I think this is quite a neat project.
24:17 Now, let's see. This was sent over by Dave Chavelle, or actually is both sent over and is by Dave Chavelle.
24:24 Brian, do you ever use entry points in Python packages?
24:28 So you can set up, you can pip install a package, and then if you have that Python active, then you can just type a CLI command that is one of the entry points there, you know what I'm talking about?
24:37 - Yeah, I do that all the time.
24:38 - That's great, but there is some overhead to set it up, right, I've got to install it as a package and whatnot.
24:45 This project called SourcePy allows you to basically turn any function into a CLI command, straight CLI command, in one line.
24:54 So let me show you, talk about it.
24:56 And it doesn't involve packages and installing or anything like that.
24:59 So imagine you've got some file here and it's got a function, just a def function, pygrep is the example here, and it has a pattern, which is actually a regular expression pattern.
25:09 Note the typing.
25:10 Has grep data, which is a list of text inputs.
25:14 So it would be a string or something, but it could also be like something piped or standard in or something along those lines, right?
25:20 So if I have this script that just does that work with those type assigned data, and I have source py installed, I can say source this file here, and what it will do is it'll actually add up the, it'll expose those functions like pygrep and so on.
25:39 So then I can just type pygrep, and it'll tell me how it works.
25:42 And somewhere in here, where's the example of running it?
25:45 Oh, right here, I think it is.
25:46 So what you can do is you can just run pygrep against, now as a function, right?
25:52 As a CLI function.
25:53 So it has all sorts of cool features.
25:55 For example, it has this type handling.
25:58 So type hints that we talked about can be used to coerce inputs off the command line into integers and patterns and I/O streams for files and standard and such.
26:10 Let's see, it just takes basically any function like this and turns it into something you run on the shell.
26:16 Then you can also go down and you can do, I believe there's some class-based way to work with it and so on.
26:24 But yeah, this is pretty neat.
26:25 What do you think?
26:25 I guess I'm confused at how it works with the normal source.
26:29 Can we, that is a good question.
26:31 Like, how does it not break normal source?
26:34 But that's a good question.
26:35 It is a good question.
26:38 Like it, does it replace it for a while?
26:40 You've got it, installed or does it extend it somehow?
26:44 I don't know.
26:45 I haven't looked at it enough to understand how it either coordinates or override.
26:50 That's already put you on the spot.
26:53 - No, no, no, it's a great question.
26:55 Yeah, I haven't played with it, but it's really important.
26:58 You would want to know 'cause you wanna break your regular source stuff.
27:00 I'm sure you could alias it if for some reason it conflicted, but I don't know.
27:04 - I think, so I think this would be really helpful for, aside from that, if that's all working great, then aside from that, I think it's a very useful way to have a handful of little tools for a project to be able to use that.
27:18 If you're trying to share it with other people, I think packaging it the right way to have entry points is probably the right way to go.
27:26 >> Yeah. If you want to do a more formal like a PIPX style, but this feels way more ad hoc.
27:32 Like Pat was talking about his little script that he built to test some stuff.
27:35 You could run this and then just call those functions as if they were built into the Bash or ZShell or whatever.
27:40 >> Definitely.
27:41 >> Also worth pointing out, it has built-in native async support.
27:44 If you have async functions and you source it, then you can just call it as if it was a regular command line command and it still just takes it and runs.
27:54 Kim Van Wick, who's been a co-host here before, has a clever thought.
27:59 I suspect it wraps the normal source command and hands it over to the normal source if it isn't Python.
28:05 It's a good idea.
28:06 >> Probably.
28:07 >> Yeah, probably. Although, like I said, I haven't really looked at the mechanism there.
28:11 But this looks like a cool project.
28:13 It's got all supported types like JSON, and unions and date time objects and all kinds of stuff.
28:19 So check it out if you do a bunch of ad hoc stuff with Python on the command prompt.
28:24 I don't know. How's this strike you?
28:26 I know that this might touch some of the things you're doing in your world.
28:30 >> Just yesterday, one of the guys was contacting me because he needed to go and cycle through a list of addresses to hit an API.
28:40 This could be something you'd use like that, consume this file and hit the API with each example and away we go.
28:47 >> Yeah, absolutely. This looks great for making those little scripts you build with Python, like literally scripts.
28:54 I know a lot of people call everything Python scripts, but this is really for those types of apps.
28:58 >> A single file script.
28:59 >> Yeah. A single file thing, not like a 20,000 line Flask app.
29:04 That thing starts to stretch the terms of what script might mean, but this is exactly for those things.
29:09 >> Yeah.
29:10 >> All right. What's your final one, Pat?
29:12 >> This is similar to what you just covered actually.
29:15 You've talked I think a little bit about it before.
29:17 Conch shell combines the best of Baz shell and Python in the Linux terminal.
29:23 >> This is way more than what I covered.
29:25 This is like another level here.
29:27 >> It takes it to another level, yeah.
29:29 I ran across it on its boss, which is a nice site for open source type things.
29:36 In a nutshell, what it does is provide you with a new shell, where as they demonstrate here you can use straight Python.
29:45 You can import JSON, for example, and define a variable or a table, print that out and format it, the length function here.
29:58 But you can also then mix in regular bash functions, where we, for example, here it curls from a website, the result comes back and the length function tells you the length of that curl.
30:11 >> How interesting.
30:12 >> One of their famous-
30:13 >> That's a little bit like, almost like a Ginger Django template, but in your terminal, you put a little dollar to say, here's a bit of code to run on the shell.
30:24 >> Yeah.
30:25 >> Shell to run here.
30:26 >> The one famous statement they have is, I always forget how to do a for loop in Bash, but in Python, it's pretty easy.
30:33 They have a rule, it evaluates to Python first.
30:37 If it evaluates to Python, it executes as Python.
30:40 If it doesn't, then it more or less executes as Bash.
30:43 And I do have a link we could put in the show notes too, to a video demonstration from their homepage.
30:52 And the guy does a spectacular demonstration with autocompletes and they have what they call contributions.
31:02 And that also begins with an X.
31:05 So it's like a plug-in or an add-on, but it's a contribution.
31:09 And it is get aware and it is virtual environment aware.
31:16 It sounds like a killer environment, but it would take some getting used to.
31:21 I have a lot of muscle memory to overcome to take full advantage of it.
31:26 It's cool.
31:27 Brian, have you played with this?
31:29 You know, I tried to play with it a couple of years ago, but now I haven't.
31:34 but I do want to and I think one of the things, I didn't give it a fair shake.
31:38 I think it would be good to just say for a week, maybe I'm going to try to just use this instead of pulling up my normal terminal just to see if I can get used to it.
31:47 >> That's the thing. I think you have to immerse yourself probably.
31:50 It is about five years old.
31:51 I think it's fairly mature.
31:53 >> Yeah. Also, the less I write Bash scripts, the more I wish that Bash scripts were more like Python scripts.
32:02 >> Now they are.
32:03 - Now there.
32:05 - Yeah, this is great.
32:06 A good find and something I've also wanted to play with, but haven't.
32:10 - Nice.
32:11 - Brian, you got any extras you wanna share with people?
32:13 - I don't this week.
32:15 How about you?
32:16 - I thought I didn't, but then I did.
32:17 I just wanna do a quick follow up.
32:19 - Okay.
32:20 - I was just thinking about a couple episodes ago where we talked about the March Madness Package Tournament that Chris May had sent in.
32:29 And I was thinking, you know, it's probably done now, isn't it?
32:31 Let's see who won.
32:32 Cause I think we were at the point where we were at the elite eight, aren't we?
32:36 Or yeah, I believe we were at the elite eight.
32:39 So we had a showdown between NumPy and pip NumPy crushed it.
32:43 We had a showdown between pandas and requests and has crushed it.
32:47 And it was an all data science finale and NumPy and pandas went to head to head.
32:53 Went head to head and it was pandas 55% taking the winter.
32:56 So I just want to do a quick followup on that very important news.
32:59 We have a champion.
33:00 It's good, but try using pandas without NumPy.
33:02 That'd be tough.
33:03 There you go.
33:04 Yeah, indeed.
33:06 I was, Pat, do you have anything else you want to give a shout out to?
33:10 I do have one extra.
33:13 Quick click.
33:13 it's easy to bash Microsoft, but they've been involved in, they bought GitHub.
33:18 They, have lots of our Python core developers working for them and they have this rewards program and they want you to use Bing search, obviously.
33:28 But what you can do is choose a charity to give points to.
33:33 You can also get like a $5 gift certificate to AWS or Amazon or something for yourself if you'd rather.
33:41 And every day you just kind of click on these little links and I just got five points or 10 points.
33:47 And oh, now we got to do a quiz.
33:49 I'll come back to that later.
33:51 And as you do this, you accumulate more points each day and those points then can go to your charity.
33:56 And I did the Red Cross for a while.
33:59 And I did the, the CDC during our, our lockdown year there.
34:03 And you can also donate to the Python software foundation.
34:07 So that's, that's cool.
34:08 That's a way we can all contribute.
34:09 So if you're Googling stuff with Bing, go ahead and set up their awards.
34:14 You're Googling stuff with Bing, set up your rewards to go to the PSF.
34:20 You might as well.
34:21 That's right.
34:22 That's fantastic.
34:24 All right.
34:25 Hold on.
34:25 Well, thanks.
34:25 That's a good one.
34:26 I got a joke for you all here, and I know Brian, you do as well, but I feel like this one, I better take this one because I don't feel you're in a position to make an unbiased decision here because it's so close to your heart.
34:39 >> Okay.
34:40 >> All right. Okay. So this one is over on the Reddit Programming Humor one, and it poses the question, what seems like a straightforward question for a piece of software?
34:49 How do you exit them?
34:52 And it types, there's some, you know, a couple of interesting options here.
34:56 You get colon exit.
34:58 7% of the people think you type colon exit.
35:01 They're wrong.
35:01 You type colon wq, which I guess if you want to make changes, cool, save your changes and exit.
35:07 You can do, most people got that one.
35:09 And then you can do colon quit, 7% again.
35:12 You can click the close button.
35:14 Hard for a non UI app, but...
35:17 Or, almost 20% of the people said, you know what, the way you restart VIM, this horrible thing, I can't get out of it.
35:23 I'm gonna restart the computer.
35:27 I'm trapped in here, I just, I gotta get out.
35:29 I tried Command Z or Control Z and it just background it and now what's it doing, it keeps coming back and--
35:35 - I think people clicked restart the computer to be funny.
35:38 - I know they did.
35:39 I thought, and I pulled it up as a joke to be funny as well.
35:42 But there you go.
35:44 - So have you, I don't know, the close button works for me.
35:48 - Well, it closes the terminal, right?
35:51 - Yeah, yeah.
35:52 So, I mean, who doesn't?
35:55 - You gotta say, do you wanna terminate the running program, right?
35:58 It gives you like a warning that you're doing it wrong.
36:02 - I'm with you, Brian, I'm a boomer.
36:06 - It's not hard.
36:07 And actually, I don't use straight Vim except for on the command line.
36:11 You're right, I guess I do that on the command line, but I do, I essentially use Vim within PyCharm or VS Code as well.
36:17 But yeah, Vim emulation.
36:19 - Yeah, it's fun.
36:20 - So I wanted to share a joke also because I just thought this was so funny.
36:25 I could stop laughing this morning.
36:27 So ran across this tweet by mediocre superheroes.
36:31 It's a little cartoon thing.
36:34 So the guy, you know, finds a genie.
36:37 Genie says three wishes.
36:40 Hey, can I wish for more wishes?
36:41 Not with me, no.
36:43 Well, fine.
36:44 I wish you couldn't count.
36:48 - Jeannie, done, how many wishes do you have left?
36:51 A billion, hmm, that sounds right.
36:54 - I love it.
36:56 - Anyway, that was funny.
36:58 - It's an inventive way around an old joke.
37:00 - So. - That's great.
37:04 - Anyway.
37:05 - Oh quick, a bit of audience feedback as well.
37:07 Henry Schreiner says, "Restart the computer?
37:10 "Isn't that how you get out of emacs?" Also true.
37:14 - Yeah.
37:16 >> Yeah. What key chord do I hit to get out of that one?
37:20 >> It's probably control something.
37:22 >> Yeah. I bet it involves a control K something somehow.
37:26 Anyway, thanks for everything, Brian.
37:28 Thanks for being here. Thanks for the jokes.
37:30 Pat, it was great you could join us.
37:31 >> Yeah. Thanks, Brett.
37:32 >> Thanks for having me on, guys.
37:33 >> Bye, everybody.
37:34 >> You bet. Bye, everyone.