Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #218: Keyboards for developers, Python, and some history

Return to episode page view on github
Recorded on Wednesday, Jan 27, 2021.

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:05 This is episode 218, recorded January 27th, 2021. I'm Michael Kennedy.

00:11 And I'm Brian Ockin.

00:12 And Brian, we have a special guest, Jeremy Tanner. Welcome, man.

00:15 Thank you. Thank you for having me.

00:16 Yeah, it's really great to have you here. You know, we've got to talk a little bit at conferences and stuff.

00:21 And now that we just don't seem to have conferences in the world anymore, we're going to have to drag you into our world to actually get to catch up.

00:28 It's good. I need a tiny bit of that Portland fix. I love being up there.

00:32 But I mean, the entire Pacific Northwest, but Portland in particular.

00:35 And so, yeah.

00:36 So where are you at?

00:37 I am in Austin, Texas.

00:38 He's in the Portland of the South.

00:40 I thought that was. Oh, yeah.

00:42 Nice. All right. Well, maybe real quick.

00:45 Tell us about yourself, Jeremy. People who don't know you.

00:49 Absolutely. I like motorcycles. I like suede shoes. I like smoked meat like Python.

00:56 I'm currently working in developer advocacy at Equinix Metal and living in Austin, Texas, raising two awesome tiny copies of myself and trying to sort of ride it out while the world is melting.

01:11 I assume like everyone else is.

01:12 Yeah. Yeah. You know, we share a lot of interests like you and I both do motorcycle riding and just a sidebar, like the ability to just jump out on a bike, get away, cruise through the mountains and just pull back into the garage and have, you know, somewhere outside of your four walls, a really cool experience.

01:27 Like that's a neat thing to do when you're otherwise just stuck at home.

01:31 It's we have there's so many like technology guardrails, right?

01:34 Like turning your phone screen to grayscale so it'll be less enticing, turning off your notifications, whatever else.

01:40 But the really nice thing about riding a motorcycle is the guardrails aren't there and you absolutely have to be paying full attention.

01:50 So it's not all I'm also thinking about something else.

01:52 You're like, well, do you not want to die?

01:54 Then like watch the watch the road, be aware of everything.

01:57 And so it forces everything to the background for however long you can manage it.

02:01 Yeah, that's such an interesting idea of like, I'm just going to put the world out because I really have to focus on this situation, on this curvy road or whatever.

02:08 Fantastic.

02:09 All right. Well, Brian, I believe you have the first item.

02:12 Something is this about laundry or what is up here?

02:16 Constant folding, of course.

02:17 Yeah. Laundry.

02:18 Well, I do like the little the little animated sloth holding something.

02:22 It's nice.

02:23 No, I brought this up because so it's an interesting article about constant folding.

02:29 So constant folding is when a language replaces your constant expressions at compile time rather than computing them at runtime.

02:38 So say something like, you know, 24 times 60 or whatever.

02:41 It'll just replace that.

02:44 Wait, wait, wait. Let me, did you just say compiling?

02:46 Yeah.

02:47 Like when I, when I compile, like, what is that?

02:49 GCP, PY, GPY.

02:51 Like, how do I know?

02:52 I mean, this is a misconception.

02:53 I think a lot of people have is like languages like Python don't actually get compiled.

02:57 They do.

02:58 Well, there's the bytecode compiler, right?

03:00 Yeah.

03:01 And I, and that happens, I mean, for a lot of, I guess, if you just have a script that's just one file, that'll happen every time you run it.

03:08 So that doesn't really, there's not really a pre thing.

03:11 But if you've got an installed package or, or lots of stuff that gets run for a long time.

03:18 Yeah.

03:18 That bytecode will happen once bytecode conversion.

03:21 What is that called?

03:22 Is that compiling?

03:22 I don't know.

03:23 Yeah, I think so.

03:24 But it just doesn't compile to machine instructions.

03:26 It compiles a bytecode like Java or .NET.

03:29 But then what happens is it doesn't JIT compile.

03:31 It just interprets it from there on.

03:32 Right.

03:32 So, yeah, I think there's, there's levels, but it's automatic and hidden, which is cool.

03:36 Well, CPython at the very least has this notion of constant folding where it just come, you know, comes up with your expressions and does it at, at the compile time instead.

03:48 And it's something that I really don't think, like, I don't really think about in Python.

03:52 I definitely think, I know what's happening.

03:54 In, in C, in C++, we got the precompiler going on.

03:59 But the, it does happen and you can see it in action.

04:02 And this, this article talks about it.

04:04 You can use the disassembler to disassemble a bit of Python code and see what it would look like outside of, you know, after the conversion.

04:15 And so something like, you know, if, if you recommend, one of the examples was the days in seconds is 24 times 60 times 60.

04:25 And, and then it, the, the, the, the Python will just convert that to, what is it?

04:30 86, 400.

04:31 Yeah.

04:31 Now the, I'm bringing this up.

04:33 Like one of the things, this is kind of an interesting article about really how it does it.

04:37 And the rest of the article kind of goes into, you know, the, the implementation on CPython of how the folding happens.

04:44 And that's interesting.

04:46 But mostly the reason why I brought this up is because I want people to remember that this happens.

04:50 So if like for this example, it is way better to put in your code days in seconds equals 24 times 60 times 60.

05:00 That's really clear.

05:01 You don't really have to comment it much because people can just look at it.

05:04 But if you were to manually replace that with 86, 400, it's suddenly a magic number then.

05:10 And people won't, you know, in the future, you'll be like, where did this number come from?

05:14 What happens if I change it?

05:15 It's going to muck everything up.

05:17 So I think things like this are great.

05:19 I use it.

05:20 It talks about, it's not just math expressions, things like string expressions too.

05:25 So you can, you know, if you're going to do a, you know, 30 different dash marks to print across the screen, you can say like dash, you know, the dash character times 30.

05:35 And Python will just convert that for you at bytecode time.

05:39 Yeah.

05:40 Yeah.

05:41 Very cool.

