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


Transcript #77: You Don't Have To Be a Workaholic To Win

Return to episode page view on github
Recorded on Saturday, May 12, 2018.

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

00:05 This is episode 77 recorded May 12th, 2018.

00:10 I'm Michael Kennedy.

00:11 And I'm Brian Atkin.

00:12 And we have a very special episode and a live audience.

00:15 [applause]

00:18 That's right, we're recording live from PyCon. Thank you everyone for being here.

00:22 And everyone who couldn't make it, you missed a great party.

00:24 This episode is brought to you by Datadog.

00:26 They actually, I think they have, do they have a booth out there?

00:28 Yeah.

00:29 booth out there. I've been stuck at my booth the whole time which is wonderful but I don't know what's out there. So that's amazing. We'll tell you more about them later. Right now, Brian, what do you got for us?

00:37 I have a fun article that actually comes from the Java world but it's "Why Senior Devs Write Dumb Code." And it starts out with a quote from Kent Beck which I love, "Is any fool can write code that a computer can understand? Good programmers write code that humans can understand. And just some tips to make sure that you try to keep clean, clean, straightforward, obvious code and follow principles like YAGNI, single responsibility, DRY, etc. And this, I think this is important in the Python world because there are some cool language features that we have that are fun to play with. And I definitely want people to go ahead and try all the cool new language features but make sure that your code still is readable even by people that aren't as Python savvy as you are. So that's just what I've got.

01:35 It's awesome. Are you telling me that like the shortest code is not the most readable always? Yes. That's hard for me to do also because I really like one-liners that pack in like a whole bunch of stuff. Yeah I do too. So does that cover the solid principles like single responsibility, open-closed principle or Or is it just more general, like write good code?

01:56 - Well, I think, may write readable code.

01:59 - Readable code, right.

02:00 - I don't necessarily adhere to solid being readable.

02:04 - You know, that's a really good point.

02:06 So like solid principles, I don't know if you all know, it's single responsibility principle, open close principle, list cost substitution principle, et cetera.

02:12 And a lot of times that is like super design pattern heavy and you're like, there's so much abstraction here.

02:18 Like, I know this looks like it came out of a textbook, but it's bad, right?

02:22 - Yeah.

02:23 - Yeah, so actually maybe not so much.

02:25 - Well, and I've seen it in code reviews too.

02:27 We've had people do maybe a C-ism in Python, and sometimes that's bad, but also sometimes if it's a little bit of code and you can look at it, it's easy, obvious what it's doing, maybe it doesn't need to change to be more Pythonic.

02:45 It's probably fine.

02:45 - Yeah, that's true.

02:47 So, Brian, have you been having a hard time finding your way around here?

02:51 You get lost?

02:53 You guys having a bit of a hard time?

02:54 I feel like I've taken a walk where it's like, OK, we've gone a quarter mile, and there was a door to that place on the other side of the expo hall.

03:02 Why did I go that way, right?

03:03 Well, the next thing, if they had used it--

03:06 I'm sure they haven't-- if they'd used it, there's this thing called GeoAlchemy2.

03:10 You've heard of SQLAlchemy, right?

03:12 So there's this thing you can layer upon SQLAlchemy called GeoAlchemy2.

03:19 And what it does is it provides geospatial queries and operations on top of, say, Postgres.

03:26 So you can ask questions like, how far is it from here to there?

03:29 Like, am I within this room?

03:31 Like, you could easily define all these as polygons, insert them as SQLAlchemy objects, and ask questions like, who is in such and such room if we all say RFID?

03:41 And that would be easier to navigate, PyCon?

03:43 If we could throw some A* algorithms to, like, say, find the shortest path through all the open doors and stuff.

03:49 Yeah, it'd be easier.

03:51 Anyone out there do any geospatial queries, things like that?

03:56 Yeah?

03:57 Yeah, not that query so much, but we do some geospatial work.

04:00 And so sometimes you need it.

04:03 Give it an object, find it in the earth.

04:05 Nice, have you tried geoalchemy?

04:07 No, I haven't.

04:08 Actually, I wanted to ask.

04:09 Is that from the same people who bring people up?

04:11 I think it's a different group.

04:13 There was a thing called geoalchemy.

04:15 And then you could use that.

04:19 And this is like a reimagining of the API.

