Transcript #279: Autocorrect and other Git Tricks
Return to episode page view on github00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
00:04 This is episode 279, recorded on lucky April 13th, 2022.
00:11 I'm Michael Kennedy.
00:12 And I'm Brian Okken.
00:13 And I'm Brian Skin.
00:15 Hello, Brians. Great to have you.
00:18 Hello, singular Michael.
00:19 Great Brians think alike.
00:21 That's right. That's the saying.
00:24 Brian Skin, welcome. It's great to have you here.
00:27 You are now completing the trifecta of podcasts, I understand.
00:31 Yes, indeed. I was on a panel for Talk Python and an episode of Test & Code a little while back.
00:37 And excited to be here for Python Bytes.
00:40 Yes. You've been a big contributor in terms of sending topics our way.
00:45 So it's only fitting that you're here.
00:47 Tell people real quick about yourself before we jump into the topics.
00:50 Sure. I'm a chemical engineer by training.
00:52 I am not actually a software dev by day.
00:54 I have a PhD in chemical engineering.
00:57 I've been working for the last 10 years or so at a company here in Dayton, Ohio, Faraday Technology, working on electrochemical process R&D.
01:05 So there's a lot of science there, some programming, mostly for data analysis, things like that.
01:11 But I also have done quite a bit of Python on the side in the documentation area and various things like that.
01:17 So excellent.
01:19 Cool. Chemical engineering is pretty awesome.
01:21 And it's great to have someone here who's not a straight software developer.
01:24 You know, we get a lot of myopic views and I think you'll have some interesting perspectives.
01:29 Hope so.
01:30 Yeah.
01:31 I hope so as well.
01:32 I'm sure.
01:32 Now, before we kick this off, I want to say this episode is brought to you by Datadog.
01:37 Check them out at pythonbytes.fm/Datadog.
01:39 We'll talk more about them later.
01:41 Right now, Brian, maybe we could talk about F-strings.
01:44 What do you think?
01:45 Yeah.
01:45 I mean, I love F-strings.
01:47 I use them all the time.
01:48 But I was like really thought it was cool.
01:51 There were a couple of new resources that I kind of wish I had had earlier.
01:54 This one, a couple, they're new.
01:57 So we've got from Florian Bruin.
02:00 And he's hugely helpful to getting, doing the code review or book review and code review and all that stuff on the pytest book.
02:10 So I definitely want to shout out to him for thank him for doing that.
02:14 Yeah.
02:15 But so he generated this Python F-strings.
02:18 It's called F-strings.help.
02:19 And it's just like it's a Jupyter Notebook looking thing.
02:25 I think he created it with Jupyter Notebook.
02:27 But it just quickly goes through all of the formatting stuff of F-strings.
02:32 And there's a little bit of explanation, but it just sort of exactly shows you what the syntax is and what the output is really concisely.
02:43 This is a nice, nice run through of the F-string features.
02:47 Yeah, that's cool.
02:47 Well, it looks like if you were trying to either learn Python strings or trying to help someone learn Python strings, you could just send them this and go, here, scan this.
02:56 You'll be good to go.
02:57 What I like about it is just the terseness as well.
03:00 So this is a decent reference to Bookmark for looking things up.
03:05 The other thing I wanted to point out was an article called Python F-strings are more powerful than you might think.
03:11 And that's exactly kind of the gist of it.
03:13 It's more discussion.
03:16 It doesn't, I mean, it does sort of tell you what they are, but it kind of assumes you already know.
03:21 But some really cool things like date and time formatting, using it for debugging with variable names.
03:30 We've talked about that on the show.
03:31 Taking advantage of string representations.
03:35 There's even embedded, I didn't know you could put F-strings inside of F-strings.
03:42 So there's part nested F-strings, they call it.
03:46 So interesting stuff here.
03:48 Yes.
03:48 Yes.
03:49 So, yes.
03:51 Nested F-strings.
03:52 I had no idea.
03:53 I didn't either.
03:53 I've totally done that before.
03:55 Really?
03:56 Totally.
03:56 Yeah.
03:57 Templating one thing to then template into another thing.
03:59 Absolutely.
04:00 It's super helpful.
04:01 Nice.
04:03 Very cool.
04:03 So, yeah.
04:04 Yeah.
04:04 It's easy to forget that you can apply the standard, I guess, string.format type of operators.
04:12 Like colon, 0.3F or colon, comma to put digit grouping, but in F-strings, right?
04:18 Because it's, I don't know, it feels more like you're working with a variable than you are with a format character.
04:23 I mean, short examples like this of, here's a cool thing you can do with, you know, even a well-established basic feature like that can really help people go, oh, hey, that's just what I need.
04:32 And run with it.
04:33 Yeah.
04:34 Very nice.
04:35 Oh, this is great, Brian.
04:36 I love it.
04:37 Now, are we ready to move on?
04:40 Yeah, definitely.
04:41 Cool.
04:42 All right.
04:42 I kind of want to blow your mind with this thing here.
04:45 You've probably heard about Bloomberg terminals.
04:49 So, if you're in the investment space, like if you work at a hedge fund or an investment company, especially in Manhattan, you know, you'll sit down and you'll see like these six monitor crazy setups that would make gamers jealous, you know, around them.
05:06 And look at what's going on here.
05:07 And one of the tools they use a lot is this thing called the Bloomberg terminal that lets them look at all kinds of different visualizations and real-time instant updating things around the stock market and whatnot.
05:20 That is a commercial project that, best I can tell.
05:24 I mean, there's probably discounts or whatever, but it costs around $2,000 per user per month, which is a non-trivial amount of cost, right?
05:36 I mean, no wonder we're all getting like little percentages of money sucked out of our 401k retirements because all of those people are like paying that much money to like manage our accounts.
05:46 Yes, exactly.
05:48 So, I want to introduce you all to OpenBB at OpenBB.co.
05:53 This is the equivalent thing, but several interesting aspects.
05:59 One, it's open source.
06:00 Two, it's free.
06:01 That's cheaper.
06:02 It's cheaper.
06:03 It's not necessarily the most important thing, but it also gives you access to all sorts of tools that we know and love from Python, especially on the data science side.
06:14 So, this OpenBB thing is this terminal type thing you can install.
06:19 It's really got this sort of weird blend of like CLI.
06:23 I know Will McGugan would be super impressed with all of its like terminal UI, its TUI aspects.
06:29 But then it also pops open interactive windows that are like graphs and all those kinds of things.
06:34 We'll pull up some examples in a minute.
06:37 So, you get access.
06:38 It's not just that it's free, but you get access to all the Python data science stack.
06:42 And it is itself created in Python.
06:45 So, pretty cool.
06:47 It's pretty popular.
06:49 It's got 11,000 GitHub stars.
06:51 And what you do is you show up at this terminal.
06:53 And there's even an interactive live version.
06:56 You can have dark mode or not dark mode turned on on the website.
06:59 I mean, I love it.
07:00 This is really a polished thing.
07:02 And you can type things like stocks.
07:04 If you could spell stocks, you could type stocks.
07:07 And it'll come up with all these ways that you could explore them.
07:10 If you could type BA and it'll come and give you these things.
07:13 And eventually, if you get to the right spot, it doesn't happen on the website.
07:16 But it'll pop up these extra windows that then like let you explore things with graphs and so on.
07:22 So, very, very cool.
07:25 Let's pull up some of the terminal things here.
07:29 And look at the features.
07:31 Where are the features?
07:33 So, you can install it through its own installer.
07:36 You can install it through Anaconda.
07:39 Or you can run a Docker image of it to get it to run.
07:42 So, it's sort of summary is Python-based integrated environment for investing research that leverages state-of-the-art data science tools and machine learning technologies.
07:51 And navigate through over 500 different views and functionality.
07:57 So, here's some of the pictures that we can look at.
07:59 If you go to the product terminal and just scroll down.
08:02 You can have these really cool graphs of like significant events happening along here and extra information.
08:10 You can look at basically an Excel view.
08:14 You can look at 3D volatility sections.
08:18 You can look at sentiment analysis here.
08:21 The Bitcoin rainbow chart.
08:24 I don't know how to read rainbow charts.
08:27 But isn't this an amazing view for something that runs in the terminal?
08:31 Yeah, this is great.
08:33 That's astonishing.
08:34 Yeah, it really is pretty astonishing.
08:37 And like the things just keep coming.
08:39 So, if you just keep scrolling through this, there's such a way to like to understand how is the economy doing.
08:44 Apply AI predictions to like GDP and all sorts of wild stuff.
08:50 So, it's this really crazy blend of terminal 2E plus pop open a bunch of data science explorations.
08:57 And then being Python, I'm sure you can explore it yourself.
09:01 I looked at the requirements file.
09:03 It's like maxed on requirements in there.
09:06 Let me tell you.
09:07 But I think it's based on Tornado as far as I can tell.
09:12 So, and...
09:14 Yeah.
09:14 Go ahead.
09:15 Will points out it also uses rich.
09:17 Yeah, well, it uses rich.
09:20 Very cool.
09:21 Thank you.
09:21 And tested with pytest.
09:22 Oh, my goodness.
09:24 Yeah.
09:24 So, that's awesome.
09:25 Anyway, I am super impressed with this.
09:27 It's an open source project based on Python sort of democratizing a lot of these things.
09:33 And if that wasn't enough, I think here's one more sort of side story that I think is interesting.
09:39 So, I'm sure you two have seen, you go, it's not as common as it used to be, but you go to some open source project or some application and says, buy us a coffee.
09:48 Help make that next feature happen.
09:51 This one has a different banner at the top instead of coffee.
09:54 It says, we've just landed our $8.5 million seed funding round and we're about ready to get started.
09:59 I mean, that's some kind of crushing it for open source, isn't it?
10:03 Yeah, definitely.
10:04 That's a lot of coffee.
10:05 That is a...
10:07 They're going to be so jittery.
10:11 Just like the stock prices.
10:12 Exactly.
10:13 Look, so much fluctuation.
10:15 Oh, no, no.
10:16 That's just me.
10:16 It's actually very still.
10:17 Maybe that's why stocks go up and down so rapidly.
10:20 Too many traders and too much coffee.
10:23 Yeah.
10:23 That's probably actually true.
10:25 Anyway, I think this is a really cool Python application.
10:28 It looks well done.
10:30 It looks pretty modern.
10:31 And yeah, it just looks like a neat way to apply some data science to investing.
10:35 Do you have a sense of the learning curve?
10:36 Is it mainly directed at investment professionals or is there an on-ramp for casual use?
10:43 If you look at their description, it does seem to be focused on a casual use case here.
10:52 Let me see.
10:54 It says, a terminal built by the community, Shape Artes.
10:57 Where did I see this?
10:59 Somewhere.
10:59 I can't remember where I ran across it.
11:01 But they do talk about sort of like individual investors getting access to the tools that the companies, the people at the big banks and hedge funds would have.
11:12 So it does sort of seem to be aimed at that.
11:15 And my experience is it's pretty easy to use.
11:17 I don't know.
11:17 It's easy to understand the output, right?
11:19 That's more of a investing economics problem, though.
11:23 That's a perpetual problem.
11:24 Yeah.
11:24 Yeah.
11:25 Yeah, indeed.
11:26 All right.
11:27 Well, people can check this out if it sounds interesting to them.
11:29 Brian Skin, what you got for us?
11:32 So my first item is PyProject.com and PEP621 for project metadata and PyProject.com coming to set up tools.
11:42 So, you know, people in Python land are going to be pretty well familiar with PyProject.com at this point.
11:50 You know, originally was the PEP517 and PEP518, you know, that created it and, you know, started the basics there.
11:58 And then you had Black doing project configuration in there.
12:01 And it's kind of been slowly snowballing over the past few years.
12:04 And one of the big pushes of PEP621, you know, who's who of Python packaging authors here, was trying to standardize project metadata and also standardize it in a way that the metadata could be specified statically.
12:22 Because that, you know, for things to get uploaded to PyPI, if you want to have information about dependencies or, you know, various other things like that.
12:29 If you have the metadata specified statically, it's much easier to get to.
12:33 It's you can trust it more.
12:36 And so, the PEP, you know, it's how it's defining how to put project metadata in PyProject.com how to tell the build tools like build or flit.
12:46 What is a static defined in declaratively in the metadata and what's dynamic that is going to be provided dynamically later on.
12:55 And a number of tools had implemented PyProject.com support.
12:59 Things like flit, hatch, PDM.
13:02 Not poetry yet, though they're discussing it.
13:05 But setup tools was still missing it.
13:08 It's been an issue on the setup tools GitHub tracker for a while.
13:12 And with a lot of discussion there about what it would take to bring it in.
13:15 One of the big appeals of moving to this for setup tools specifically, you know, there'd been the move from to try to bring static metadata
13:25 in the setup.cfg.
13:26 But there's some, you know, in that discussion, there's some, you know, problems with the INI format because it's not structured.
13:34 It doesn't have good, like, complex data type support.
13:38 Right.
13:38 Nesting and embedded things don't work.
13:40 Yeah.
13:40 You know, like, there's no, INI has no sense of an array.
13:44 So, if you had a setup.cfg with an array in it, setup tools actually had to take that as a string representation of an array and then arrayify it.
13:54 By executing it basically.
13:56 Instead of the, the Tumble where it actually knows it as a, a, an array in a table.
14:01 But in any event, Anderson Bravo Harry has just within the last month or so, I think it was, finished an experimental implementation of pep621.
14:15 In setup tools.
14:15 There was a discuss thread seeking feedback from the community.
14:20 Try it out.
14:21 Yeah.
14:21 Report bugs.
14:22 I tried it on one of my projects and it mostly worked.
14:25 I actually turned up a bug that Anderson fixed super quickly where I, I do dynamic long description, which turns into the readme for, you know, for the PyPI page.
14:35 Right.
14:35 Do you mean you read it out of like a text file or something?
14:38 Well, so what I have is I've got documentation links on, in my readme that point into like the main branch.
14:43 But when I do a build to PyPI to do a release, I want it to point to an archival version of the docs on read the docs.
14:50 And so I dynamically do a replace on the docs branch for those links.
14:56 Well, aren't you a special butterfly?
14:59 I have complicated needs.
15:03 It's, I'm sorry.
15:04 But, you know, so I, you know, I have that set up and it broke and I reported it and he fixed it.
15:10 So, as far as I can tell, you know, it's, it may, it may be experimental and it probably will change, especially some of the issues around specifying dynamic, metadata.
15:20 but it's, it's, it's at least working reasonably.
15:24 and, so check it, check it out.
15:28 And if you're using setup tools, take a look at, switching over to that.
15:32 he, he made a tool that'll, that can convert, setup.cfg, to pyproject.toml.
15:39 the project is, ini2toml.
15:42 and there's some others.
15:44 You can check the show notes.
15:45 I've got a number of things, listed there.
15:47 Yeah, very cool.
15:48 I suspect that ini2toml might be more generally useful, actually.
15:51 I think that's why he titled it that way.
15:54 instead of, you know, setup.cfg to toml or whatever.
15:57 Right.
15:58 So.
15:59 Cool.
16:00 Yeah, this is great.
16:01 More progress on the pyproject.toml stuff.
16:04 Definitely.
16:05 Very cool.
16:05 Now, before we move on, let me tell you all about our sponsor this week.
16:10 Datadog.
16:11 They've been supporting the show for a really, really long time.
16:13 Datadog is great.
16:14 They have a real-time monitoring platform that unifies metrics, traces, and logs into one
16:20 integrated system.
16:22 Their APM empowers developers and teams to identify anomalies and resolve issues and improve
16:29 application performance.
16:30 So you can begin collecting stack traces and visualizing them as flame graphs and organizing
16:35 them into profile types, such as CPU or IO types of reports.
16:40 Teams can search for specific profiles and correlate them into distributed traces and identify slow
16:46 or underperforming code for later analysis and optimization.
16:49 And with Datadog's APM live search, you can perform searches across the full stream of ingest
16:56 traces of your app over the last 15 minutes.
16:58 Like, I need to figure out what the database is doing and the API and the front end and all
17:03 those things.
17:04 So try them for free with a 14-day free trial and Datadog will send you a free t-shirt.
17:10 So just check them out and support the show by visiting pythonbytes.fm/Datadog or just
17:15 click the link in your podcast player show notes to get started.
17:18 Nice.
17:18 Indeed.
17:19 All right.
17:20 Ryan, what do you got next?
17:23 I've got Git.
17:23 So this isn't necessarily Python only related, but I use Git a lot and I didn't know you could
17:31 do autocorrect with Git.
17:33 So this is Wayland Walker.
17:35 I think he's been submitted other things to us on the show.
17:39 But he wrote this article called configure Git to autocorrect your fat fingers, you know,
17:46 or just your sloppy typing.
17:48 So there's this, like, let's say you do Git checkout dev, but you spell checkout C-H-E-K-O-U-T
17:57 and misspell it.
17:58 Well, Git will, like, tell you that you did it wrong and it guesses what you meant and
18:05 tells you.
18:06 This is a similar command as this.
18:08 But there's a configuration option that I didn't know about called help.autocorrect that you
18:14 can set a timeout and it just automatically runs the command it thinks you wanted.
18:20 I'm playing with it.
18:22 And so far, it hasn't got anything wrong.
18:24 So you can, I've set it to one second also, but you can set it to things like 10 seconds
18:29 or I don't know why you'd want.
18:31 Did you mean for, did you mean RM-RF?
18:33 Applying.
18:35 Just Git commands.
18:37 It's not everything.
18:38 Formatting hard drive.
18:40 Git reset-dash-hard.
18:42 Oh, yeah.
18:45 That one actually would be kind of destructive.
18:47 That would be bad.
18:48 But I, so I realized that I added this to my workflow, but I realized that I hadn't really
18:54 talked about my workflow at all on my blog.
18:56 So I, I went ahead and just showed the things that I do normally for a quick change.
19:01 I usually check out main, do a poll, then create a branch with checkout-b.
19:08 And then I commit, I usually do commit-a-m with a message.
19:14 I want to talk about these, that one a little bit, the dash-a, and then also push because
19:20 I want that to be faster.
19:24 So the dash-a, what that does is, that's that push.
19:29 Anyway, I got, got these backwards.
19:31 Anyway, the dash-a will just say, instead of having to, to stage a file or, or add them.
19:38 So normally you have to add your changes and then you commit them.
19:41 But I, I just want to, usually just want to commit everything that I've changed or delete
19:47 it also.
19:48 If I delete something, I want that to change.
19:50 So the dash-a does that.
19:51 I just learned about that recently.
19:53 Oh, interesting.
19:54 So you can basically skip the git add dot.
19:56 Yeah.
19:57 Or something equivalent to that, or the git add file names.
19:59 Right.
19:59 And the add dot is a little dangerous because it'll add everything, the unstaged stuff too.
20:04 So if you have temporary files or, or just play, you know, you get a test file or a goofy
20:09 file that you're just playing out with.
20:10 I don't want to add that stuff.
20:12 I, I intentionally add things that I want, or I mean, add, what's the other one?
20:18 You know, uncommitted things.
20:21 I don't usually want to add that.
20:22 So the dash-a is nice that it doesn't do that.
20:26 And then the last thing that I did was the, the global, there's another configuration change
20:31 of global push dot default current.
20:36 So weird.
20:38 But what this does is that the current, there's a bunch of values for that.
20:42 I'm going to have a link to the other show notes and the other, the documentation about
20:47 all the different values in the show notes.
20:50 But the, I like current because what that says is the branch that I'm using branch name I'm
20:54 using now, just make that the one on online.
20:57 So if you do, or upstream, if you don't do that, it says, oh, there's no upstream named
21:02 this branch and you, you have to do this.
21:05 I'm like, okay.
21:06 And you can do it with push.
21:08 You can do a dash you in push to make it automatically do that, but it's just for both.
21:12 And I always wanted to do that.
21:14 So anyway, that's, that's my new get workflow for simple stuff.
21:18 I love it.
21:19 Very nice.
21:20 Yeah.
21:20 I really liked that, that, that current having to do that, all that extra typing, even with
21:25 autocomplete is just annoying.
21:26 Yeah.
21:27 So, yeah.
21:28 Brian S.
21:30 It sounds like you use get a lot.
21:32 What's your view of source control from a chemical engineer perspective?
21:36 Like in that ecosystem and that, that environment, how do people view this kind of stuff?
21:41 they don't basically, I mean, you know, it, it, anyone who's, who's familiar with
21:49 with the, you know, much development probably uses it.
21:52 Some, actually there's a 3d physics modeling, multi-physics modeling tool, console that just
21:57 added a, source control like feature into it.
22:01 So it's, it's starting, you know, the, the, the data reproducibility and the, the, the history
22:05 tracking has started to become more of a thing.
22:07 but yeah, it's, it's very often the, you know, V2, V3, 2020.
22:13 2020.
22:14 V3, V3.
22:15 V3.
22:16 Final.
22:17 Final.
22:17 Final.
22:18 Yeah.
22:18 Yeah.
22:18 So, I mean, you know, I, I have, you know, I, I, I, I have blog posts churning about strategies
22:24 for, version control on, data analysis code.
22:30 because of the reproducibility and needing to, to, to track environments precisely for
22:35 reproducibility at a point in the past.
22:37 And, you know, tagging, tagging commits for, you know, just like, oh, I, this, you know,
22:42 basically every time I run the code, I need to know what the state of it was.
22:46 And, and the, the tooling is not that great for doing, doing that.
22:50 At least I haven't found much.
22:51 So, it's still evolving, I think.
22:54 Indeed.
22:55 Okay, cool.
22:56 Alvaro points out at work, they have a project with 6,000 lines of, in an INI final that INI
23:03 might be just what they need.
23:04 That sounds like, that sounds like a lot.
23:07 You definitely have to, you know, you have to, you have to proof them afterwards because,
23:11 you know, there, there may be some stuff that doesn't, translate cleanly, but yeah.
23:15 Yeah.
23:16 We need a Toml to INI and if you can round trip it and it's the same, then you're good to go.
23:19 Yeah.
23:22 Don't know if that'll work.
23:24 Keep your sanity.
23:26 All right.
23:27 This next one's a quick one for me, but it'll be useful for people who are working with
23:31 JSON web tokens.
23:33 So JSON web tokens are a thing that you can exchange with maybe a distributed login system.
23:41 So instead of using like an API key that you just pass around all the time, you could say,
23:45 I'm going to either share a certificate or somehow log into some other system and I'll
23:50 get back this token that I can share on to other places to communicate who I am, communicate
23:55 what roles or permissions I should be granted and so on.
23:59 So if you work in that world, you work in a world of dealing with cryptographic signatures
24:05 and picky algorithms and stuff like that.
24:08 So I just wanted to give a shout out to JWT.io.
24:11 So this is a place that allows you to decode, verify and debug JWTs.
24:17 It's pretty cool.
24:18 So you come down here and what you do is you put in some encoded token and you say, which
24:24 algorithm of the encryption algorithms are using.
24:27 And then what pops out is the separated JSON result that says, here's the header.
24:33 It says what algorithm and what type it is, what version of JWT and so on.
24:37 And then what the actual data was like, this person is a subscriber.
24:42 Their name is John Doe.
24:43 I shouldn't scroll it because it doesn't seem to work.
24:45 And then here's like the signature and whether or not the signature was verified and stuff
24:50 like that.
24:51 So I think that's pretty cool.
24:53 You can hit share JWT and it'll just copy that.
24:57 You can sit in along.
24:58 But anyway, I think if you're working with stuff, this might be pretty handy.
25:02 And while you're at it, there's somewhere in here, the libraries, you can say, see the JWT
25:08 libraries.
25:08 And let me make that smaller ish.
25:12 So the way it shows, it's a little bit weird.
25:14 It has the technology and then a whole bunch of checklists.
25:18 And then if you go down to the bottom, you can see the actual package name.
25:20 So like there's a bunch of .NET ones here.
25:23 Don't care about those.
25:24 But the Python ones are down here and says, who's created them, right?
25:29 Like CMO source or Michael Davis.
25:32 And then this one's called Python Jose JW crypto or PI JW.
25:38 And it shows you which algorithms are supported and how it works and so on.
25:42 So I think this is pretty cool if you're going to work with these things.
25:45 What do you think?
25:46 I don't have a lot of expertise with authentication and tokens of this sort.
25:51 How is this different from something like macaroons where it's more like an advanced cookie?
25:56 Is this separate from the browser or?
25:59 This is done in several ways, I think.
26:03 So you can go like to a federated identity provider.
26:07 So something like Auth0 or Microsoft Azure Active Directory or something like that.
26:14 Or you can have your own identity provider from like identity servers, like one of these implementations.
26:20 And basically it allows you to do single sign-on and federated sign-on across different platforms without just taking and using straight cookies.
26:29 Okay.
26:29 So it works both for APIs and for other types of apps.
26:33 You can do it within an app or with an API.
26:35 So like if I call an API, if I log in with me and I call an API and I want to communicate onto my identity onto the APIs that API is calling.
26:46 You know, it's like those kinds of sort of more complicated scenarios.
26:50 Gotcha.
26:51 Yeah.
26:51 Yeah.
26:53 Anyway, JWT.io.
26:55 Check it out.
26:56 What do you got, Brian's again?
26:57 Okay.
26:59 For my second item, I'm going to appreciate the opportunity, Michael and Brian Okken, to do a little bit of self-promotion.
27:07 I have a new project I'm calling Jupyter Temphars.
27:13 So one of the really powerful things about, you know, Jupyter notebooks are great.
27:17 You can do a whole lot with them.
27:19 They're obviously being used everywhere, data science, scientific analysis.
27:22 And one of the features of at least the Python kernel of Jupyter is that you have a global namespace that you work in.
27:29 And this really adds to the power of it in some ways because everything you do in the notebook flows from one cell to another.
27:35 You don't have to worry about shuttling things back and forth.
27:38 But, you know, as has come up, you know, countless times here and elsewhere, you have namespace contamination problems where you accidentally assign something in one cell and then you foot on yourself because either, you know, you use something and have it.
27:52 Have a typo and accidentally use something from another cell or something's lingering on and you have the same variable name in multiple cells.
27:59 And all of a sudden, you know, you close down for the day and start back up and the whole worksheet blows up.
28:08 And so what I put together is a notebook extension for Jupyter.
28:12 It's based upon another library of mine, tempvars, which I need to freshen a bit.
28:17 But this is a front-end extension for Jupyter.
28:22 And so what the underlying library does is you import from tempvars, you import the capital tempvars context manager.
28:30 Then I'll just define a variable here.
28:33 And then in this cell, I've got as a context manager tempvars, and I declare to it, all right, anything, this syntax says anything that starts with T underscore is going to be treated as a temporary variable.
28:45 And so when I run this, the first line is checks to see if T underscore A is in the namespace, and it's not because it's inside the temporary variables context.
28:56 Then I assign it, and indeed, it assigns.
28:59 And then when I pop out the back end, the previous value, 5, is now restored to it.
29:04 So what this does is it makes sure that you don't have contamination coming into the cell, and anything you do in here is reverted to the prior state out the back end.
29:14 So that's using the underlying library.
29:17 But what I did, it's like, you know, okay, fine, it works, but you have to have this whole thing that you type out, and it's cumbersome.
29:22 So what the Jupyter plugin, the Jupyter extension does is it lets you, you can turn on this toolbar for tags for each cell, and then if you define, go away.
29:34 Then if you define a tag with this syntax, you can also do a tempvars end, but here tempvars start T underscore.
29:40 Now, this variable will automatically be treated as a temporary variable.
29:44 It's no longer in the namespace when you execute the cell.
29:48 And what it's doing behind the scenes is it's actually taking the code, patching the execute functionality for the cell, and wrapping it in a tempvars context manager behind the scenes, so that anything you use in here, T underscore, is a temporary variable.
30:02 You don't have to worry about it getting contamination from the rest of the namespace.
30:07 And then just like the other, it's still there, yeah.
30:10 Yeah.
30:10 So it's brand new.
30:13 0.1 is out on PyPI.
30:15 The readme is, in order to satisfy the audience here, I have animated gifs.
30:22 Are those screenshots on a UI tool?
30:25 I love it.
30:25 Yeah.
30:26 Animated to boot.
30:29 So readme has the user's instructions.
30:32 It's on PyPI, just a pip install, Jupyter tempvars, and then I have a shortcut script to actually install the extension into your Jupyter environment.
30:40 I have a number of features that could be added to it, different things that the underlying library could have added to it.
30:47 But I'd really love it if anybody who is intrigued would try it out, find and report bugs, suggest features that you want.
30:53 Because, you know, it's a small thing, but it can be a big problem.
30:57 And if this could be at least a partial or substantial solution for people, that would be awesome.
31:02 Yeah.
31:03 Yeah, nice work.
31:04 This looks great.
31:05 Those are good.
31:06 Yeah, the problem of having variables shared across those things when you didn't intend them to be, so tricky in so many ways.
31:15 I mean, Jupyter cells are like go-to statements with no traceability, right?
31:21 Because you could run them down, then you could go back and run the one in the middle again, and then you could go run another.
31:26 Except for just a little in and out numbering, you have no idea the order they ran in.
31:32 Yeah.
31:32 Notebook hygiene is really tricky.
31:34 And yeah.
31:35 Brian, I feel like I cut you off.
31:38 We can say something.
31:38 Oh, just he commented that to satisfy us, he's got, or the entire Python community has got animated GIFs.
31:45 But to be fair, it's not just technical books and read me's.
31:50 I don't use cookbooks that don't have pictures either.
31:52 Yeah, that sounds good.
31:56 I do read novels that don't have pictures, so it's not everything.
32:00 I really hate the graphical novels that don't have pictures.
32:07 Those are the worst.
32:08 They're the worst.
32:09 All right.
32:10 Real-time follow-up.
32:11 Brandon Brainer, former co-host here, says, this is talking about going back to why JWT over something like cookies.
32:19 So imagine having something like auto zero when you log, maybe auth zero.
32:24 When you log in, it gives you back this JWT, which has a timeout.
32:28 The front end has this.
32:30 It can send it to your API.
32:31 And then also it has the signature that verifies it wasn't tampered with.
32:35 And you can verify the sender because you can decrypt it and stuff like that.
32:40 Okay.
32:41 Better chain of custody.
32:42 Okay.
32:43 All that tricky cryptography stuff.
32:45 Speaking of other things, extra things, you guys got some extras we should cover?
32:52 I have a few, actually, some quick ones.
32:54 All right.
32:55 Bring it on.
32:56 So we've got GitHub issues are finally live.
33:00 So their Python issues are now on GitHub.
33:04 We didn't jinx it this time.
33:06 It really is there.
33:07 So enough said.
33:09 I was, you know, I've used lorem ipsum before.
33:13 I think everybody doing front end stuff has.
33:15 But I didn't know.
33:16 There's a cool page like lorem ipsum.com that has a translation.
33:21 So you can read what it means.
33:24 At least a 1500s, 1914 translation.
33:29 So it's sort of an interesting read.
33:33 I won't get into it here, but it's worth a read if you're curious.
33:36 And then one of the things we do sometimes at the end is funny stuff.
33:41 And one of the things we've covered is various O'Reilly covers.
33:46 So I found this Dev2 O'Reilly cover generator.
33:51 I didn't know where it was.
33:52 Somebody had.
33:53 Oh, nice.
33:54 And you can just make up your own.
33:55 So I made one up.
33:57 Passed it around last night.
33:59 So it's kind of a fun thing.
34:01 Yeah.
34:02 I pulled that from the show notes and passed it on to my friends.
34:05 And they have run with it.
34:06 They're delighted.
34:07 Awesome.
34:08 100% test coverage.
34:09 You need to test with no asserts.
34:11 At least CI is happy.
34:13 So anyway.
34:14 This is awesome.
34:15 How about you?
34:16 Got any extras?
34:17 I have a few.
34:19 Now, your mention made me add a third one.
34:23 Or another one, rather.
34:24 Let's go here.
34:27 So hipster ipsum.
34:29 If you just need a little more pizzazz in that lorem ipsum, and you don't want people asking
34:36 questions, this is a hipster ipsum at hipsum.co.
34:41 This is a generator.
34:42 You can give it your flavor.
34:43 So you can go over here and say, like, how many paragraphs?
34:48 We only need two paragraphs.
34:49 And hipster neat, or you can do it with a shot of Latin.
34:52 Nice.
34:53 And it starts out with, I'm baby.
34:56 Gentrified.
34:57 Tumblr.
34:57 Butcher.
34:58 Cronut.
34:59 Succulents.
34:59 Poor locos.
35:01 Subway.
35:01 Tile.
35:01 Food truck.
35:02 Letterpress.
35:03 Tote bag.
35:03 Toe fu.
35:04 Anyway.
35:05 Doesn't flow quite the same as the Latin, but it works.
35:08 Yeah, exactly.
35:09 You got the fashion accent and all that.
35:11 So anyway, that one's kind of fun.
35:12 More seriously, quick shout out.
35:14 Worked with Christos Meskus from the Microsoft Identity team, speaking of JWTs.
35:21 And he and I just put together a course, Secure APIs with FastAPI in the Microsoft Identity
35:26 Platform.
35:26 So people can check that out if they want to do JWT and other types of federated identity
35:32 with FastAPI.
35:33 That's a fun course we just launched yesterday.
35:36 Nice.
35:36 Excellent.
35:37 Cool.
35:37 Yeah.
35:38 Thanks.
35:39 And then a quick shout out.
35:40 Seth sent over this thing called Python Virtual ENV for Windows Sorta-ish.
35:45 And it's this idea to bring some of the Py ENV virtual environment features to Windows.
35:54 I haven't really played with this, but I guess some of the features there for the virtual environments
35:59 don't work on Windows, but his sort of plug-in script does.
36:04 So you can check that out, which I think will be helpful for some people, for the Windows
36:09 people.
36:10 And, you know, that's it for my items.
36:12 Brian Skin, do you got anything you want to share as well?
36:13 Yep.
36:14 I've got a few quick ones.
36:15 First of all, as many probably know, Eva stepped down, Jalaska stepped down as the executive
36:24 director of the PSF.
36:25 I believe it was at the end of last year.
36:28 PSF has found their new executive director, Deb Nicholson.
36:30 So congratulations to all there.
36:34 Yeah.
36:36 Congratulations.
36:37 Yeah.
36:38 So, and more generally, the PSF has been hiring lately.
36:42 Last year, there was the packaging project manager, Shamika Mohanan.
36:46 And the developer in residence.
36:48 Absolutely.
36:49 They also, there was a posting for an infrastructure engineer to assist with the facilities that
36:55 the link now 404s.
36:57 So maybe they've made their hire.
36:58 I don't know.
36:59 But the posting was there and now it's not.
37:01 And then actually in the steering council notes released for March, there is beginnings of
37:07 discussion about hiring a second developer in residence, which would be terrific.
37:12 So.
37:13 Yeah.
37:14 It seems like it's been a big success.
37:16 So getting someone to help Lukash out would be really great.
37:18 Definitely.
37:19 Two more quick things.
37:21 One, PyOhio, the regional Ohio conference, the call for proposals is open.
37:26 It's going to be a fully virtual conference again this year.
37:28 So anybody who is interested, submit, submit, submit.
37:32 Nice.
37:34 And then, and then one interesting tidbit relevant to, you know, we have to talk about
37:39 Pydantic at least once, I think.
37:40 Right.
37:41 Along with Anthony Shaw and Wilma Guggen.
37:45 This was a couple of days ago.
37:46 Samuel Colvin of Pydantic fame posted this somewhat cryptic tweet here showing over a tenfold increase in speed or some sort of Pydantic features here.
37:59 So I don't believe the, you know, this is actually dropped yet.
38:03 This is all I know, but this looks pretty exciting.
38:07 The magic, magical Pydantic core is coming.
38:10 Yes.
38:11 Cool.
38:12 I have no idea what it is, but very exciting.
38:13 But I want one.
38:15 Ten times faster.
38:18 Maybe it's the Pydantic pony.
38:20 The Pydantic unicorn.
38:22 No, that's great.
38:23 All right.
38:25 I got no more extras, but I have some jokes.
38:29 Yay.
38:30 Bring them.
38:30 All right.
38:31 I think this first one might be from you, Brian Skin.
38:33 Is that right?
38:34 Yeah.
38:35 I can't.
38:35 You want to tell us this joke here?
38:37 Give us this one.
38:38 Yeah.
38:38 So it's a riff off of the various elements of a business enterprise trying to bring a product to a customer that's what they actually want.
38:46 You know, with the tree and the swing and the armchair swing and the swing with no ropes and that.
38:52 This one is more cat directed.
38:54 And the left panel says product features.
38:57 And it shows this really nice multi-level cat tower with beds and scratching posts and, you know, very attractive.
39:04 And on the right, it says user needs.
39:06 And it has a cat peeking up out of a cardboard box.
39:09 Exactly.
39:10 Slightly over designed, would you say?
39:13 Just a bit.
39:15 And, you know, I think there was somebody responded to that.
39:17 There's a tweet lower down saying, this is exactly my life.
39:20 I have an untouched, you know, cat tree in the corner and all the cat sits in is the box.
39:25 So.
39:26 This is also true for children.
39:27 A lot of times the box is the best part.
39:29 Definitely.
39:30 All right.
39:31 I brought two more for us just because they're both, they're all short and I thought this would be fun.
39:35 So here's one that says junior developer.
39:39 How did you find the bug so fast?
39:42 And it has a senior developer who has this sort of lion meme.
39:45 I was there when it was written.
39:47 Lion witch and the wardrobe reference there, I think.
39:51 I think so.
39:53 All right.
39:53 And then this one really, I really appreciate this one.
39:56 So there's two sort of time-lapsed Google search pages with text overlaid on it.
40:03 And it says 831 C++ hello world.
40:05 833 alternatives to C++.
40:12 And of course, it's complete with a top.
40:14 STD colon colon C out.
40:16 Less than, less than hello world.
40:18 Less than, less than standard out.
40:19 Colon colon end out.
40:20 You know, the formal C++ style of like S pre-dum or pre-dum, whatever.
40:26 Yeah.
40:27 Hello, C++ hello world.
40:29 Alternatives to C++.
40:31 All right.
40:32 I just leave it with that, you guys.
40:33 I had one semester of C++ in college and I don't miss the compiler errors at all.
40:39 No.
40:39 Yeah.
40:40 C++ is some, some wild stuff.
40:42 I used to work in it somewhat.
40:43 I did a couple of years of professional C++ and it was okay, but a lot, a lot of craziness.
40:49 Yeah.
40:50 You don't have to use the crazy parts though.
40:52 So with this, at least in the embedded world, we use, it's, it's C++, but we just selectively
40:59 use the cool features.
41:00 Mostly it looks like C.
41:02 Yeah.
41:03 I think C++ is getting a big update as well, isn't it?
41:07 I think there's.
41:08 There's regular updates.
41:09 There's so many new things coming on.
41:11 It, it was fairly stagnant for like, like decades.
41:15 And then, but in the last 10 years, there's been a lot of new changes.
41:19 I feel like I've, I've read people griping that they're making C++ too much like Python
41:24 or something.
41:24 Adding, I don't know exactly what that means, but, but.
41:28 We propose taking away the semicolons.
41:31 What?
41:34 Too much.
41:34 Too much.
41:35 I could definitely get rid of the curly brackets.
41:37 So.
41:38 Yeah.
41:39 Yeah.
41:39 Yeah.
41:39 There's a lot of parentheses when you don't really need them.
41:41 So.
41:41 Yeah.
41:42 All right.
41:43 Well, Brian Okken, thank you as always.
41:45 And Brian Skin, thanks for being here.
41:47 Thank you.
41:47 Thanks.
41:48 Thanks for having me.
41:49 You bet.
41:50 Bye everyone.
41:51 Bye.