05:41 I just checked it for strings and yeah, it definitely says, you know, the final result of the calculation of a bunch of constants involving strings is the answer.

05:50 And you know, the benefit is if it's always going to be the same outcome, why compute it every time you run that function or do an import?

05:56 Yeah.

05:56 And there's some size optimization that happens that Python realizes that some things are so in the article talks about some of the constraints.

06:07 So if you, if you end up with like, you know, a 4,000 character string after doing it, or, you know, I think they found the limit was it'll go up to 4096.

06:16 But if you make it 4097, it doesn't do the folding at that point.

06:21 I don't think you have to memorize it.

06:23 I don't think you have to memorize that.

06:23 I just know that Python does has some optimization where it says if the pre-computed value is too big, then don't worry about pre-compute and do it at runtime.

06:31 Yeah.

06:31 Yeah.

06:32 It makes a lot of sense.

06:32 Perfect.

06:33 I like it.

06:33 And you know, it's another cool chance to just play with the disassembler and understand that a little bit better.

06:38 Jeremy, you ever play with disassemble things?

06:40 No, but was appreciated that the, it was a way to avoid a little of the magic number disaster where Head looked back and reviewed a bunch of, I think it was physics code.

06:52 And so often there will be like, oh, if you're a, if you're a domain expert and you're like, and you're familiar with nuclear reactors, then yeah, you'll, you'll know, you'll know why these pieces are here.

07:02 I, please name them things.

07:04 Yes, exactly.

07:05 Here's the, the number of moles of, or whatever in chemistry.

07:10 Like it, it doesn't make any sense, right?

07:11 So if you kind of do a calculation, but you don't have to pay for the calculation.

07:14 That's, that's really nice.

07:15 I used to do this all the time with the days and seconds, like the seconds and days, because what I would do is I would go to like a date time.

07:23 I would say date time dot total seconds divided by seconds and days.

07:26 Well, that's how many days it is until Paul was on talk Python, the guy behind the daytime stuff and says, do you know, you can go to a time Delta and say it has days equal one and then divide the date time.

07:40 Another time Delta by days equals one.

07:42 And it'll tell you the same answer.

07:43 Like, that's just crazy.

07:45 I, I didn't know how was I supposed to know I could do that.

07:48 So, but yeah, this is definitely a cool one.

07:50 And the disassembler is neat to really understand what's happening.

07:53 Like these little constants, you know, load const, store name, load const, just get fed straight through this huge C eval.c switch loop.

08:01 And that's your program.

08:02 All right.

08:03 One of the things I want to bring up is that these are fun little tiny examples of using the disassembler, which is a fun thing to do because when you, and if you're trying to do a larger function and disassemble it,

08:14 it's going to be more complicated, but it's kind of fun to look at the output of the disassembler.

08:20 Yeah.

08:20 Yeah.

08:20 Yeah.

08:21 Definitely.

08:21 It gives you that inside view.

08:22 All right.

08:23 I stole this from you, Brian.

08:24 It's a good one.

08:25 It's a good one.

08:26 So this one is called pip review and pip review is really cool.

08:32 I learned about this from PI coders, the newsletter and the idea is that updating all of your packages that you've got in a virtual environment is a hassle in various ways.

08:41 One way is I could just not set, you know, I could not pin the version numbers and just install the latest.

08:48 Right.

08:48 But then if I try to reinstall, it just says, you know, those are, those are up to date.

08:52 Maybe I see.

08:53 Oh, I know that there's an update for HTTP X.

08:56 I'll do a pip install dash you pip X, right?

08:59 Upgrade and it'll upgrade it, but it won't upgrade the things that pip X installed.

09:04 Even if I ask pip X to upgrade itself, you know what I mean?

09:07 So there's like this, the dependencies of the dependencies and all that become just a hassle.

09:12 So there's this thing called a pip review, which lets you smoothly see all the available updates and then apply those.

09:20 This used to be part of tools, but it's now its own standalone thing that just directly uses PIP.

09:25 So like all good things, you pip install pip review, which is very meta.

09:29 And then you have pip review.

09:31 And then you can just ask it to do things like just run pip dash review on the, on the command prompt terminal.

09:37 And it'll tell you, you've got this version of this library.

09:40 There's a new one available.

09:41 And that's pretty much equivalent to doing pip list dash outdated.

09:45 But then you can also just say, and fix it.

09:47 So pip dash review --auto, which will just find all the things out of date and update them,

09:52 including the dependency of the dependency of the dependency, which is pretty awesome.

09:56 It'll also let you do this in an interactive way.

09:59 So you can say --interactive and it'll say, this is out of date.

10:02 Do you want to upgrade it?

10:02 Yes or no.

10:03 NumPy is out of date.

10:04 Do you want to update it?

10:05 Pandas is out of date.

10:06 Do you want to update it?

10:06 And so on.

10:07 And you can selectively opt into those.

10:09 And then you can even come up with a constants file that says, you know, please don't update these automatically.

10:15 They're stuck in an old version for whatever reason, into a certain version.

10:19 What do you guys think?

10:19 I hear NumPy and Pandas and Matplotlib.

10:22 And it's all the flashbacks, right?

10:25 I think we met in before time when I was an anaconda.

10:30 And so, I mean, since this certainly looks interesting and solving problems.

10:38 But on my end, still very much, especially for scientific Python bits, a conda loyalist.

10:44 Yeah, yeah.

10:45 Of course.

10:46 Both for package management and for environment management.

10:50 Yeah.

10:50 That's a whole different side of things.

10:52 And, you know, conda definitely managed that quite a bit, right?

10:55 Like, it's all about you can open up your navigator and create your environments and interact with those in that way as well.

11:01 So, yeah, I think this probably applies more to if you're just doing straight pip or maybe you're thinking, well, pip env or whatever.

11:08 The other alternative would be to use something like Dependabot where it finds those changes.

11:12 You pin your version.

11:13 It says there's now a new version and then it upgrades it.

11:16 But that's always going through like some external workflow.

11:18 And this is just like, well, I don't want to go through that.