04:21 So this is like a second edition.

04:23 So the way it works is basically just like SQLAlchemy, you connect your database, you declare mapping, you declare the class that just arrives from a SQLAlchemy base.

04:33 It has a name and an ID.

04:35 But it can also have columns like a geometry, which is a polygon.

04:39 And then about that, you can ask questions.

04:40 Like you can go to it and just say session.query.filter, where this thing contains this point or where the area is greater than or less than such and such. And just all sorts of interesting questions. So if you like SQLAlchemy and you want to ask questions about physical stuff, boom, GeoAlchemy 2.

04:58 >> Nice. >> Yeah.

05:02 >> Well, since we didn't share each other, we have no cool segue between everything.

05:07 >> Not too much, but I got some--I can see what you got here for this one.

05:10 >> Yeah. >> Yeah, so we've been on a rant, haven't A UI rant?

05:15 - Yes, a little bit of UI in the podcast.

05:18 (laughter)

05:19 But one of the things that has come to our attention is Qt is not staying still.

05:24 So there's, what I'm talking about here is there's another PySide 2, which is going to be called like--

05:35 - Qt for Python?

05:38 - Qt for Python.

05:39 But it's not quite ready yet.

05:41 But there's actually a lot of Python bindings that I know of.

05:46 There's PySide 2, there's PyQt 5, there's PyQt 4, there's the original PySide, and there's a couple, and then there's Qt.py.

05:54 - And this is just for Qt, not WXPython, not all the other stuff, right?

05:58 - Yeah, just for Qt.

05:59 - Yeah.

06:00 - There's two projects, Qt.py.convert is a project that converts these interface bindings to an intermediate, which is a shim layer, which is qt.py, which is a minimal, the build is a minimal Python 2 and 3 shim around all of the Qt bindings.

06:23 And just sort of fun to be able to use one, whatever you've got now, and convert it back and forth.

06:32 - I think it's a great idea.

06:33 So it's gonna be awesome that there are new, better ways to write Python UIs.

06:38 But there's all this other code that people have written, PyQt 4, for example.

06:43 And this thing will let you sort of run a converter across it to adapt from all these different older versions to the new hotness.

06:50 So it should make it work really well.

06:52 Yeah, and one of the neat things about this is it uses a conversion that leaves all your comments in place.

06:57 So it rewrites Python code, but it rewrites it, leaves a bunch of your stuff in there.

07:05 That's pretty advanced.

07:06 >> Yeah, so maybe, but do you like a branch or something before you do that?

07:09 >> Yeah, probably.

07:10 >> All right, anybody got a comment on Python UIs?

07:14 All right, cool. So I'm really excited for that. I'm excited for Python for QT coming.

07:22 I think that's going to be good. There's a bunch of other stuff. I think there's--there needs to be more work done there as I've said. All right, so let me tell all the listeners and you guys about our sponsor.

07:32 So Datadog, who are big supporters of the Python space, they're here at the conference.

07:38 Obviously, they've been supporting the show for a long time.

07:40 So check out Datadog.

07:40 They're like a monitoring solution mostly for your distributed applications.

07:44 So if you got like microservices and containers and all that, you can trace a request from one part to the next and the next and figure out where things are slow, where you run into errors, all sorts of stuff like that.

07:54 So get a cool Datadog t-shirt.

07:55 Go to pythonbytes.fm/datadog.

07:58 Do the tutorial, get a cute dog shirt.

08:00 - That's awesome.

08:02 All right, so, Brian, we live in a pretty laid back city, Portland, it's pretty chill, right?

08:08 - Love it.

08:09 - Yeah, I love it too, man.

08:10 But even in Portland, there is a bit of a sense of people are like working really hard and it's almost like a badge of honor.

08:16 Like, oh man, how you doing?

08:17 I'm so busy, you wouldn't believe how busy I am.

08:20 I know you're busy, but I'm like way more busy.

08:22 I've got all these projects and I've got this stuff going on and that.

08:25 There's this great article written that is a reminder that you don't have to be a workaholic to get ahead in tech.

08:31 So the article's called, "You Don't Have to Be a Workaholic to Win 13 Alternative Ways to Stand Out." And I really, really like this because I feel like there's two things going on that I don't like.

08:41 One is this, what I kind of opened with, people like busy brag, like it's cool to them to be super busy.

