Python Bytes - #77 You Don't Have To Be a Workaholic To Win

Episode Date: May 12, 2018

Topics covered in this episode: Why Senior Devs Write Dumb Code GeoAlchemy 2 You Don't Have To Be a Workaholic To Win: 13 Alternative Ways To Stand Out Project Beeware AppStore Extras Joke See t...he full show notes for this episode on the website at pythonbytes.fm/77

Transcript
Discussion (0)
Starting point is 00:00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 77, recorded May 12th, 2018. I'm Michael Kennedy. And I'm Brian Ocken. And we have a very special episode and a live audience. That's right, we're recording live from PyCon. Thank you everyone for being here. And everyone who couldn't make it, you missed a great party.
Starting point is 00:00:24 This episode is brought to you by Datadog. They actually, I think they have, do they have a booth out there? Yeah. Yeah, I think they have a 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?
Starting point is 00: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, straightforward, obvious code and follow principles like Yagni, single responsibility, dry, etc. And 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.
Starting point is 00:01:21 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 Pythonic savvy as you are. So that's just what I've got. It's awesome. Are you telling me that 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 a whole bunch of stuff.
Starting point is 00:01:47 Yeah, I do too. So does that cover the solid principles like single responsibility, open-close principle, or is it just more general, like write good code? Well, I think may write readable code. Readable code, right. I don't necessarily adhere to solid being readable. You know, that's a really good point. So like solid principles, I don't know if you all know, it's single responsibility principle, open-close principle, list-cops substitution principle, etc. And a lot of times that is like super design pattern heavy and you're like, there's so much abstraction here.
Starting point is 00:02:18 Like, I know this looks like it came out of a textbook, but it's bad, right? Yeah. Yeah. So actually, maybe not so much. Well, and I've seen it in code reviews too. 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 obvious what it's doing,
Starting point is 00:02:42 maybe it doesn't need to change to be more Pythonic. Yeah, that's true so brian have you been having a hard time finding your way around here you got lost you guys having a bit of a hard time like i feel like i've taken like a walk where it's like okay we've gone like a quarter mile and there was a door to that place on the other side of the expo hall why did i go that way right well the next thing if if they had used it i'm sure they haven't if they'd use it there's this thing called geo alchemy 2 if you you've heard of sequel alchemy right yeah so there's this thing you can layer upon geo uh sequel alchemy called geo alchemy 2 and what it does is it provides
Starting point is 00:03:20 geospatial queries and operations on top of, say, Postgres. So you can ask it questions like, how far is it from here to there? Like, am I within this room? Like, you could easily define all these as polygons, insert them as SQL alchemy objects, and ask questions like, who is in such and such room if we all had, say, RFID? And that would be easier to navigate, PyCon? If we could throw some A-star algorithms to, like, say,
Starting point is 00:03:46 find the shortest path through all the open doors and stuff, yeah, it would be easier. Anyone out there do any, like, geospatial queries, things like that? Yeah? Yeah, not that query so much, but we do some geospatial work, and so sometimes you need to, you know, give it an object, find it, and here it is. Nice. Have you tried geo-alchemy? No, I haven't. Actually, I wanted to work, so sometimes you need it. You know, give it an object, find it, and here it is. Nice. Have you tried GeoAlchemy? No, I haven't. Actually, I wanted to ask. Is that from the same people who bring people on? I think it's a different
Starting point is 00:04:11 group. There was a thing called GeoAlchemy, and then you could use that. And this is like a reimagining of the API, so this is like a second edition. So the way it works is basically just like SQL Alchemy, you connect your database, you declare mapping, you declare like the class is
Starting point is 00:04:31 just derived from like a SQL Alchemy base. It has a name and an ID, but it can also have columns like a geometry, which is a polygon. And then about that, you can ask questions like you can go to it, 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 SQL Alchemy, and you want to ask questions about physical stuff,
Starting point is 00:04:56 boom. GeoAlchemy 2. Nice. Yeah. Well, since we didn't share each other, we have no cool segue between uh everything not too much but i got some i can see what you got here for this one yeah yeah so um so we've been on a rant haven't we a ui rant yes a little bit of ui in the in the podcast um but one of the things that
Starting point is 00:05:21 has been come to our attention is qt is not staying still. So what I'm talking about here is there's another PySide 2, which is going to be called Qt for Python. But it's not quite ready yet. But there's actually a lot of Python bindings that I know of. There's PySide2, there's PyQt5, there's PyQt4, there's the original PySide, and then there's Qt.py. And this is just for Qt, not WXPython, not all the other stuff, right? Yeah, just for Qt.
Starting point is 00:05:59 Yeah. And there's two projects. QtPyConvert is a project that converts these interface bindings to an intermediate, which is a shim layer, which is Qt.py, which is a minimal Python 2 and 3 shim around all of the Qt bindings. And it's just sort of fun to be able to use one whatever you've got now and convert it back and forth.
Starting point is 00:06:31 I think this is a great idea. It's going to be awesome that there are new better ways to write Python UIs, but there's all this other code that people have written. PyQt4, for example. 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.
Starting point is 00:06:50 So it should make it work really well. Yeah, and one of the neat things about this is it uses a conversion that leaves all your comments in place. So it rewrites Python code, but it rewrites it, leaves a bunch of your stuff there. That's pretty advanced. Yeah. So maybe do like a branch or something before you do that? Yeah, probably.
Starting point is 00:07:11 All right. Anybody got a comment on Python UIs? All right. No. All right. Cool. So I'm really excited for that. I'm excited for Python for QT coming.
Starting point is 00:07:22 I think that's going to be good. There's a bunch of other stuff. I think there needs to be more work down there, as I've said. All right. So let me tell all the listeners and you guys about our sponsor. So Datadog, who are big supporters of the Python space, they're here at the conference. Obviously, they've been supporting the show for a long time. So check out Datadog.
Starting point is 00:07:40 They're like a monitoring solution mostly for your distributed applications. So if you've 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're running into errors, all sorts of stuff like that. So get a cool Datadog t-shirt. Go to pythonbytes.fm slash Datadog. Do the tutorial. Get a cute dog shirt.
Starting point is 00:08:00 It's awesome. All right. So, Brian, we live in a pretty laid-back city, Portland. It's pretty chill, right? Love it. Yeah, I love it too, man. But even in Portland, there is a bit of a sense of people are working really hard, and it's almost like a badge of honor.
Starting point is 00:08:16 Like, oh, man, I'm so busy. You wouldn't believe how busy I am. I know you're busy, but I'm way more busy. I've got all these projects, and I've got this stuff going on and that. There's this great article written that is a reminder that you don't have to be a workaholic to get ahead in tech. So the article is 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. One is this, what I kind of opened with people like busy brag
Starting point is 00:08:45 like it's cool to them to be super busy yeah and so they just tell you how busy they are and you know you just one-up each other yeah i ran into this guy that says like yeah i've got two podcasts i wrote a book yeah that's not cool man that's not cool and the other one is like actual tech companies or or other companies that are like, you know what? We're going to put just a fake deadline here six weeks out and make everybody work overtime so we can hit it. And they're just like, well, what happens if we don't hit it? Well, then my manager will be upset. Like that is not a real deadline, right?
Starting point is 00:09:17 Those are not actual deadlines. And so there's just a bunch of great ideas in here. So let me run by you and see what you think. Oh, by the way, yeah, let me just run through the tips. Hold on. This thing like popped up, Anthony. All right. So here's the, here's the tips. The first one is like, you can be a workaholic or you can be creative. And if you really try to think differently about solutions, if you, if you're the person that says, yeah, we could work all night, and we could build this thing this way,
Starting point is 00:09:52 or did you know you can pip install a thing that did this, right? If you just think outside of the box and try to solve a solution, creativity could be more value than working hard. Yeah? Yeah. Stubbornness. Stubbornness is not generally considered a good thing, but in programming, I've had lots of people go,ael 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 i'm just like well i tried it
Starting point is 00:10:12 for three hours and then it did work right like i tried everything i could think of until it worked and it just i wasn't gonna quit and then that's one of the things you're talking about you have that experience so that's a that's a way to work less? No, that's not a way to work less. But what they're saying is if you're the person that can actually solve the problem because you don't give up on it, rather than just like, ah, we can't do this thing. We've got to do something else. Okay. That kind of thing.
Starting point is 00:10:35 They're all like a pretty interesting little takes. Curiosity. Yeah. Right? Like I'm willing to be the person that learns Kubernetes and actually now we can all go home because our deployments don't break. And I don't even have a pager. It's amazing. Right?
Starting point is 00:10:47 That's cool. Kindness. I really like the kindness one. Like, if everyone is a jerk and you're the person that's nice and helps everyone, right? Like, all of a sudden you become the person in the office or the company. And they're like, yeah, go talk to Jeff, man. He will help you and he won't insult you at the same time. Planning.
Starting point is 00:11:04 Planning is good. Improvisation, like sort of the opposite of planning, like, well, things aren't going according to plan. Let's fix it. Enthusiasm, kind of like kindness. Communication, that's good. Presence. I really like that one. Yes.
Starting point is 00:11:18 Right? Like so many people are like, yeah, that's a great idea. Yeah, I'm going to go work on my thing, right? But just like take the time to like be in the moment that's actually hard and i think it's hard i'm making fun of but it's hard and and especially in a work environment you've got you're like in the middle of something somebody comes over if you're going to be interrupted anyway then really be interrupted and pay attention yeah exactly yeah yeah for sure so i'll keep going just a little bit more collaboration right open source like we're we're all kind of in that space.
Starting point is 00:11:46 Anyway, willingness. Honestly, I forget what that is about. But I remember it was really good. Patience also. And then finally, institutional knowledge, right? Where to lock people up. Yeah, where the bodies are buried. No, like why do we have that old server over there?
Starting point is 00:12:03 And like can anybody work with it? Yeah, actually, I know where the source code is, and I could fix that for you, right? I don't want to. It's PHP. But I could fix it if I had to. Right. Anyway, so do these resonate with you guys? Yeah.
Starting point is 00:12:16 Let me think of, Brian, you had Stephanie, I'm forgetting her last name. Herbert. Yeah. And she talked about, I mean, your conversation over there was about mentoring, but she talked about her work approach and how she only works like four hours a day. She owns her own data compression and consultancy. But this also makes me think of a post I've seen from somebody who works with Starbucks' web applications group today.
Starting point is 00:12:43 Talked about how they pretty much almost burned out the tech industry, and they just said AI instituted some of these principles to just make things, obviously probably not only more productive at work, just more sustainable for you long-term on personal basis. Yeah, that's great. Yeah, absolutely. All right. So are we going back to World War I? No, we're actually going back to QT. Oh, absolutely. All right. So are we going back to World War I?
Starting point is 00:13:06 No, we're actually going back to QT. Oh, okay. So pretty much the trenches. Yeah. So actually, we just related to that. When I was researching for the QT Pi convert, I was curious as to how they did the conversion while leaving the code comments in place. So I followed the rabbit hole
Starting point is 00:13:27 and there's a project called Red Baron which I hadn't heard of before. But it calls itself a FST which is a full syntax tree. So it's a lossless abstract syntax tree thing which you can do queries
Starting point is 00:13:43 and modifications. And I think they've got a few uses that they list of possibly 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. A few handful of splitting like, splitting up files. There's other...
Starting point is 00:14:08 I think this is sort of maybe a tool to build other tools with. I can't imagine, like... I personally wouldn't try to, like, write a script of, like, doing this, but if I built it into an IDE or something like that... Yeah, this sounds like this is, like like the foundation of a refactoring tool. Yeah. Pretty much. That's awesome.
Starting point is 00:14:27 But there's no off-the-shelf thing that's going to do that, but maybe something like this. Yeah, that's really, really awesome. But it's a fun project. Michael, you joke about the conversion of two to three, but that's exactly what two to three, the tool, does. Yeah, no, yeah. Everyone here knows the AST module,
Starting point is 00:14:48 I hope, it's really cool. I guess they call it a full syntax tree, but it's often more broadly referred to as a CST or concrete syntax tree. Okay, nice. And so that's what two to three is based on. That's also what the new black code formatting tool that they're
Starting point is 00:15:03 talking about is based on, right? Because it has to maintain comments and all these things that otherwise go away in the AST. All right, that's awesome. Yeah, thanks. Yeah, black is awesome. We covered it before.
Starting point is 00:15:14 You got to like the color. All right, so I want to close out the official items with something pretty cool here. So our booth is right next to the Beware guys. And the Beware guys are trying to fill another major hole that I see 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,
Starting point is 00:15:43 there's like not really many demos's not a lot of screenshots. You've got to 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, installed on your phone, and it does stuff.
Starting point is 00:15:59 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, things like that. But it's really cool that there's an example of a BeWare app in the App Store. Yeah. Yeah. Is it up on the app source?
Starting point is 00: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. So the link I have I think either goes to an article or straight to the app store and it's pretty cool. So it uses briefcase and Toga and briefcase is a tool for converting a price, a Python project into a standalone native app on Mac, windows, Linux, iPad, iPhone, Android, Apple TV, and TVOS. Actually don't are those different anyway? Yeah. TV, and TVOS. Actually, are those different? Anyway, yeah, Apple TV and TVOS. Awesome. So it's pretty cool.
Starting point is 00:16:51 So it's like a first step. I was talking to Keith Russell McGee about it, and he's pretty excited, but it's just 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. And you get a cool token, like a token to say, I contributed to the B-word project.
Starting point is 00:17:12 Yeah. I was actually talking with Ken, um, Russell. Yeah. Um, and he, he,
Starting point is 00:17:18 uh, was one of the things that, that I, one of the parts of their system is a cricket, which is a, a, a testing GUI, 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.
Starting point is 00:17:34 Oh, are you going to add PyTest to Cricut? I'll look into it, but I'm bringing this up now to recruit anybody else that wants to help out with that, because I would definitely try it out more if it already had a PyTest link. Yeah, that's awesome. Yeah, you gave your talk on visual testing with PyCharm, which is awesome. And it's going to be on one of the stuff that I'm going to mention in a second. But that's sort of another analogous thing, right? Like a GUI for running your tests in your project.
Starting point is 00:18:03 Yeah, so we use PyCh um for the test runner part but this would be just a standalone test runner without an ide yeah exactly no editing just the running yeah right it's easier to fix the test if you don't have to add in all right well i think that's it for all of our items that we have for you guys this week i have a few extra things i want to throw out actually this one more and more to the listeners uh so first of all all the videos except for things like this are recorded and put online so already the videos from pycon 2018 are live and people can check them out right there's some yeah not all of them but they're coming in there's a day or two latency there that's pretty good, though, for video. So just go to youtube.com slash PyCon 2018. The other one is not
Starting point is 00:18:48 so good. Apparently there was some package that caused some trouble. Previously, remember we talked about there being bad packages getting into the app store? Not app store, the PyPI. So there's some Reddit post that says, hey guys, you should be a little bit
Starting point is 00:19:03 careful with the SSH-Decorator package. It says, don't install it or use it from PIP. It has a back door to steal all your SSH credentials. If that's true, you should not have this running anymore and you should
Starting point is 00:19:19 uninstall it. I don't know, but the people say the compromise package has been taken down. They reached out to the developers and initially there was no response, but apparently it's gone now. So you can't update it, but if you already have it you should not have it anymore. So just like
Starting point is 00:19:36 a sort of PSA, public service announcement. Don't use that. Yeah. Anything else you want to add, Brian? No, I'm just having a great time at pycon yeah pycon pycon is awesome i call this my geek holiday right i 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 i need to rest no you need to take the kids to do this to do that it's all right but uh
Starting point is 00:20:00 yeah i really love coming here and like i really look forward to meeting everybody and having these experiences. It's exhausting. It is exhausting. In an amazing way. I can't talk with nerd stuff all day long and then go out and have dinner and drinks with nerds all day long. I had to have cocktails yesterday.
Starting point is 00:20:15 It was really hard. All right. So how about everyone in the audience, you guys want to just close it out, say goodbye from PyCon? Goodbye from PyCon. Thank you everyone for listening. Thank you for being here for this live recording. Thank you for listening to Python Bytes.
Starting point is 00:20:40 Follow the show on Twitter via at Python Bytes. That's Python Bytes as in B-Y-T-E-S. And get the full show notes at PythonBytes.fm. If you have a news item you want featured, just visit PythonBytes.fm and send it our way. We're always on the lookout for sharing something cool. On behalf of myself and Brian Auchin, this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

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