11:20 I just want to right now find the new stuff and change it or don't.

11:24 Yeah, I tried this out on a project of mine that uses, you know, Flit and the PyProject.tomal to define a couple pinned versions of things.

11:35 So I wanted to check to see if they're out of date.

11:37 And I tried the pip review auto to just auto update them.

11:41 And now that pip has this dependency resolver, it noticed that my project had some pinned and it said there is a new version, but there's a conflict with your project.

11:53 So just be aware you need to figure out that conflict on your own.

11:56 Oh, interesting.

11:57 Okay.

11:57 That's nice.

11:58 Yeah.

11:58 Yeah.

11:59 Very nice.

11:59 Yeah.

11:59 I've recently run into some issues with the resolver and the new.

12:02 Yeah.

12:03 We've gone over that.

12:03 Nice.

12:05 All right.

12:05 Jeremy, what's your first one?

12:07 Keyboards.

12:08 My first one is keyboards.

12:09 And so I have fallen well down the mechanical keyboard rabbit hole.

12:14 You want a loud clackety clackety clack version?

12:19 Just like such.

12:20 Yes.

12:21 So I suppose the Python tie in is, first of all, like, yes, your keyboard is probably the

12:27 way that the bulk of the Python gets into your computer.

12:30 And so as much as we would like to just plug up Jack straight into the brain and think code,

12:35 it doesn't work that way yet.

12:37 So it makes sense.

12:38 So I've fallen into mechanical keyboards mostly to try and get my wrists to be less hurdy.

12:43 I suppose for our viewers who are watching with their ears in the future, the listeners,

12:47 if this is on audio, I've just shown you my hands.

12:50 I may show you keyboards, but I'll have to remember to describe those.

12:54 That's right.

12:55 But I have started to really love mechanical keyboards for ergonomic improvements and ability

13:03 to sort of restructure the way that they work for my benefit.

13:07 Most of the keyboards that you'll see connected to computers are using that are like a flat bar

13:13 shape.

13:13 Use QWERTY, which actually dates back to...

13:17 Everything wrong.

13:17 Everything wrong that you could do, right?

13:19 Are you...

13:20 Do you know when QWERTY came into usage?

13:23 Yeah.

13:24 I mean, very clackety, right?

13:25 For the...

13:26 To slow down the typewriter.

13:27 Yeah.

13:28 But in...

13:29 It was in 1873.

13:30 And so like Civil War era.

13:32 Like back in a...

13:34 Back in...

13:34 I mean, within 10 years of the first American Civil War.

13:37 So when we were still like settling our disputes with like swords on horses and so on.

13:45 And just like there's always a...

13:48 Continues to be a better way of doing things.

13:49 And we keep on working towards the better way.

13:52 Like the layout of keyboards is sort of a vestige of a pastime with different requirements.

13:56 Kind of like wearing pants now, right?

13:58 Like you used to be going out and seeing people now.

14:01 Shorts.

14:02 Yeah.

14:02 Let the shins breathe.

14:03 Exactly.

14:04 Exactly.

14:04 So anyway, like with the...

14:07 What's useful on the keyboards is in addition to getting ergonomic benefits, you can change

14:11 up your key map.

14:12 Normal keyboards have maybe 100 keys on them or so, but they really have 200, maybe 300 keys.

14:18 You have modifier keys.

14:19 You push shift and you're like, okay, now all those keys are now...

14:22 All the letter keys are now capitals.

14:24 The one is an exclamation point and so on.

14:27 And taking key maps are the ways that you can take and change those keys to whatever...

14:32 Right.

14:32 For example, if you wanted to do...

14:34 Yeah.

14:34 If you want to say switch to Dvorak or something along those lines, right?

14:39 I had a friend who taught himself Dvorak, but seeing the Cordy keys was so impossible for

14:43 him.

14:43 He shaved all of the letters off of his keyboard because it was either easier to have nothing

14:48 rather than have the wrong thing there.

14:49 That's sort of what's going on over here.

14:51 This is a...

14:52 Oh, look at that.

14:53 A TRIUS.

14:53 A 44 key split.

14:56 Okay.

14:57 You got to describe that to people.

14:58 First of all, what is that?

14:59 So a company, Keyboardio, just keyboard.io, has made a...

15:06 I think a gentleman in the...

15:07 Yes.

15:08 Pacific Northwest also made a hand-wired version of this.

15:11 Jesse and Kaya at Keyboardio made a mass market version that's manufactured that instead

15:18 of soldering everything together and ordering the pieces, you can just get a completed keyboard,

15:23 which is very nice.

15:24 Yeah.

15:25 And so for this keyboard, you're going to operate largely with layers.

15:30 And so you don't see as many symbols or numbers here.

15:33 And so when you hold down maybe super or function, it's going to change one of the sides to arrows,

15:39 change one of the sides to a number pad, change one of the other sides to the symbols,

15:46 exclamation point, at symbol, asterisk.

15:49 And instead of reaching and twisting like you might on a normal keyboard, where every

15:54 time we thought of a new thing, you're like, oh, the hash symbol, that's going to need to

15:59 go somewhere.

15:59 All the other stuff.

15:59 Yeah.

16:00 Well, you need to add it on and the keyboard keeps growing.

16:03 Here, your hands stay in about the same position.

16:06 But when you put your ring finger down on the home row, of your left hand, the entire right

16:14 side changes to different keys.

16:16 And so the way that I suppose the Python tie in there is that most of these keyboard firmwares

16:22 are written in C because you have the little microcontrollers under that's telling what keys

16:28 what to be.

16:28 But there are Python portions.

16:31 And so the command line interface that QMK, this project on GitHub, quantum mechanical

16:37 keyboard uses, is written in Python.

16:41 Some of the tools that your key maps are sort of always in flux.

16:46 And so you can evaluate the ways that you're using your keyboard.

16:51 So Python can help out there to help you make a heat map of, OK, which keys am I pressing

16:56 most frequently?

16:56 Let me move those to a stronger finger.

16:59 And again, because we're sort of home in quarantine, pandemic time, it's fun to have this sort of