08:48 And so they just tell you how busy they are and you know, you just one up each other.

08:52 - Yeah, I ran into this guy that says like, yeah, I've got two podcasts, I wrote a book.

08:56 Yeah.

08:56 [LAUGHTER]

09:00 That's not cool, man.

09:01 That's not cool.

09:02 And the other one is actual tech companies or other companies that are like, you know what?

09:07 We're going to put just a fake deadline here, six weeks out, and make everybody work overtime so we can hit it.

09:13 And they're just like, well, what happens if we don't hit it?

09:15 Well, then my manager will be upset.

09:16 That's not a real deadline, right?

09:18 Those are not actual deadlines.

09:20 And so there's just a bunch of great ideas in here.

09:22 So let me run by you and see what you think.

09:24 Oh, by the way, yeah, let me just run through the tips.

09:29 Hold on.

09:30 This thing like popped up, Anthony.

09:33 All right, so here's the tips.

09:35 The first one is like you can be a workaholic or you can be creative.

09:39 And if you really try to think differently about solutions, if you're the person that says, yeah, we could work all night and we could build this thing this way, well, did you know you can pip install a thing that did this, right?

09:52 If you just like think outside of the box and try to solve the solution, creativity could be more value than working hard.

09:57 Yeah? - Yeah.

09:58 - Stubbornness.

10:00 Stubbornness is not generally considered a good thing, but in programming, I've had lots of people go, "Michael, you're so good with computers, "you're such a good programmer, how'd you learn this?" It's like, I tried this, it was hard, it didn't work.

10:11 I'm just like, well, I tried it for three hours, and then it did work, right?

10:14 I tried everything I could think of until it worked, and it just, I wasn't gonna quit.

10:18 And I think that's one of the things they're talking about.

10:20 You have that experience?

10:21 - So that's a way to work less?

10:24 - No, that's not a way to work less.

10:26 But what they're saying is if you're the person that can actually solve the problem 'cause you don't give up on it, rather than just like, ah, we can't do this thing, we gotta do something else.

10:34 - Okay.

10:34 - You know, that kind of thing.

10:35 They're all like a pretty interesting little takes.

10:37 Curiosity.

10:38 - Yeah.

10:39 - Right, like I'm willing to be the person that learns Kubernetes and actually now we can all go home 'cause our deployments don't break and I don't even have a pager, it's amazing.

10:46 Right, that's cool.

10:47 Kindness, I really like the kindness one.

10:51 Like if everyone is a jerk, and you're the person that's nice and helps everyone, right?

10:54 Like all of a sudden, you become the person, the officer, the company.

10:57 And they're like, yeah.

10:58 Go talk to Jeff, man.

10:59 He will help you, and he won't insult you at the same time.

11:04 Planning.

11:04 Planning is good.

11:06 Improvisation.

11:08 Like sort of the opposite of planning.

11:09 Like, well, things aren't going according to plan.

11:11 Let's fix it.

11:11 Enthusiasm.

11:13 Kind of like kindness.

11:14 Communication.

11:15 That's good.

11:16 Presence.

11:17 I really like that one.

11:18 Yes.

11:19 Right?

11:19 Like so many people are like, yeah, that's a great idea.

11:22 Yeah, I'm gonna go work on my thing, right?

11:23 But just like take the time to like be in the moment.

11:26 - That's actually hard.

11:27 - It's hard, I'm making fun of it, but it's hard.

11:29 - And especially in a work environment, you're like in the middle of something, somebody comes over.

11:35 If you're gonna be interrupted anyway, then really be interrupted and pay attention.

11:39 - Yeah, exactly.

11:40 Yeah, yeah, for sure.

11:41 So I'll keep going, just a little bit more collaboration, right, open source, like we're all kind of in that space.

11:46 Anyway, willingness, I honestly forget what that is about.

11:50 But I remember it was really good.

11:52 Patience also.

11:53 And then finally, institutional knowledge.

11:55 Like--

11:57 Where to lock people up.

11:58 Yeah, where the bodies are buried.

11:59 No, like why do we have that old server over there?

12:03 And can anybody work with it?

12:05 Yeah, actually, I know where the source code is, and I could fix that for you, right?

12:08 I don't want to.

12:09 It's PHP, but I could fix it if I had to.

