« Return to show page
Transcript for Episode #198:
There's a beaver in your database and Anna-Lena drops by
00:00 Hello, and welcome to Python bytes where we deliver Python news and headlines directly to your earbuds. This is Episode 198. Recorded August 31 2020. I am Brian Aachen. I'm Michael Kennedy. And we're joined by a guest. We have annalena publicus. Jerry. That's very correct. Wonderful. She's been on Michael's talk Python podcast a couple times. Absolutely. Or at least one depends how far out in the future I think, in the future twice. We've already recorded a couple shows together. But it's, you know, we've got quite a buffer there. So this won't be up before. So one and two times. And welcome to this show. Nice to see you. Yeah. Thanks for having me. I'll kick it off with the first topic. Give us something easy. Don't make it hard. Brian, come on. Yeah, actually. So when I remember, it's been a while since I shifted to thinking about Python as a scripting language, to as a full blown language to do like everything big applications and stuff. Of course, I still do both. I use it for a quick scripting language, but also more meaty things. But back in the day, when I was using bash, if I wanted to have a little script to do with arguments, I'd have like an example bash file that I would just keep copying from. And I was thinking about that, because I never remember how to do arguments and stuff and parameter passing through into a little script. And the same is true for Python with argparse. But we have of Google Now to find that information out. But I was thinking about that when I saw this, this comment on Twitter. It's from Joshua raver. And he said, Every time I write a Python script, I have to go back to an old script of mine, to remember how to set up argparse. For some reason, it just doesn't stick in my mind at all. And then, Ken yawns Clark, I think he's been on your show, hasn't he? Michael? I know, I don't think so. Okay, probably should be, but hasn't, he commented. And he said, I've got this little utility called the new.pi. So I went and checked it out. And I'm pretty happy with it. It's not something you can pip install. And we're gonna link to it in the show notes. It's just part of it. He's got a repo for it. And I think he uses it in a book that he wrote. But basically, what it does is you, you run it and give it a file name. And it gives you a little starter script. With all our stuff with examples. You've got an example positional argument, string, argument, integer argument, file argument, and a Boolean flag. So you don't have to look that stuff up. They're already there as dummy ones. And then you can, you know, add to it and whatever, delete the stuff you don't want. So just in, if you've got this around, you can use it to spin up a new script really easily. And he also just recently added test code for it. So if you pass it a dash T, it'll generate a little stub test file, so you can test your script with it, too. So anyway, if you're using Python for scripting, I think this is a good thing to look at. I love that I have the same problem every time. I always copy it from an old script every time
03:01 thinking the same thing like what is one of the big difference between beginners and experts, experts have a whole bunch of these old things that can be
03:09 well, I often use, so I'm used to usually using click or what's the other one that's hyper hyper business? Yeah, so I'm usually using those for larger applications. But there's a lot of times where you're passing, you have a shared script that you don't really want to have install anything extra. So our purses still something to use for a lot of stuff. Yeah, very cool. Yeah, if you don't want arguments as our dependencies, this is a great example there. Because if your script could literally run without a pip install or without a virtual environment, except for that, you know, I probably would just have a slightly more cumbersome bit of code and have it easy, easy to run, you know, I've been thinking about how I should really be building more Seelye based applications. And I have an insane number of these little what I would really call scripts, they're not applications. They're like, little tools that I just use to run all the stuff around my company. So for example, one that I wrote last week was I had a company that did transcripts for the video courses, and then they stopped doing that. That's fine. They they moved on to doing other things, but all of a sudden, I had to figure out what how do I get transcripts again, so I wrote a little script that would go find all of the videos in a course see if it was missing transcripts, go and use AWS transcribe and just say the videos in AWS s3, do this and then download it and turn it into sentences and subtitles and video. So there's like 50 of these and I'm at the point where I almost think I might just make one command line option to run every one of those scripts, right? like kind of like get with sub command like PP space, transcripts, TV space, video and code, right. Like, I'm almost ready to build this huge sale. I think I probably won't use argparse they'll probably use typar. Yeah, sounds like good idea. Yeah, exactly. Because I always forget I'm like did I write that
05:00 What's it called? How do I run it again, to track it down. So this next one comes to us from a listener. excema is the username. I didn't get a first last name. So thanks for sending that over. And it's called D beaver DB either, something like that. So it's for databases and has to do with beavers. So DB beaver database UI tool. And something about working with databases inspires people to use animal names or creature names. So this is d Beaver. And the one that I mentioned that that started got axioma saying, Hey, this is cool. But you should also check this other one out, is I mentioned email@example.com, which is really, really cool. So here's another cool free open source database GUI tool. So if you got to work with databases, this looks like a really nice one. Yeah, it looks pretty cool. Yeah. You know, it doesn't have the full on marketing. Beautiful page. Like if you go to beekeeper studio, sorry, beekeeper studio.io. Man, that thing looks like it could be a VC funded startup like landing page, right? Where's the beaver is nice, but it doesn't. It doesn't look like ultra polish. But it's based on Eclipse. And it supports 80 different database types. So obviously, the popular ones like MySQL, Postgres SQL lights, Microsoft SQL Server, and so on, but a whole bunch of other ones as well. So, yeah, if you got to work with databases, and you want some kind of UI tool, this looks like a pretty good option. Do you have an idea why they called it beaver? I have no idea why they call them fever. It's funny sometimes since in machine learning, they had a trend that they named the models like Sesame Street to say Sesame Street. Yeah, yeah. Yeah. And they started calling them bird rover and Big Bird. And yeah, and someone started it. And then the others just continued naming the models like that was a lot of fun. Yeah, it's really fun. Last episode, which is not yet so there's no way you would have heard this. But we were talking about something on Debian it was going through the Python Docker script and like, understanding what of what it means to like create a bare bones Python system. And under that, Debbie and named their releases after Toy Story characters.
07:22 I like that. Yeah, that's nice. And of course, you are doing all of your stuff with 100 days of code and Harry Potter, right, which is also pretty awesome. But there's not really releases for that. Is there? Nope.
07:34 So let's see. So a couple more things that are interesting about dbeaver is it got a nice GUI interface, it has dark mode, light mode, and whatnot, has support for cloud data sources. So if you're going to connect to I'm presuming things like hosted databases, like SQL Azure, or something like that, but it also has extensions that allow you to work like directly between databases and Excel, or databases and get, which I think is pretty cool. And it also will build UML activity diagrams, like show me the relationships of this table, you know, where the foreign keys go, and all the things like that visually, which pretty nice if you're just like, given a project, here's the database, or, oh, what the heck did I just get? Right? You could open it up and something like this. You know, Python Pro has something along those lines as well. But this is free and open source. So that's pretty cool. Yeah, I use the one for Python pro for in the diagramming helps a lot to be able to visualize what your data is doing. Totally agree. I use it all the time. Yeah. All right. Well, that's it for the Beaver. I think it's cool. And people can check it out compare with beekeeper studio. Great. So I want to talk about PDB plus plus. So I was always using the ipython debugger, then when debugging, but I recently switched from using I PDB to PDB plus plus. So PDB is the Python debugger like the normal one that's part of the standard library. And PDB plus plus is an extension of that. So it's fully compatible with PDB. But it has some pretty nice features. And I think they improve the debugging experience quite a bit. It's very easy to install. So you just type pip install PDB PP, since PDB plus plus is not a valid, valid package name. And I have two favorites, like it has quite a few additional commands and features compared to PDB. But it has you the all the usual commands that are also part of a PDB. So it's very easy to switch. But there is the sticky mode, which I like a lot. So the official description is that when you're in the sticky mode, every time you change the current position, the screen is repainted and then the whole function is shown. So when doing step by step debugging, it's very easy to follow the flow of execution and I constantly use that feature, since I find it very annoying to always type l or double l to see the code
10:00 And with a sticky mode, you can just always follow along with the code and the flow of execution. I like that a lot. And then there is smart command pausing, which I also like. So if you have, or if you're using PDB, it always tries to interpret the commands you enter as one of the built in commands, which can be quite inconvenient in some situations. For example, if you want to print the value of a local variable, and that one happens to have the same name as one of the commands, for example, you know, yeah, that could, and I had that quite a few times. So for example, if you call something p or C, and then you want to print the value of that variable, but it is interpreted as the command continue, which is C is short for continue. And I think PDB plus plus has quite a nice solution for that. So when there is ambiguity, so if you have a variable with the same name in the current scope, then that variable is preferred. And if you still want to run the command, you can just prefix it with two exclamation marks. But if you don't have any ambiguity, and you type C, then it will always be continue. And I find that very convenient. Oh, yeah, that seems like a great little feature. in there just runs in the terminal. Right. So you can run it anywhere that you have. Yeah, yeah. SSH access to or something to that effect. Yeah, I think it's a very nice package. Maybe this is a dense question. But why use this over like an ID? Oh, I just always used them. And that's why I got so used to using them that I find it very convenient to use PDB, or I PDB or not PDB? Plus, I guess I would have to start using an ID properly to really be able to appreciate it. But it's hard if you got so used to using your keyboard and you a few keyboard shortcuts. And yeah, I don't think I can switch back to an ID for a while. Okay. Yeah, it has some cool features as well down here. Like one of the things is, if there's a an exception, you can ask it for a post mortem report. And it'll give you like, extra details in there. You can also do stuff like break on set attribute. So if some kind of attribute is set, which is I guess, a little bit like a conditional breakpoint and say an ID or whatever, but yeah, it looks pretty cool. I like the fact that it has syntax highlighting and color and all that. Yeah, autocomplete I know that it can requite nice and an ID to I think on the last talk Python episode. It was on the Python. How was that episode? It was called the modern Python developers toolkit by Sebastian widthwise. Yeah. And you talked about Visual Studio. And yeah, yeah, I know that they it has quite a few features, as well. But when you're used to something like I PDB, this is a very nice addition. Yeah, yeah, absolutely. And you can also, what's the double exclamation point? thing? So you mean what I just mentioned with the command? Yeah, yeah. When would I run that? So if you have like a variable C, and that has some value, so it's a local variable, but you want to run continue on this case? I see. Then you would have two exclamation marks and the C Yeah. So that's why it's it skips it. Okay, got it. Yeah. Cool. All right. Yeah, this, you know, I live largely in the ID world. But if I needed I needed to do some debugging outside of it. This is a really nice option, I think, like maybe in a Docker container, and I don't want to set up like remote debugging and all that kind of stuff. I just want to run it. What's it doing now? this cool, nice. Oh, yes. Today's sponsor is us. So make you us.
13:59 Thanks, guys. We'll probably have to edit that section. Today's sponsor is both talk Python training and testing code podcast as well. I wanted to highlight I had some, I think last episode, I mentioned that Adam Johnson, which hadn't actually he hadn't actually been on our show yet. But the last episode of testing code 128. I did have Adam Johnson on. He is the maintainer of pi test randomly. And so we talked about what the importance of randomizing your tests to make sure that you have ordered dependent order independent tests. So that's a good episode. But we talked about all sorts of stuff on testing code, including things like tips for working from home that was on episode 127. So check it out. I think people are doing that more than I used to for some reason. I'm not really sure why working from home. Yeah, definitely. Yeah, that sounds great. And talk Python training. Yeah, we just released a brand new course move from Excel to Python and pandas. So if you have been trying to over
15:00 Do all this stuff that you do with around data with Excel or people you work with are, we created a course written by Chris Moffitt, from practical business Python, to basically go through all the main use cases of Excel and show how much easier it is to do that in Jupiter and pandas. I think it'll help a lot of people get your foot in the door in the Python world. I think that's really cool. I always wanted to learn XML. But it's so much nicer with Python that I never got around to doing it. Yeah, that's perfect. That's that's the good side to be on. Not the other side. Yes. Awesome. So Brian, tell us about a markdown, I really like markdown, I use it for a whole bunch of stuff. And when I mean, I so much so that I just kind of assume everybody's using markdown now. But sometimes people have trouble getting up to speed or you want to share something. Anyway, I came across, I was actually having a Twitter discussion with somebody. And they brought up this hack md.io tool, and hack MD, I've never heard of that. So I went to check it out. And I'm pretty impressed with it. It's pretty cool. It is a paid service. But there's a free option too. So of course I'm on the free option. But the idea is just sort of, you've got that similar, there's a lot of tools that do this, you got a two panel system, where you on the left you your mark down on the right, it shows up, and you can hide one or the other. But the what I really like is some of the stuff that I always forget, like how to do how to insert a picture or do a table of contents or put reference links in or or footnotes, those things are just sort of in there with menu items. So I don't have to remember what all those markdown codes are. They just added apparently, you can collaborate and have multiple people editing a document with this. So that's pretty cool. There's some fancy extra things like UML diagrams that you can add in and I'm not sure if you're exporting it, you'll have to try to figure out what sort of extra tools you need to actually generate those. But it's pretty fun. The thing that I like that they just added recently, apparently is you can sync with GitHub. So you can keep all your markdown documents in GitHub, and edit them with with hack MD. That's pretty, pretty fun. That's awesome. The other thing I found was this thing called markdown guide. And it is just a just a really good clean reference for markdown. So I'm going to there's I had, you know, a handful of different references that I was using, but I think I'm going to switch to this one because there's tabs that have like a getting started page that I can send people to. And a couple cheat sheets, one of them was is the most common things. And I think it's pretty, pretty indicative of common things you'll use, and then an extended syntax page with and then a bunch of tools you can use. So a couple markdown references for people. Have you ever used pen doc? Oh, yeah, I love pan doc. Yes, since I recently started using it. And I'm preparing my presentations. Now, with pen doc every time and I love it. It's just great, great tool I love about pandadoc is it's not just from markdown to HTML, but you can convert to media wiki or lots of or I use it. A lot of times to format my emails correctly in the Microsoft Office, I will write them in markdown and then use pandadoc to generate the the word doc version, and then copy and paste into an email. I know it's a backwards, lots of steps, but it works for me. Yeah, you know, it'd be nice to have just a HTML email editor that just takes straight markdown. Would that be cool? Yeah, that would be cool. And then really like an extension to Microsoft Outlook that had them keybindings definitely have the awesome programmers are invading outlook. Yeah. Some other cool stuff about markdown or hack, markdown and hack MD, is it has a VS code extension. And like you said, the GitHub integration is cool. And it's a browser extension. You could turn your notes into a slide deck, you can turn it into like a research project into like, what they call book mode. Yeah, looks pretty interesting. And the collaboration is definitely needed around markdown these days. Like there's not really a great collaborative place that I know of, although I'm sure listeners are going to send us five examples, which is awesome because they always they always do. But for example, like we can do this. Yes you you can export paper from Dropbox, paper, paper dot Dropbox calm as markdown but it's not full fidelity. It's like 85% and you can edit what you get, but it's still it's better than nothing. But yeah, this looks cool. Nice. You know, it's not cool. Python malware. That's the thing is it apparently does now a thing. So honor fester? For sure. Sorry. I sent in this interesting article, which was done with this and by it was one second Cyborg security. So these guys wrote a pretty cool article about
20:00 I would probably say editors, like often and not often. Okay, anyway, so what is editors? It's so I only I think I saw it a few times before, but I've never actually looked into the package. But now a few weeks back, I've started using it for the first time. So what is etters? It's a Python package that simplifies writing classes. So it creates a lot of the Dunder methods automatically. Yeah, that's cool. Yeah. And when I first saw it, I thought, we have data classes. So why do we need editors, and only then I realized that editors is much older than data classes. So Pep, 557, edit data, data classes to Python 3.7. And they do resemble editors, in many ways. So when I started reading a bit on the documentation page of editors, I found out that the pep was actually inspired by actors. And it was the result of the come of the wish of the community to have a simplified way to write classes without having to deal with the problems that name tuples have. And the I think the main difference between actors and data classes is that data classes are strictly less powerful. And that certain features were sacrificed for the sake of simplicity. So it's very easy to use data classes, they are part of, I think, 3.7 with 3.7, they come automatically, but if you have 3.6, you have to pip install them, but you don't have to get a new package for them. And it's very easy to use them, especially if you have classes with many attributes. But with utters, you have quite a few additional features, for example, you have validators and that you can use when you have your initializer in the class, and you want to perform some kind of validation of the input arguments, like checking that they are an integer, or some other type or more fancy stuff, then you can do that very easily with editors. And it's a very powerful library. So I think I need a lot more weeks to really get into the details and all its possibilities. Yeah, that's a good one. There's a lot of subtleties around creating classes that you're, that can be a little bit annoying. Like, wouldn't it be great if you could have it print out something other than just the name of the class at some memory address automatically, that would be nice. If you create a Dunder equal Dunder EQ method, where you got to remember to create the not equals, that is the opposite of that. And oh, if you create equals, maybe you also have to implement hash as well, because all of a sudden, if two things are equal, you put them in the dictionary, but then they're not the same thing. That's gonna be all sorts of crazy. It just starts to cascade. You're like, wait a minute to win this, right? It's not so easy. And so I think that's the kind of the Zen of the adders. Yeah, I found it a bit confusing in the beginning with the syntax, how it looks like if you declare an attribute, like it's a decorator utters, but then for the attributes of the class, you have this is it etters dot s, or something. And I found that a bit confusing in the beginning, since data classes are, I think, more beautiful when you write them, and you don't need to this extra bit. But once you get used to the syntax, it's very nice and easy to use, I have to agree. I like the data class syntax better. The darkness of the adders. syntax is cute, but bugs me a little bit like a trip attributed at the attributes firstname.lastname@example.org. And it's not something I really enjoy. But it's not difficult either. The main switch for me, I think, is now now that data classes are here, I use data classes all the time. But when I need a validator, the validation mechanism in attars is, is pretty darn cool. So if you want data validation, adders, is still a great thing to pull up. I agree. I really wish the validators were in, or at least, maybe there, we could have a an extra package that could we could pip install or something that that would make data classes have validators. Hopefully, I know, there's other things that you can do to validate schemas and stuff like that. I feel like there's a little bit of a Paradox of Choice. Like you look at all these things, and you want all of the features that like kind of in this impossible, combined way. So adders is cool. They've got things like that, you can say that. These attributes can only be set as keyword arguments in the initializer, and not as positional arguments. And just kW only equals true stuff like that, which is pretty cool. And then you've got the pedantic models, which have, like built in validation for all sorts of types, just cool. You've got data classes, those can be frozen, which is kind of nice. There's a lot of stuff going around here and I feel like I'm under utilizing all of it.
20:00 Grab what you need. It's good. Yeah, there's some tests around it and switch later. For me, it's sometimes just easy to forget what's out there, since there are so many nice packages, and I sometimes hear like, I listened to a podcast. And then I think, oh, that package sounds cool, but I don't have an application for it right away. So I forget about it again. And then in some context, I hear about it again, I think, Oh, yes. You always wanted to try that. But I think at least with actors Now, like I will use it again quite a few times. Yeah, I have that same problem. I get excited about all these things, but I don't have a chance to use them. And then I I forget, then I'll rediscover like, Oh, yes. That's why I thought it was cool. In the first year, you should create a Harry Potter style project yourself. I'm trying out all these things. That's right, like awesome. Harry, Python, Harry Potter Python.
20:00 I would work on. I like Harry Python.
20:00 They might invoke images that are not exactly the same what you're thinking. Oh, yeah. Okay. Nevermind. Yeah. All right. Well, you guys got anything extra? I don't Ryan. No extras? No, no, I may, Elena may maybe take a moment. Just tell folks like what you're up to. We didn't give you a really introduction on the kind of work and stuff you're doing. Yes. So I think the first time Michael and I talked on talk Python to me, I was still an AI resident at Microsoft Research in Cambridge. So I was doing a lot of machine learning, research. So working in the middle between a full researcher and a full software engineer. And now I'm a machine learning engineer here in Germany, in a company called innovex. Where I do like, I apply machine learning to project proper real world problems, which is also very interesting. And I do all kinds of stuff. Now, data engineering. So yeah, I'm always learning new things every day, which is really nice. Yeah, that's very cool. All right, I've got a couple of things really quick to share. I was on a cool podcast, TV like show called tech, NATO, which was a cool experience. It's a little bit like Python bytes, but for the it space. So that was a lot of fun to be on there. And on YouTube, you can check it out. And we played the game Python, Python, Python, where we would get partial words out of a headline, we have to decide, is it Python, the snake, Monty Python or Python, the programming language that the article is about? That was pretty fun. So you could check that out over there,
20:00 sir, so did you win? I completely got crushed. I think I got last because I want everything to be about Monty Python. And they're like, no, that's about a snake. I'm like, Oh, come on. That should have been. I would have been so funny if that was about money, Python. But no. Yeah, I let my hopes and dreams. get ahead of me. Maybe next time. Exactly. I'll come back for the championship later. I Brian, what do you think about this joke? I haven't looked at it out perfect. And you got to open it up. And Elena is is well, this one is, as per usual for us a visual joke and an audio format. But I think it's going to work great. So this one is called the only valid measurement of code quality. And I know Brian, you're very passionate about high quality code and testing and stuff like that. Have you seen this metric built into any of the software you've used? You can
20:00 maybe do some voice recognition and sim AI and Alaina could put something together for us like starting the code review.
20:00 It looks so funny. I love that. Yeah, so this is the only valid measurement of code quality is WTF per minute. I'll try to keep this with out the explicit tag but WTF. So there's a comparison here. On one hand, we've got the good code review, which is still like it's like a door that's closed. You can just see like statements of what people's going on. It's got on the side here this WTF WTF, what is this? That's the good code. The bad code is just full of them. It's like WTF what WTF is this a dude, WTF? wtf. I think this really captures code review pretty well. It does.
20:00 Anyway, the only valid of measurement Oh, quality Ws per minute, the BTS per minute. Definitely. All right. Well, that wraps it up for this week. All right. Thanks, Brian. Thanks, Elena for being here. Thanks. It was a lot of fun. Yeah, you bet. Bye. Bye. Thank you for listening to Python bytes. Follow the show on twitter at Python bytes. That's Python bytes as in V yts. And get the full show notes at Python byte set FM. If you have a news item you want featured just visit by thumb bytes.fm and send it our way. We're always on the lookout for sharing something cool. This is Brian Aachen and on behalf of myself and Michael Kennedy, thank you for listening and sharing this podcast with your friends and colleagues.