17:06 escape room to get yourself out of.

17:09 And there's a little bit of a challenge to remember where that new key is.

17:12 Or even assembling.

17:14 You've got key caps coming from one place and trying to find out what new features you might

17:20 be able to pull down in the firmware from GitHub on another.

17:22 And folks are making different designs.

17:25 You can go with split hand boards.

17:26 There we can center that up into the interview.

17:29 This is, for those who are listening, RGB, KB, Sol, the sun.

17:36 You basically have two separate pieces.

17:39 Oh, and it has LEDs.

17:41 Beautiful.

17:41 So you have two chunks, one for each hand, and you can position them however it fits for

17:46 you, OK?

17:46 Yeah.

17:47 And so it can open up your shoulders, open up your upper body a little bit.

17:51 Hopefully make your wrists less hurdy.

17:53 Was the...

17:54 Yeah.

17:54 Well, I used to...

17:55 I've struggled for...

17:57 Man, I got to do math for 20 years, maybe.

17:59 15 years with RSI issues.

18:02 And it's...

18:02 I mean, it was to the point where I had surgery on my right hand for carpal tunnel stuff.

18:06 And I thought, man, what am I going to do?

18:08 I did physical therapy.

18:09 It was really quite scary, actually.

18:10 And I just...

18:11 What I did, two things.

18:12 I got a much, much better, more ergonomical keyboard and only use that.

18:16 Like, I never type on my laptop because that thing is a kiss of death for my hands.

18:21 And the other one is I force my...

18:23 I'm right-handed.

18:23 I force myself to become left-handed for mousing.

18:26 Because I use my right hand for the arrows and page down and insert and all that.

18:29 And I figure it's already doing all that stuff.

18:31 Might as well.

18:32 Do you use one of the sideways?

18:33 I cannot find a good sideways left-handed one.

18:37 Oh, that's...

18:38 It's so super hard.

18:39 That's going to be tricky.

18:40 Yes.

18:40 I could either go vertical or I could go left-handed.

18:43 And left-handed is working super well for me.

18:46 But I'm using the little Microsoft ergonomic travel.

18:51 And I love that.

18:52 This thing goes with me everywhere.

18:53 I don't go anywhere without it.

18:54 So, yeah.

18:55 The best way to fix it...

18:56 That's an important thing.

18:56 You're good.

18:57 The best way to fix it is to touch your computer less.

19:00 But if that's not an option.

19:02 So, I mean, the other things that have beat my hands up and I'm trying to be better about

19:07 are if you hold your phone and you just scroll and you scroll some more and you scroll

19:11 some more.

19:11 You can do it with your left hand instead.

19:13 Or you can try and not look into the abyss so often.

19:17 Yeah.

19:17 I've used voice typing.

19:19 Go ahead, Brian.

19:20 Doing a lot of less doom scrolling now than I used to.

19:23 So, things are less crazy.

19:25 Brian, what have you got for your setup?

19:26 Do you just type on your MacBook or you got something better?

19:29 Me?

19:30 Yeah.

19:30 Oh, Kinesis.

19:31 Oh, my gosh.

19:33 You are full on over there, dude.

19:35 A Kinesis one.

19:36 Dishes.

19:37 Yeah.

19:37 So, I've been using Kinesis for like 30 years.

19:43 25 years.

19:44 Wow.

19:45 And similar.

19:47 I had problems with my arms and I was just like a couple of years into my career and I'm

19:54 like, oh, my God.

19:54 I finally get a programming job and I can't do it anymore.

19:57 So, but I switched to the left-handed mouse and now I don't even think about it.

20:03 Some people say like, I don't like switch the mappings.

20:06 I don't switch the left to right.

20:08 I just move the mouse over and use it with my left hand.

20:11 And then also the Kinesis.

20:12 And then when the whole like mechanical keyboard thing started, people were talking about that.

20:18 Like, what's all this about?

20:20 And then I found out that the Kinesis has been mechanical for since it started.

20:25 Yeah.

20:25 Yeah.

20:26 Yeah.

20:26 Kinesis is definitely, definitely an interesting one.

20:28 Although I think I want to get a new one because the key, whatever the mechanics and behind it are the wrong color or something.

20:37 I want to get ones that I have to push down a little harder because I find that I rest my hands on my keyboard and it'll start typing stuff.

20:44 So, I'd like to have it be more hard to push down.

20:49 I think there's probably three things that you can do.

20:51 You can either crack your switches open and put in heavier springs.

20:54 You can go with a, you can get a key switch puller and pull out the switches and plug in.

21:00 Depends if they're hot swappable or if they're soldered down into the board.

21:04 And so, I'm not certain how that one's constructed.

21:07 But oftentimes when there's a, if there's a greater investment in getting the board in the first place, like the ErgoDox ones are hot swappable.

21:17 So, you can take a puller and I have, not in front of me, but over and over in a bin, different key switches that I've tried.

21:24 Some that are quieter, some that are louder, some that are heavier, some that are really light.

21:29 Yeah, eventually you figure out sort of the Goldilocks situation.

21:33 And instead of a keyboard that's made for, to sell millions and millions of units, you've got one that maybe are out of billions of people.

21:39 There's maybe three like it that are just like yours.

21:42 Fantastic.

21:43 Yeah.

21:44 Magnus Carlson, Magnus Carlson says, he has an old ErgoDox over in the corner.

21:50 Right on, right on.

21:51 Why is it in the corner?

21:52 Don't put baby in the corner.

21:53 Desk, get those, love those wrists.

21:56 Yeah, yeah.

21:57 The one that I love, the thing I love about this one is it has such short keystrokes.

22:01 Like you barely have to move your fingers, which to me, a lot of these really nice ergonomic ones, I feel like you've got to move them a lot, which I don't know.

22:07 It's always a balance.

22:08 This one works well for me, but all of these things are super fascinating.

22:11 Yeah.

22:12 There's switches with adjustable travel.

22:15 And so, you can cut probably more than a millimeter out of it going from two down to either one or maybe even 0.8.