12:12 Anyway, so do these resonate with you guys?

12:16 - Yeah.

12:16 - You think of Stephanie, I'm forgetting her last name.

12:20 - Herbert.

12:21 - Yeah, she talked about, I mean your conversation over there was about mentoring, but she talked about her worker approach and how she only works like four hours a day.

12:30 She owns her own data compression and consultancy.

12:34 But this also makes me think of a post I've seen from somebody who works with a Starbucks' web application group today.

12:43 Talked about how they pretty much almost burned out industry and they just, the AI institutes some of these principles to just make things obviously probably not only more productive at work, just more sustainable for you long term on a personal basis.

12:58 Yeah, that's great.

12:59 Yeah, absolutely.

13:00 All right.

13:03 So are we going back to World War I?

13:05 No, we're actually going back to QT.

13:07 Oh, okay.

13:08 So pretty much the trenches.

13:12 Yeah, so actually, we just related to that.

13:17 When I was researching for the QTPy convert, I was curious as to how they did the conversion while leaving the code comments in place.

13:26 So I followed the rabbit hole, and there's a project called Red Baron, which is I hadn't heard of before.

13:32 But it calls itself a FST, which is a full syntax tree.

13:38 So it's a lossless abstract syntax tree thing, which you can do queries and modifications.

13:46 And I think it's, they've got a few uses that they list of possibly like renaming a variable in a source file and making sure that it doesn't clash with anything that's not a variable, like not clashing with things in strings and other bits.

14:03 A few handful of like splitting up files.

14:07 There's other, I think this is sort of maybe a tool to build other tools with.

14:11 I can't imagine, I personally wouldn't try to write a script of doing this, but if I built it into an ID or something like that.

14:22 - Yeah, this sounds like this is the foundation of a refactoring tool.

14:25 - Yeah.

14:26 - Pretty much, that's awesome.

14:27 - But I've done hundreds of tests.

14:30 There's no off the shelf thing that's gonna do that, but maybe something like this.

14:34 - Yeah, that's really, really awesome.

14:36 But it's a fun project.

14:38 - Michael, you joke about the conversion of two to three, but that's exactly what two to three, the tool does.

14:45 - Yeah, no, yeah.

14:46 - So everyone here knows AST module, I hope, it's really cool.

14:50 And then I guess they call it a full syntax tree, but it's often more broadly referred to as a CST, or concrete syntax tree.

14:56 - Okay, nice.

14:57 - And so that's what two to three is based on.

14:59 It's also what the new black code formatting tool >> Yes. >> It's based on, right?

15:06 It has to maintain comments and all these things that otherwise go away in the ASD. >> Right. That's awesome.

15:12 Yeah, thanks. Black is awesome. We covered it before.

15:15 You got to like the color. All right.

15:18 So I want to close out the official items with something pretty cool here. So our booth is right next to the B-ware guys. And the B-ware guys are trying to fill another major hole that I see in the Python space, which in the Python space, which is really around packaging and especially mobile, right? Like they're trying to build native apps in Python. And I've been a little bit of a -- I've criticized them a little bit previously saying, "You guys, there's like not really many demos and not a lot of screenshots. You got to like show me where this stuff is if you expect people to use it," right? Well, so one of the announcements this week is that Project Beware just launched an app in the Apple App Store. Like a straight up approved by Apple, install it on your phone and it does stuff.

16:00 It's not super advanced, it's basically like, gives you currency conversions and tip calculations, like how much do I need to tip in like RMB, you know, it's things like that, but it's really cool that there's an example of a BeWear app in the App Store.

16:16 - Yeah.

16:16 - Yeah.

16:17 - Is that one from the app store?

16:19 - I'm sure that it is, I haven't looked at the source code, but yeah, I'm sure that they've got it up there.

16:25 So the link I have, I think, either goes to an article straight to the App Store and it's pretty cool.

16:30 So it uses Briefcase and Toga and Briefcase is a tool for converting a Python project into a standalone native app on Mac, Windows, Linux, iPad, iPhone, Android, Apple TV and tvOS.

16:42 Actually, are those different?

16:45 Anyway, yeah, Apple TV and tvOS, awesome.

16:47 So it's pretty cool.

16:49 So it's like a first step.