22:22 Oh, wow.

22:23 So, you can tune it exactly to what you're after.

22:26 I tried yours, Michael.

22:28 I have one of those, whatever that you've got.

22:32 Yeah.

22:32 Sculpt ergonomic or whatever it's called.

22:34 But it's a Bluetooth one and I can't do Bluetooth keyboards.

22:39 The Bluetooth delay gets me.

22:41 You'd think that I wouldn't be able to notice, but I notice and I don't like it.

22:45 Yeah.

22:46 Yeah.

22:46 Wouldn't it be nice if you could buy keyboards, wires?

22:48 And then I suppose we didn't talk about mousing either.

22:53 We talked about like the actual device.

22:54 But in QMK, that firmware and other keyboard firmwares, if you hold down a button, the other side of your keyboard can become a mouse.

23:03 And so, both any of your keyboard keys can make it travel diagonally or up and down or can be used as click.

23:09 And so, you can replace your, especially for traveling, you can replace your mouse with being able to navigate, move the mouse around with the keyboard.

23:17 Sounds awesome.

23:18 If you could ever fly again, I could see setting a little laptop on like the little fold down tray.

23:23 Put that keyboard on top and you're good to actually get some stuff done.

23:26 All right.

23:27 Now, before we get on to the next item, let me tell you all about our sponsor for this week, Datadog.

23:31 Thank you, Datadog, for sponsoring the show.

23:33 If you're having trouble visualizing latency or CPU or memory bottlenecks in your apps and you're not sure where it's coming from or how to solve it, check out Datadog.

23:41 They seamlessly correlate logs and traces across individual requests and you can quickly troubleshoot your Python app.

23:49 Plus, their continuous profiler allows you to find the most memory and CPU consuming parts of your production code continuously.

23:56 Just run it all the time.

23:57 Minimum overhead.

23:58 Pretty awesome.

23:59 You'll be the hero that got that app back on track at your company.

24:01 Get started today with a free trial at pythonbytes.fm/Datadog or just click the link in your podcast player show notes.

24:07 Brian, let's talk about logos.

24:10 Sure.

24:10 I tried to pull this up, but we're suffering some downtime.

24:16 There we go.

24:16 There we go.

24:17 So there's an article called Reinventing the Python Logo.

24:22 And I thought it was interesting mostly about the history.

24:26 I guess I hadn't thought about it too much.

24:29 So the history really is there have been only two Python logos.

24:33 The original one, which I'm not sure when that came into existence, but it's just sort of some, it looks like a bunch of marshmallows stuck together or something.

24:42 It's not terrible.

24:44 It doesn't look like marshmallows.

24:45 I get light bright vibes.

24:46 Light bright.

24:47 Oh, yeah, yeah, yeah.

24:48 You're right.

24:49 Yeah.

24:49 So it's like white dots and with like black dots around the outside making the Python word.

24:56 And they're like, that's it.

24:57 And apparently that passed for a while.

25:00 And then the current logo came into play in 2006 by and it was designed by Tim Parkland.

25:09 And it's the logo that we have right now.

25:13 And I was, you know, I kind of got the Mayan vibe from the Python icon also or the two Pythons.

25:23 But there's a quote from Tim said, the logo is actually based on a Mayan representation of snakes, which is very often represented only represent only the head and perhaps a short length of tail.

25:34 The structure of the snake represents the natural coiling nesting of snake of a snake as seen on the side.

25:40 I don't know.

25:41 But having having the symmetry also kind of reminds me of a yin yang symbol or something.

25:46 Anyway, I like it.

25:48 It's good.

25:49 But the article then goes on to talk to a talk to a designer who came up with a possible change and proposed a change in 2020, Jessica Williamson.

26:00 And it's pretty.

26:02 But, you know, I didn't really read the rest.

26:05 I just thought it was curious to think about, should we change it?

26:08 And I guess I'm on the side of kind of like the way it is.

26:11 But I'm just curious what you guys thought.

26:13 Jeremy, go ahead.

26:14 I mean, I've grown so used to the other one, but I try not to be a curmudgeon and like new things.

26:23 I know Burger King just did their rebrand.

26:26 And even though I'm not on the Whopper train, I'm like, yeah, you get something fresh.

26:31 I suppose Python even.

26:33 There's going to be more people using it in the future than I've ever used it up to this point.

26:38 And so, you know, what the what the existing folks think is less of a concern if it if it feels newer or more welcoming.

26:45 Yeah.

26:45 Yeah.

26:45 If it pulls people in and it makes them feel like, oh, this is a fresh language.

26:48 Right.

26:49 This is like one of the most popular, fastest growing languages in the world.

26:52 Of course, it has this logo.

26:52 I don't dislike it.

26:55 I think it's pretty nice.

26:55 I like the colors.

26:56 I like the flair.

26:57 But I feel like those gradients, those gradients are hard to combine, whereas like this sort of flat color, you can put it in with other things.

27:04 But like imagine like the thing you're trying to put the logo on also as a gradient.

27:08 Then you got gradients on gradients.

27:09 I don't know.

27:10 It just it seems a little slightly less versatile.

27:12 I like that.

27:13 So what I would just like to point out, though, is there are like rules and laws about this logo in ways that are way beyond what the normal person would think.

27:23 For example, I used to have a logo that looked like the main Python logo, but it had earbuds on.

27:29 However, it didn't have those little holes.

27:31 Right.

27:31 You see the little holes.

27:31 There's the eyes.

27:32 It didn't happen to have those.

27:34 Well, I happened to be on vacation at a beach with my family and got a cease and desist letter from the PSF because I was violating their trademark because I used a logo that wasn't an exact.

27:45 It was an alteration of the Python logo, not the exact one.

27:50 Fair.

27:50 I kind of felt like, you know, it could have been a little nicer rather than a, you know, full on legal.

27:56 Like you must stop this now or else we just have a conversation instead of start it that way.

28:00 Well, those are one of those things where if you don't if you don't defend it, then they have you have a case that you can you can start to lose it as to where you're like, well, you never you never made a case of it before.

28:10 And so you had you kind of have to.

28:11 Yeah, exactly.

28:12 Don't separate the snakes.

28:14 Don't make one snake bigger.

28:15 You can't.

28:16 Right.

28:16 When I put my app in the app store for the training courses, I had to go back and forth and prove that my my new logo, which is approved by the PSF.

28:25 I actually had permission to do that.

28:27 And yet have you all looked at what is in the app stores?

28:31 They are.

28:31 They are change of colors.

28:33 They are, you know, funky redesigns.

28:37 They're like these weird things are slightly different shape like this one.

28:40 Oh, not OK.

28:42 There's just a couple of pages.

28:43 There's like 15 companies violating the trademark.

28:46 And yet with these all presently here, I still had to fight for a week with the app store people to allow my approved one in there.

28:52 Anyway, the exercises one is not is not OK.

28:56 The one the one with the barbell.

28:58 Yeah.

28:59 The barbell one is totally not good.

29:01 They're all not good.

29:02 I'll put the link in the show notes for those of you guys who can't see it.

29:05 But boy, it's long story short, there's a lot around this logo stuff that is just oh, that's cute.

29:12 Right.

29:13 It's quite a bit of stuff around it.

29:15 Legally speaking.

29:15 Yeah.

29:16 Well, you know, the rules aren't really that complicated, though.

29:19 They're mostly no.

29:20 The logo has to appear in the same colors and it has to has to be visible and in its hole without something in front of it.

29:28 Yeah.

29:28 And you can't shift.

29:29 It can't be squished.

29:30 Like mine, the perspective was slightly off for some reason.

29:33 And that was also part of the.

29:35 And they're also fairly good about like you can send stuff to them ahead of time and say, this is what I'm thinking about doing.

29:41 Is this OK?

29:42 And you can get preapproval for stuff.

29:44 But yeah.

29:45 And so now mine is approved and I feel much better about it.

29:48 But I had no idea.

29:49 I just came out of the blue.

29:50 So there it is.

29:51 But if anyone wants to start forcing those, they should go have a look at the app stores.

29:55 They're out of control.

29:56 All right.

29:56 What's not out of control is somewhat related is pypi.org is pretty awesome.

30:02 Right.

30:02 So we go to PyPI and use PIP.

30:05 Indirectly behind the scenes goes to PyPI and does all of its magic.

30:08 You pip install this and install that.

30:10 And it would be great if we could put.

30:12 Use that as a mechanism to communicate across teams or companies.

30:16 Right.

30:16 One team built some sort of API interface layer and some other part wants to consume it at your company.

30:23 But you probably don't want to put that in the public repository.

30:26 It might have secrets.

30:28 It might just be inappropriate.

30:29 All those kinds of things.

30:31 So it would be nice to have your very own.

30:33 Right.

30:33 Yeah.

30:33 Yeah.

30:34 Absolutely.

30:35 Yeah.

30:35 So introducing AWS Lambda PyPI.

30:38 So it takes PyPI cloud, which is a way to do self-hosting PyPI, basically a private repository, but then lets you run that over AWS Lambda in a serverless way.

30:52 So it's basically free unless it's being used and there's a ton of free requests you get at AWS Lambda before you get charged.

30:57 And you don't have to have servers to maintain.

30:59 So you can basically set up PyPI cloud to run automatically as an AWS Lambda, which then you can lock down.

31:07 That's pretty awesome, right?

31:08 Yeah.

31:08 Yeah.

31:09 So there's not a whole lot to talk about it.

31:12 You know, if it acts like a caching server as well.

31:16 So can you get.

31:17 You probably could.

31:18 You probably could do that with PyPI cloud.

31:21 Okay.

31:21 It's just rehosting PyPI cloud, which I'm guessing it can.

31:24 I don't know for certain.

31:25 But so you're saying like you'd like to just set that as the global destination.

31:29 Well, right.

31:29 I wanted to store my private stuff.

31:31 Yeah.

31:32 You want to pull the public stuff in plus like sort of merge your private stuff with it.

31:37 Right.

31:37 Yeah.

31:37 I haven't tried that, but I suspect PyPI cloud does allow that.

31:40 So the security wise, security wise, it says the session keys are auto generated and stored in a secret.

31:47 The server configuration contains those generated on the fly.

31:50 The Lambda functions can be limited to accessing only what it needs.

31:54 And then, of course, you can configure PyPI cloud to display nothing to non authenticated users.

31:59 So you basically have to log into it and then you're good to go.

32:02 So I think this is a pretty neat solution.

32:04 I mean, you've been able to do stuff with PyPI cloud already.

32:07 But being able to put it in a cloud for free at scale is pretty neat.

32:10 Yeah.

32:11 All right.

32:11 Next up, we have not just the basics, but beyond.

32:15 Yeah.

32:16 So if you've read some of L.

32:19 Swigert's other Python books, there's a new one, I believe, dropped January.

32:25 That's the month that we're in.

32:26 Can grab from No Starch Press or can give a look over at the URL above.

32:32 And so many other books and references are like, here's how to do the thing.

32:38 Go on.

32:38 Here's how to do the thing.

32:39 Go on.

32:39 And when looking through beyond the basic stuff, a lot of it is a look through the Python lens, but at being a better developer and being.

32:49 I don't think he said, but for myself, definitely like a less feral developer.

32:53 And so, so, so often it's easy to get into that.

32:56 Give us your interpretation of that.

32:58 That's like, you've just been out on your own.

33:00 You figure out how to make it work, but you don't necessarily follow the community.

33:04 Raised by.

33:05 Agree.

33:05 Raised by technical wolves.

33:08 So, so often when you.

33:11 Love that way of thinking.

33:12 That's awesome.

33:13 When you, when you join, when you join a team that's been either working together already or has been in industry for a while, there's those things that you don't know that you're doing.

33:22 That sort of make, that make you look less polished, whether that's in a, in a code interview.

33:30 And so when like Al goes over, what's, what are, what are reasonable variable names?