16:51 I was talking to Keith Russell McGee about it and he's pretty excited but it's just the the first step. But if you guys are looking to contribute to open source, they're really big at accepting new folks. They're a really great project for that.

17:08 And you get a token.

17:09 And you get a cool token, like a token to say I contributed to the BWORK project.

17:13 Yeah, I was actually talking with Ken Russell.

17:16 Russell.

17:17 Yeah. And he was, one of the things that I, one of the parts of their system is Cricut, which is a testing GUI.

17:28 And it doesn't handle pytest, but that's one of the things they'd like to have somebody work on is to try to convert--

17:34 Oh, are you going to add pytest to Cricut?

17:37 I'll look into it.

17:38 But I'm bringing this up now to recruit anybody else that wants to help out with that.

17:42 Because I would definitely try it out more if it already had a pytest link.

17:48 Yeah, that's awesome.

17:49 Yeah, you gave your talk on visual testing with--

17:54 - Yeah.

17:55 - PyCharm, which is awesome, and it's gonna be on what's up, I'm gonna mention in a second.

17:58 But that's sort of another analogous thing, right?

18:01 Like a GUI for running your tests and your project.

18:03 - Yeah, so we use PyCharm for the test runner part, but this would be just a stand-alone test runner without an IDE attached to it.

18:10 - Yeah, exactly, no editing, just the running.

18:12 - Yeah.

18:12 - Right, it's easier to fix the test if you don't have to edit it.

18:15 (laughing)

18:16 All right, well, I think that's it for all of our items that we have for you guys this week.

18:19 I have a few extra things I wanna throw out.

18:21 Actually, this one more to the listeners.

18:25 So first of all, all the videos, except for things like this, are recorded and put online.

18:31 So already the videos from PyCon 2018 are live, and people can check them out, right?

18:36 There's some.

18:37 Yeah, not all of them, but they're coming in.

18:38 There's a day or two latency there.

18:40 That's pretty good, though, for video.

18:42 So just go to youtube.com/pycon2018.

18:47 The other one is not so good.

18:48 Apparently there was some package that caused some trouble.

18:50 Like previously, remember we talked about there being bad packages getting into the app store, not app store, the pip, pivo.

18:56 - Yeah.

18:57 - PyPI.

18:58 So there's some Reddit post that says, "Hey guys, you should be a little bit careful "with the ssh-decorator package." And it says, "Don't install it or use it from pip.

19:11 "It has a backdoor to steal all your SSH credentials." - Oh.

19:15 - And if that's true, you should not have this running anymore and you should uninstall it.

19:20 I don't know, but the people say the compromise package has been taken out.

19:26 They reached out to the developers and initially there was no response, but apparently it's gone now.

19:31 So you can't update it, but if you already have it, you should not have it anymore.

19:35 So just like a sort of PSA, public service announcement, don't use that.

19:40 >> Yeah.

19:41 >> Yeah.

19:42 So anything else you want to add, Brian?

19:44 >> No, I'm just having a great time at PyCon.

19:46 >> Yeah, PyCon is awesome.

19:49 I call this my geek holiday.

19:51 I try to refrain telling my wife that because she's like, "You just got back from geek holiday." I'm like, "No, I'm really actually tired.

19:57 I need to rest." "No, you need to take the kids and do this and do that." It's all right.

20:00 But yeah, I really love coming here and I really look forward to meeting everybody and having these experiences.

20:06 It's exhausting.

20:07 It's exhausting in an amazing way.

20:08 You've got to talk with nerd stuff all day long and then go out and have dinner and drinks with nerds all day long.

20:13 I know.

20:14 I had to have cocktails yesterday.

20:15 It was really hard.

20:16 (laughter)

20:19 Alright, so how about everyone in the audience, you guys wanna just close it out, say goodbye from PyCon?

20:25 - Goodbye from PyCon!

20:28 - Thank you everyone for listening, thank you for being here for this live recording.

20:32 (applause)

20:34 Thank you for listening to Python Bytes.

20:41 Follow the show on Twitter via @pythonbytes, that's Python Bytes as in B-Y-T-E-S.

20:46 and get the full show notes at pythonbytes.fm.

20:50 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

20:55 We're always on the lookout for sharing something cool.

20:57 On behalf of myself and Brian Okken, this is Michael Kennedy.

21:01 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page