33:36 What are code smells?

33:37 Talking about like the duplicating code or what are, so you can write something that works very easily, but here are things that it's so much, it's going to be so much nicer to hear from Al.

33:49 Like, Hey, you probably don't want to do this as opposed to hearing from a teammate and a code review.

33:54 Like what is 86,000?

33:57 You're like, Oh, that's the number of seconds when you multiply by 60 and you do the, yeah, I guess back to the, back to the magic number earlier.

34:03 You're like, well, why is, well, why is that bad?

34:05 I, I did the math already.

34:07 It doesn't make sense to do the math the extra times, but you're like, well, someone's going to have to come behind you and read that later.

34:12 And no one hates you as much as future you hates you because it's probably going to be you who comes behind you and reads that later and doesn't remember.

34:20 And so, yeah, chapter after chapter, it's just so many things that are like, Oh, again, like code formatting.

34:26 Like if you, if you haven't been using formatting and linting, prior and, makes it so much easier to, interact with other folks and sorts of sort of helps you knock those rough edges off.

34:38 That aren't necessarily like, this is how you Python, but this is how you become a good, open source contributor citizen.

34:45 Or these are the things that you need to know to work, but you really didn't, but you didn't know you needed to know.

34:50 Right.

34:50 Right.

34:51 Even probably things like continuous integration and stuff.

34:53 You should probably know or get or, or PRs or all those.

34:57 Like if you've kind of been doing it on your own, like you can, and some organizations do, but many people don't create PRs for themselves.

35:02 They just check in and carry on.

35:04 Right.

35:04 so, so those kinds of things.

35:06 Yeah, this is great.

35:06 And you can read it online or, with the link in the show notes, or you can go buy it.

35:10 Yeah.

35:11 It's on no starch.

35:12 you can either get like the ebook, you can get printed copy.

35:15 Whatever you're, whatever you're into.

35:16 Yeah.

35:17 And I, I think that I was just looking through the code smells one.

35:19 Even people just, just review that anything else.

35:23 This is some pretty good stuff.

35:24 Yeah.

35:25 I love the idea of code smells so much because it's not wrong.

35:29 Just kind of turns your nose.

35:30 Like, you, this isn't, this isn't so good, but it does work.

35:34 Yeah.

35:34 One of the big ones that I run into at work even is a lot is a commented out code.

35:40 people comment something out and then check it in.

35:43 And if it's, if it's dead, delete it.

35:44 Oh, we might need it later.

35:45 That's what version controls for.

35:47 We can go back and get it later.

35:48 If you really, really, really don't lose it, tag it or something, or maybe create a branch

35:53 with a name, but just don't leave it in there.

35:55 Come on.

35:55 Yeah.

35:55 Yeah.

35:56 Or worse.

35:57 Don't comment it out.

35:57 Just stop using it, but don't delete it either.

35:59 Or dead functions.

36:00 Yeah.

36:01 A dead function or dead class.

36:02 Oh my goodness.

36:03 Oh yeah.

36:03 I'll see that occasionally.

36:05 Somebody will rename a function like a function foo old.

36:08 why did you do that?

36:10 Well, we're not using it right now.

36:11 There's better ways to remove that hoarder type code base.

36:15 Exactly.

36:16 Exactly.

36:17 I don't have a problem.

36:18 I just have 23 cats.

36:19 It's going to be all good.

36:20 all right.

36:22 Oh, awesome.

36:23 Well, so, let's talk about just a few extra things that you want us to throw out there.

36:27 Brian, anything else?

36:28 we got a, feedback.

36:30 I'm sorry.

36:31 I can't remember the guy's name, but in episode 208, we covered pip chill, which is a way to

36:37 list out your dependencies, but only the top level ones.

36:40 And, and I made a comment that be cool to have this, but not have it list pip chill.

36:45 Cause I only installed it for this.

36:47 And so, yeah, he added a no chill option.

36:50 So that's nice.

36:51 And, self-aware pip chill.

36:54 And then just before this, I was on these Microsoft developer Twitch channel.

36:59 so that's a, that's a fun thing.

37:01 The Microsoft developer Twitch TV, they do it weekly.

37:04 but don't watch them because you'll collide with watching us.

37:08 So, you know.

37:09 Oh yeah.

37:09 Well, they need to move their time or something.

37:11 It's both recorded.

37:15 It's all good.

37:15 It's all good.

37:16 Oh, and, yeah.

37:17 Piling says he's been using, pip chill.

37:20 So cool.

37:21 Cool.

37:21 Cool.

37:21 Yeah.

37:22 I love the idea of it, but I haven't yet made it into my workflow.

37:25 Jeremy, you got any quick extras you want to throw out there?

37:27 You cover it all.

37:28 I think the, I think the other thing was, Brian's Twitter.

37:30 I looked at and it was either today or yesterday that there was the joke about the machine, the

37:34 machine learning Twitter bots.

37:35 And, and yeah, if like any of those that can be cooked up, always a good time.

37:40 It made me, think of, one of the previous times I was in Portland at one of the

37:44 conferences, there was both, there was talks on, Nate Smith had made prosaic,

37:49 which is a Python, Python for doing a cut and paste poetry.

37:54 And so you have any corpus of information you can take and chunk it down.

37:58 And, that's paired with a Twitter bot.

38:00 And so I went to look back because it's been a while.

38:03 I have a Twitter bot that's still running, just called hitch underscore haiku on Twitter.

38:08 So every hour on the 42nd minute, it takes all the, all five books from the trilogy and

38:14 pulls, a five syllables, seven syllables, five syllables out, combines them all together

38:20 and, and puts that into the world.

38:22 I think about 25, 24, 25,000 times at this point.

38:26 And the machine learning is more wisdom of crowds.

38:29 Like I'll get notifications like, Oh, someone to put favorites on them.

38:32 Maybe, maybe it happened upon a good one in the, in the large pile of terrible ones.

38:37 Fantastic.

38:38 You have to put that in the show notes.

38:39 The machine learning was funny.

38:40 I just found out that like, there's a bot that if you say machine learning, it'll retweet

38:45 you.

38:45 So I tried to install machine, machine learning as much as I could and have it retweet, you

38:51 know, the insights.

38:52 So it's like, you're, you're, you're going to Beatles use the bot.

38:55 and then I suppose also on, on the Twitter front.

39:01 Yeah.

39:01 We just told you not to, not to scroll forever, but my, my favorite client just got a

39:07 refresh.

39:07 if you use iOS devices, the tap bots, folks have put out a tweet bot number

39:13 six yesterday.

39:14 Ooh, nice.

39:15 Yeah.

39:16 That's cool.

39:17 Yeah.

39:17 I got to explore more, Twitter clients.

39:19 I'm still just a web browser kind of guy, but it works for me.

39:23 It works for me.

39:23 All right.

39:23 I got a quick couple of releases for everyone.

39:25 Django 3.2 alpha.

39:27 One was just released.

39:28 So that's pretty awesome.

39:29 a bunch of cool new features coming in Django.

39:32 You can check those out.

39:33 My PI 0.8, has just come out and that has Python three, nine support.

39:38 pip 21 is out and that drops Python two support.

39:42 So that's also a good one more, step away from legacy Python.

39:46 And then real quickly, there's elastic, elastic search.

39:50 They changed their open source model, which is a very, I'm not going to say is bad.

39:55 I, I kind of support them in this path, I think, but it's a very big deal.

39:59 You know, AWS and some of the other, cloud vendors are like basically selling elastic

40:05 as a service, elastic search as a service.

40:07 And they're like, wait, you just took our stuff and are selling it to other people.

40:11 Whereas we have a corporate sort of thing, but we have no relationship with these people.

40:16 And that doesn't seem real fair.

40:17 MongoDB had exactly the same problem.

40:19 And so they adopted the same license, the SSDL or something like this.

40:23 basically it's still open source unless you want to resell it as a cloud vendor, then

40:28 it's not.

40:29 I don't know.

40:30 How do you guys feel about this?

40:31 Open source business models are hard.

40:33 Yeah.

40:33 Yeah.

40:34 And it's really hard to put the, to attempt to put the genie back into the bottle after.

40:39 And so I think the, the, the part of that was unsaid was that Amazon said, fine, take

40:44 your toys and do and sell your, and sell your service, but we'll just fork it and continue

40:48 to do the thing that we forked it with the old model before it, you know, before it's

40:52 changed, it got in there.

40:52 And that was that right.

40:53 And that was similar to what they did with Mongo.

40:55 I think they basically said, we have a thing that is API compatible at, you know, three,

41:00 six or whatever level it froze at.

41:02 Right.

41:02 And then they went on from there.

41:03 Yeah.

41:03 It's tricky.

41:04 I think for some reason, Elastic has a relationship with Google cloud and Azure.

41:09 And so they don't have that challenge with Azure, but they have no relationship with AWS.

41:13 So here it is.

41:14 Anyway, it's don't want to go that long onto it.

41:16 I just wanted to throw that out there as something people would be paying attention.

41:18 But people that use it internally or on their own servers, there's no problem with that,

41:23 right?

41:24 Yeah.

41:24 Yeah.

41:24 That's my understanding.

41:25 You guys ready for a joke?

41:26 Yes.

41:27 Always.

41:27 All right.

41:28 Brian, I feel like being a manager today.

41:30 Can you be the developer?

41:31 This comes to us from Kate Maddox.

41:34 Well, it comes to us via a guy named Wolf.

41:37 Send it over.

41:38 Thank you for that.

41:38 And it's written by Kate Maddox.

41:40 So, all right.

41:41 You be the developer.

41:41 I'll be the manager.

41:42 So I have good news and bad news.

41:44 Oh, what's the good news?

41:46 I've discovered that the five second rule only applies to food.

41:50 Fantastic.

41:51 But what's the bad news?

41:52 I dropped our tables.

41:54 Whoops.

41:57 I hope you all had backups.

41:59 Oh, boy.

42:01 Well.

42:02 Did you hear that?

42:03 Like, I mean, I probably have this wrong, but I think that the five second rule, I thought

42:07 it was 10 second rule.

42:08 Anyway.

42:09 It depends.

42:09 It varies by age.

42:10 You know, if you're a little kid and it's candy, it's probably a good 30 second rule.

42:13 But I think it used to be a lot longer.

42:17 And I think that it came, stemmed from Genghis Khan, or at least I heard this story that Genghis

42:23 Khan had a rule about how long he would eat, how long after, how many numbers of days he

42:29 would eat meat that had been left on the floor or left on the ground or something like

42:33 that.

42:33 So, you know, probably not good to eat meat.

42:36 It's been laying around for a few days.

42:37 That's the three day rule.

42:40 Yeah.

42:40 Yeah.

42:40 You want to keep that pretty short.

42:41 Is it warm?

42:42 Get the magic number for number of seconds by number of days by cleanliness of floor.

42:46 That's right.

42:46 It's only 150,000 seconds.

42:48 No more than that.

42:49 Come on.

42:50 Oh, boy.

42:51 All right.

42:52 Maybe somebody can correct me with the real story.

42:55 Yeah.

42:55 Yeah.

42:56 That's what happens on the show.

42:57 We threw out bits of information and our listeners back us up.

43:00 Yeah.

43:01 All right, Brian.

43:02 Thanks as always.

43:02 Jeremy, it's great to catch up with you.

43:04 Thanks for being here.

43:05 Absolutely.

43:05 Thanks for having me.

43:06 You bet.

43:07 Bye.

43:07 Thank you for listening to Python Bytes.

43:10 Follow the show on Twitter via at Python Bytes.

43:13 That's Python Bytes as in B-Y-T-E-S.

43:15 And get the full show notes at Pythonbytes.fm.

43:19 If you have a news item you want featured, just visit Pythonbytes.fm and send it our way.

43:23 We're always on the lookout for sharing something cool.

43:26 On behalf of myself and Brian Okken, this is Michael Kennedy.

43:30 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page