Transcript #198: There's a beaver in your database and Anna-Lena drops by
Return to episode page view on github00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to
00:04 your earbuds. This is episode 198, recorded August 31st, 2020. I am Brian Okken.
00:11 I'm Michael Kennedy.
00:12 And we're joined by a guest. We have Annalena Popkus.
00:15 Yes, that's very correct.
00:17 Wonderful. She's been on Michael's Talk Python podcast a couple of times.
00:22 Absolutely.
00:22 Or at least once.
00:23 It depends how far out in the future. I think in the future twice. We've already recorded a
00:28 couple shows together, but we've got quite a buffer there. So this one will be out before.
00:32 So one and two times. And welcome to this show. Nice to see you.
00:36 Yeah, thanks for having me.
00:37 I'll kick it off with the first topic.
00:39 Give us something easy. Don't make it hard, Brian. Come on.
00:41 Yeah, actually. So when I remember, it's been a while since I shifted of thinking about Python
00:47 as a scripting language to as a full-blown language to do everything, big applications and stuff.
00:54 Of course, I still do both. I use it for a quick scripting language, but also more meaty
01:00 things. But back in the day when I was using Bash, if I wanted to have a little script to do with
01:06 arguments, I'd have like an example Bash file that I would just keep copying from. And I was thinking
01:13 about that because I would never remember how to do arguments and stuff and parameter passing through
01:17 into a little script. And the same is true for Python with arg parse. But we have Google now to find that
01:24 information out. But I was thinking about that when I saw this comment on Twitter. It's from Joshua
01:31 Schreiber. 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
01:38 up arg parse. For some reason, it just doesn't stick in my mind at all. And then Ken Yewans Clark,
01:44 and I think he's been on your show, hasn't he, Michael?
01:48 No, I don't think so.
01:49 Okay.
01:49 Probably should be, but hasn't.
01:50 He commented and he said, I've got this little utility called the new.py. So I went and checked it out and I'm pretty happy
01:59 with it. It's not something you can pip install and we're going to link to it in the show notes. It's
02:03 just part of, he's got a repo for it. And I think he uses it in a book that he wrote, but basically what
02:10 it does is you, you run it and give it a file name and it gives you a little starter script with all
02:16 arg parse stuff with examples. You've got an example, positional argument, a string argument,
02:21 integer argument, file argument, and a Boolean flag. So you don't have to look that stuff up.
02:26 They're already there as dummy ones. And then you can, you know, add to it and whatever,
02:31 delete the stuff you don't want. So just in, if you've got this around, you can use it to
02:36 spin up a new script really easily. And he also just recently added test code for it. So if you
02:43 pass it a dash T, it'll generate a little stub test file so you can test your script with it too.
02:50 So anyway, if you're using Python for scripting, I think this is a good thing to look at.
02:55 I love that. I have the same problem every time. I always copy it from an old script every time.
03:00 I was thinking the same thing. Like what is one of the big difference between beginners and experts?
03:06 Experts have a whole bunch of these old things they can go copy from.
03:09 Well, I often use, so I'm usually using click or what's the other one that's...
03:14 Typer. Typer.
03:15 Typer's the business.
03:16 Yeah. So I'm usually using those for larger applications, but there's a lot of times where
03:22 you're passing, you have a shared script that you don't really want to have install anything extra.
03:27 So ArgParse is still something to use for a lot of stuff.
03:30 Yeah. Very cool.
03:31 Yeah. If you don't want arguments, I'm sorry, dependencies, this is a great example there.
03:36 Because if your script could literally run without a pip install or without a virtual environment,
03:40 except for that, you know, I probably would just have a slightly more cumbersome bit of code
03:45 and have it easy, easy to run, you know?
03:47 Yeah.
03:47 I've been thinking about how I should really be building more CLI-based applications.
03:52 And I have an insane number of these little, what I would really call scripts.
03:58 They're not applications.
03:59 They're like little tools that I just use to run all the stuff around my company.
04:04 So for example, one that I wrote last week was I had a company that did transcripts for the video
04:11 courses and then they stopped doing that.
04:13 You know, it's fine. They moved on to doing other things, but all of a sudden I had to figure out,
04:17 well, how do I get transcripts again?
04:18 So I wrote a little script that would go find all of the videos in a course,
04:23 see if it was missing transcripts, go and use AWS transcribe and just say the videos in AWS S3,
04:31 do this and then download it and turn it into sentences and subtitles and video.
04:35 So there's like 50 of these.
04:37 And I'm at the point where I almost think I might just make one command line option to run
04:42 every one of those scripts, right?
04:44 Like kind of like Git with sub commands, like TP space transcripts, TP space video and code,
04:50 right?
04:50 Like I'm almost ready to build this huge CLI thing.
04:53 And I probably won't use arg parse though.
04:55 I'll probably use typer.
04:56 Yeah.
04:56 Sounds like a good idea.
04:57 Yeah, exactly.
04:58 Cause I always forget.
04:59 I'm like, did I write that?
05:00 What's it called?
05:00 How do I run it again?
05:01 To track it down.
05:03 So this next one comes to us from a listener.
05:06 Exuma is the username.
05:08 I didn't get a first last name.
05:10 So thanks for sending that over.
05:12 And it's called D beaver, D beaver, something like that.
05:18 So it's for databases and has to do with beavers.
05:21 So D beaver database UI tool.
05:24 And something about working with databases inspires people to use animal names or creature names.
05:31 So this is D beaver.
05:34 And the one that I mentioned that started got Exuma saying, Hey, this is cool, but you should also check this other one out is I mentioned beekeeper at beekeeper.io, which is really, really cool.
05:44 So here's another cool free open source database GUI tool.
05:50 So if you got to work with databases, this looks like a really nice one.
05:53 Yeah, it looks pretty cool.
05:54 Yeah.
05:54 You know, it doesn't have the full on marketing, beautiful page.
05:59 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?
06:07 Whereas D beaver is nice, but it doesn't have, it doesn't look like ultra polish, but it's based on a clips and it supports 80 different database types.
06:16 So obviously the popular ones like my SQL, Postgres, SQL lights, Microsoft SQL server, and so on, but a whole bunch of other ones as well.
06:26 So yeah, if you got to work with databases and you want some kind of UI tool, this looks like a pretty good option.
06:32 Do you have an idea why they called it beaver?
06:34 I have no idea why they called it beaver.
06:36 It's funny sometimes since in machine learning, they had a trend that they named the models like Sesame Street.
06:42 Do you say Sesame Street?
06:43 Yeah, yeah, yeah, yeah.
06:44 And they started calling them bird.
06:46 Like Grover and Big Bird and all this kind of stuff.
06:49 Yeah, and someone started it and then the others just continued naming the models like that.
06:56 It was a lot of fun.
06:58 Yeah, it's really fun.
06:59 Last episode, which isn't out yet, so there's no way you would have heard this, but we were talking about something on Debian.
07:07 It was going through the Python Docker script and understanding what it means to create a bare-bones Python system.
07:14 And you found out that Debian names their releases after Toy Story characters.
07:21 I like that.
07:23 Yeah, that's nice.
07:24 And of course, you were doing all of your stuff with 100 Days of Code and Harry Potter, right?
07:29 Which is also pretty awesome.
07:30 But there's not really releases for that, is there?
07:33 No.
07:34 So let's see.
07:35 So a couple more things that are interesting about DBeaver is it's got a nice GUI interface.
07:40 It has dark mode, light mode, and whatnot.
07:42 It has support for cloud data sources.
07:45 So if you're going to connect to, I'm presuming things like hosted databases like SQL Azure or something like that.
07:51 But it also has extensions that allow you to work directly between databases and Excel or databases and Git, which I think is pretty cool.
07:59 And it also will build UML entity diagrams, like show me the relationships of this table, you know, where the foreign keys go and all of the things like that visually, which is pretty nice.
08:10 If you're just like given a project, here's the database.
08:12 You're like, oh, what the heck did I just get?
08:14 Right.
08:14 You could open it up in something like this.
08:16 You know, PyCharm Pro has something along those lines as well.
08:19 But this is really an open source.
08:21 So that's pretty cool.
08:22 Yeah, I use the one for PyCharm Pro for and the diagramming helps a lot to be able to visualize what your data is doing.
08:29 Totally agree.
08:30 I use it all the time.
08:31 Yeah.
08:31 All right.
08:31 Well, that's it for DBeaver.
08:33 I think it's cool.
08:33 People can check it out and compare it with Beekeeper Studio.
08:36 Great.
08:37 So I want to talk about PDB++.
08:39 So I was always using the IPython debugger when debugging, but I recently switched from using IPDB to PDB++.
08:49 So PDB is the Python debugger, like the normal one that's part of the standard library.
08:55 And PDB++ is an extension of that.
08:59 So it's fully compatible with PDB, but it has some pretty nice features.
09:04 And I think they improved the debugging experience quite a bit.
09:08 It's very easy to install.
09:10 So you just type pip install PDBPP, since PDB++ is not a valid package name.
09:18 And I have two favorites.
09:20 Like it has quite a few additional commands and features compared to PDB, but it has all the usual commands that are also part of IPDB.
09:31 So it's very easy to switch.
09:33 But there is the sticky mode, which I like a lot.
09:36 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.
09:46 So when doing step-by-step debugging, it's very easy to follow the flow of execution.
09:52 And I find it very annoying to always type L or double L to see the code.
10:00 And with the sticky mode, you can just always follow along with the code and the flow of execution.
10:07 And then there is smart command parsing, which I also like.
10:11 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.
10:24 For example, if you want to print the value of local variable and that one happens to have the same name as one of the commands, for example.
10:33 Oh, no.
10:34 Yeah, that could.
10:35 And I had that quite a few times.
10:37 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.
10:51 And I think PDB++ has quite a nice solution for that.
10:55 So when there is ambiguity, so if you have a variable with the same name in the current scope, then that variable is preferred.
11:05 And if you still want to run the command, you can just prefix it with two exclamation marks.
11:10 But if you don't have any ambiguity and you type C, then it will always be continue.
11:15 And I find that very convenient.
11:17 Oh, yeah.
11:18 That seems like a great little feature.
11:19 And it just runs in the terminal, right?
11:23 So you can run it anywhere that you have SSH access to or something to that effect.
11:27 Yeah, I think it's a very nice package.
11:30 Maybe this is a dense question, but why use this over like an ID?
11:35 Oh, I just always use Vim.
11:37 And that's why I got so used to using Vim that I find it very convenient to use PDB or IPDB or now PDB++.
11:48 I guess I would have to start using an IDE properly to really be able to appreciate it.
12:01 And yeah, I don't think I can switch back to an IDE for a while.
12:08 Yeah, it has some cool features as well down here.
12:11 Like one of the things is if there's an exception, you can ask it for a postmortem report and it'll give you like extra details in there.
12:24 You can also do stuff like break on set attribute.
12:27 So if some kind of attribute is set, which is, I guess, a little bit like a conditional breakpoint and say an IDE or whatever.
12:34 But yeah, it looks pretty cool.
12:36 I like the fact that it has syntax highlighting and color and all that.
12:40 Yeah.
12:40 And autocomplete.
12:41 I know that it can be quite nice in an IDE too.
12:44 I think on the last Talk Python episode, it was on the Python.
12:49 How was that episode called?
12:50 It was called the Modern Python Developers Toolkit by Sebastian Witwaski.
12:55 Yeah.
12:55 And you talked about Visual Studio.
12:58 And yeah, I know that it has quite a few features as well.
13:03 But when you're used to something like IPDB, this is a very nice addition.
13:07 Yeah.
13:07 Yeah, absolutely.
13:09 And you can also, what's the double exclamation point thing?
13:12 So you mean what I just mentioned with the command?
13:16 Yeah, yeah, yeah.
13:16 Like when would I run that?
13:17 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 in this case.
13:26 Oh, I see.
13:26 Then you would have two exclamation marks and the C.
13:29 Yeah, so that's why it skips it.
13:31 Okay, got it.
13:32 I understand now.
13:33 Cool, cool.
13:33 All right.
13:34 Yeah, this, you know, I live largely in the IDE world.
13:38 But if I needed to do some debugging outside of it, this is a really nice option, I think.
13:43 Like maybe in a Docker container.
13:46 And I don't want to set up like remote debugging and all that kind of stuff.
13:49 I just want to run it.
13:50 What's it doing?
13:51 Yeah, that's cool.
13:52 Nice.
13:52 Oh, yes.
13:53 Today's sponsor is us.
13:55 So thank you, us.
13:57 Thanks, us.
14:00 We'll probably have to edit that section.
14:02 Today's sponsor is both Talk Python training and Test and Code podcast as well.
14:08 I wanted to highlight.
14:10 I had some, I think last episode I mentioned that Adam Johnson, which hadn't actually, he
14:17 hadn't actually been on our show yet.
14:18 But the last episode of Test and Code 128, I did have Adam Johnson on.
14:23 He is the maintainer of pytest randomly.
14:26 And so we talk about what the importance of randomizing your tests to make sure that you
14:30 have order dependent, order independent tests.
14:33 So that's a good episode.
14:35 But we talk about all sorts of stuff on Test and Code, including things like tips for working
14:40 from home.
14:41 That was on episode 127.
14:42 So check it out.
14:43 I think people are doing that more than they used to for some reason.
14:46 I'm not really sure why.
14:47 Working from home?
14:48 Yeah.
14:48 Yeah, definitely.
14:49 Yeah, no, that sounds great.
14:51 And Talk Python Training.
14:52 Yeah, we just released a brand new course, Move from Excel to Python and Pandas.
14:57 So if you have been trying to overdo all the stuff that you do around data with Excel
15:03 or people you work with are, we created a course written by Chris Moffitt from Practical
15:08 Business Python to basically go through all the main use cases of Excel and show how much
15:14 easier it is to do that in Jupyter and Pandas.
15:16 And I think it'll help a lot of people get their foot in the door in the Python world.
15:20 I think that's really cool.
15:21 I always wanted to learn Excel, but it's so much nicer with Python that I never got around
15:27 doing it.
15:28 Yeah, that's perfect.
15:28 That's the good side to be on, not the other side.
15:31 Yes.
15:32 So Brian, tell us about Markdown.
15:36 I really like Markdown.
15:37 I use it for a whole bunch of stuff.
15:40 And when I mean, I so much so that I just kind of assume everybody's using Markdown now.
15:45 But sometimes people have trouble getting up to speed or you want to share something.
15:50 Anyway, I came across, I was actually having a Twitter discussion with somebody and they
15:56 brought up this HackMD.io tool.
15:59 And HackMD, I've never heard of that.
16:01 So I went to check it out and I'm pretty impressed with it.
16:05 It's pretty cool.
16:06 It is a paid service, but there's a free option too.
16:08 So of course I'm on the free option.
16:10 But the idea is just sort of, I've got the similar, there's a lot of tools that do this.
16:16 So you've got a two panel system where you, on the left, you, you're Markdown and on the
16:20 right, it shows up and you can hide one or the other.
16:23 But the, what I really like is some of the stuff that I always forget, like how to do,
16:28 how to insert a picture or do a table of contents or put reference links in or, or footnotes.
16:35 Those things are just sort of in there with menu items.
16:38 So I don't have to remember what all those Markdown codes are.
16:41 They just added, apparently you can collaborate and have multiple people editing a document
16:45 with this.
16:46 So that's pretty cool.
16:47 There's some fancy extra things like a UML diagrams that you can add in.
16:52 And I'm not sure if you're exporting it, you'll have to try to figure out what sort of extra
16:57 tools you need to actually generate those.
17:00 But it's pretty fun.
17:01 The thing that I like that they just added recently, apparently is you can sync with GitHub.
17:06 So you can keep all your Markdown documents in GitHub and edit them with, with HackMD.
17:12 And that's pretty, pretty fun.
17:14 That's awesome.
17:15 The other thing I found was this thing called Markdown Guide.
17:19 And it is just a, just a really good, clean reference for Markdown.
17:23 So I'm going to, there's, I had, you know, a handful of different references that I was
17:26 using, but I think I'm going to switch to this one because there's tabs that have like a getting
17:31 started page that I can send people to.
17:33 And a couple of cheat sheets.
17:35 One of them was, is the most common things.
17:37 And I think it's pretty, pretty indicative of common things you'll use.
17:41 And then an extended syntax page with, and then a bunch of tools you can use.
17:45 So a couple of Markdown references for people.
17:48 Have you ever used Pandoc?
17:50 Oh yeah.
17:50 I love Pandoc.
17:51 Yes.
17:51 Since I recently started using it and I'm preparing my presentations now with Pandoc every
17:58 time.
17:58 And I love it.
17:58 It's just great, great tool.
18:00 I love about Pandoc is it's not just from Markdown to HTML, but you can convert to Media
18:07 Wiki or lots of, or I use it a lot of times to format my emails correctly in the Microsoft
18:16 Office.
18:16 I will write them in Markdown and then use Pandoc to generate the WordDoc version and then
18:24 copy and paste into an email.
18:25 I know it's backwards, lots of steps, but it works for me.
18:29 Yeah.
18:30 You know, it'd be nice to have just an email editor that just takes straight Markdown.
18:35 Wouldn't that be cool?
18:35 Yeah, that would be cool.
18:36 Yeah.
18:37 And I'd really like an extension to Microsoft Outlook that had Vim key bindings.
18:43 That would be awesome.
18:45 So the programmers are invading Outlook.
18:48 Yeah.
18:48 Some other cool stuff about Markdown or hack Markdown, hacked MD is it has a VS Code extension.
18:55 And like you said, the GitHub integration is cool.
18:57 It has a browser extension.
18:58 You could turn your notes into a slide deck.
19:01 You can turn it into like a research project into like what they call book mode.
19:05 Yeah.
19:05 It looks pretty interesting.
19:06 And the collaboration is definitely needed around Markdown these days.
19:10 Like there's not really a great collaborative place that I know of.
19:14 Although I'm sure listeners are going to send us five examples, which is awesome because they always do.
19:18 But for example, like we use paper.
19:21 You can do slides with this?
19:22 Yes.
19:23 You can export paper from Dropbox paper, paper.dropbox.com as Markdown.
19:30 But it's not full fidelity.
19:31 It's like 85% that you can edit what you get.
19:35 But it's still, it's better than nothing.
19:37 But yeah, this looks cool.
19:38 Nice.
19:38 You know what's not cool?
19:39 Python malware.
19:40 That's not a thing, is it?
19:42 Apparently it is now a thing.
19:43 So, Connor Fester, Fester, sorry, sent in this interesting article, which was done.
19:51 Who was this done by?
19:53 It was, one second.
19:55 Cyborg Security.
19:57 So, these guys wrote a pretty cool article about how Python malware is starting to show up.
20:03 Now, you may have heard articles or mentions of certain package management stores getting infected with malware.
20:10 Like we talked about some researchers putting some kind of malware onto PyPI.
20:14 JavaScript had this at NPM.
20:16 Ruby had this with their gem store.
20:18 So, that's not what I'm talking about here.
20:21 That's an issue, but that is not this.
20:23 This is about what are people doing to create the runtime environment, just the viruses basically, with Python.
20:32 So, traditionally, this has been like a C, C++ type of thing.
20:36 But there's some interesting parallels just to go through here.
20:40 I don't want to encourage anyone to do this, but I want to put it on people's radar to be aware that it could be being done, you know?
20:46 So, for example, one of the challenges, if you build a C++ app, you can just send a binary around and run it.
20:52 Not so easy with Python.
20:54 The standard library has to be there, or CPython has to be there.
20:57 But they talk about, well, people are using Py2exe and Py2app to package up their Python viruses and send them around.
21:05 Isn't that weird?
21:06 I mean, I guess people will do weird things.
21:10 Yeah.
21:11 So, there's an example of Python malware called C-Duke that was used against the Democratic National Committee back in 2015 and 16.
21:19 There's other tools that might be just generally useful to people, regardless of whether it's in this context or not.
21:25 Like, un-compile 6.
21:27 This is the successor to decompile, un-compile, and un-compile 2.
21:33 I don't know where 3, 4, 5 went.
21:35 But un-compile 6 is a native Python cross version, a Python version, I guess, decompiler and fragment decompiler.
21:44 So, what it'll let you do is it'll take Python bytecode and turn it back into source code.
21:48 So, instead of taking a Python file and turning it into PYC, you take a PYC and turn it into a Python file.
21:53 Interesting.
21:54 Yeah.
21:54 Some people have been shipping PYC files alone, right?
21:57 And just knowing that those can literally be turned back into source code in, like, one line of commands should be something on your radar, right?
22:06 Because it looks safe, but it's not that safe.
22:08 There's also a PY installer extractor.
22:13 So, if you were to ship a library or application as a PY installer thing, here you can turn it back into a bunch of source files you can open up and stuff.
22:25 And then they also talk about, if you're given an executable, how to understand whether or not it was built with PY installer or if it was built to PY2XE or any of those tools.
22:34 Like, given an arbitrary executable, is this a Python packaged up thing, yes or no?
22:39 That's cool.
22:40 These are great tools.
22:41 The article looks really interesting.
22:43 I never thought about malware in Python before.
22:46 Yeah, there's a lot of interesting details and concrete examples of, here's how they did this with this one thing or that.
22:52 And I think it's an interesting read.
22:54 Again, not trying to encourage people to do these things, but just raise awareness, like, what the role of Python is in this, you know, less popularized space, right?
23:03 People always want to hide what they're doing in this world.
23:05 There's another application for some of these.
23:08 Sometimes businesses have, they'll be afraid or, like, not want to pass around Python files because of the problems with, you know, knowing what the interpreter is or something.
23:20 So they use PY2XE or something to make an executable for a tool for the company.
23:26 And then somebody, and then that gets passed around and somebody loses the source or you don't know who has it or something.
23:34 So using some of these reverse engineering techniques to get some source back, that'd be kind of cool to use for that purpose as well.
23:42 I have an example of that.
23:43 So one time there was this program we built.
23:47 And this was early in my career.
23:49 I must have been, like, not so good about checking in stuff.
23:52 And somehow the thing that I was working on had a file that somehow didn't get added to, it was SVN at the time.
24:01 So I had pushed all the changes, but I forgot to add this one file.
24:05 And then my computer died.
24:07 And the problem was, it was like my hard drive died.
24:10 And so, like, there was some part of the application that in the middle of the app used this library.
24:15 And then there was the rest of the app that was kind of below that.
24:18 And so it was really hard to figure out how to rewrite just that middle piece because it was like a weird jigsaw puzzle that had to fit together.
24:26 So I just went and disassembled the application, found the few files I needed.
24:31 They were named weirdly, but I just renamed them in a way that worked.
24:35 And then off it was.
24:36 I checked it into Git and we were good to go.
24:38 Or it was SVN and we were good to go.
24:39 And you probably never forgot to check in your files again.
24:42 No, I'm very obsessive about it now.
24:44 That's right.
24:45 Yeah.
24:46 Yeah, absolutely.
24:47 Anyway, that's all I got for this one.
24:48 It's an interesting article, though.
24:50 It's well done with some nice examples.
24:51 Yeah.
24:52 So I'm going to go on with, do you call it adders?
24:54 I call it adders.
24:55 Brian, what do you call it?
24:56 Adders.
24:56 Adders.
24:57 Adders.
24:57 That's really like American English.
24:59 I would probably say adders, like often and not often.
25:04 Okay.
25:05 Anyway, so what is adders?
25:07 It's so I only, I think I saw it a few times before, but I never actually looked into the
25:13 package.
25:14 But now a few weeks back, I've started using it for the first time.
25:19 So what is adders?
25:20 It's a Python package that simplifies writing classes.
25:23 So it creates a lot of the dunder methods automatically.
25:27 Yeah, that's cool.
25:28 Yeah.
25:28 And when I first saw it, I thought we have data classes.
25:32 So why do we need adders?
25:33 And only then I realized that adders is much older than data classes.
25:39 So PEP 557 added data classes to Python 3.7.
25:45 And they do resemble adders in many ways.
25:49 So when I started reading a bit on the documentation page of adders, I found out that the PEP was actually
25:56 inspired by adders.
25:58 And it was the result of the wish of the community to have a simplified way to write classes without
26:06 having to deal with the problems that name tuples have.
26:10 And I think the main difference between adders and data classes is that data classes are strictly
26:17 less powerful, and that certain features were sacrificed for the sake of simplicity.
26:22 So it's very easy to use data classes.
26:24 They are part of, I think, 3.7.
26:28 With 3.7, they come automatically.
26:30 But if you have 3.6, you have to pip install them.
26:32 But you don't have to get a new package for them.
26:36 And it's very easy to use them, especially if you have classes with many attributes.
26:40 But with adders, you have quite a few additional features.
26:44 For example, you have validators that you can use when you have your initializer in the class
26:50 and you want to perform some kind of validation of the input arguments, like checking that they
26:57 are an integer or some other type or more fancy stuff.
27:00 Then you can do that very easily with adders.
27:04 And it's a very powerful library.
27:07 So I think I need a lot more weeks to really get into the details and all its possibilities.
27:13 Yeah, this is a good one.
27:14 There's a lot of subtleties around creating classes that can be a little bit annoying.
27:19 Like, wouldn't it be great if you could have it print out something other than just the name of the class
27:25 at some memory address?
27:26 Automatically, that would be nice.
27:28 If you create a dunder equal, dunder EQ method, well, you got to remember to create the not equals.
27:35 That is the opposite of that.
27:37 And oh, if you create equals, maybe you also have to implement hash as well.
27:42 Because all of a sudden, if two things are equal, you put them in the dictionary, but then they're not the same thing.
27:47 That's going to be all sorts of crazy.
27:48 It just starts to cascade.
27:50 You're like, wait a minute, doing this right, it's not so easy.
27:53 And so I think that's kind of the zen of the adders.
27:55 Yeah.
27:55 I found it a bit confusing in the beginning with the syntax, how it looks like if you declare an attribute,
28:02 like it's a decorator adders, but then for the attributes of the class, you have this, is it adders.s or something?
28:11 And I found that a bit confusing in the beginning, since data classes are, I think, more beautiful when you write them
28:20 and you don't need this extra bit.
28:22 But once you get used to the syntax, it's very nice and easy to use.
28:27 I have to agree.
28:28 I like the data class syntax better.
28:30 The dotness of the adders syntax is cute, but bugs me a little bit.
28:36 Like attrib, the attributes are attr.ib.
28:42 And it's not something I really enjoy, but it's not difficult either.
28:47 The main switch for me, I think, is now that data classes are here, I use data classes all the time.
28:53 But when I need a validator, the validation mechanism in adders is pretty darn cool.
29:00 So if you want data validation, adders is still a great thing to pull up.
29:04 I agree.
29:05 I really wish that validators were in, or at least maybe we could have an extra package that we could pip install or something that would make data classes have validators, hopefully.
29:17 I know there's other things that you can do to validate schemas and stuff like that.
29:22 Yeah, I feel like there's a little bit of a paradox of choice.
29:24 Like you look at all these things and you want all of the features that like kind of in this impossible combined way.
29:31 So adders is cool.
29:33 They've got things like you can say that these attributes can only be set as keyword arguments in the initializer and not as positional arguments.
29:40 And just KW only equals true, stuff like that, which is pretty cool.
29:44 And then you've got the Pydantic models, which have like built-in validation for all sorts of types, which is cool.
29:51 You've got data classes.
29:52 Those can be frozen, which is kind of nice.
29:55 There's a lot of stuff going around here, and I feel like I'm underutilizing all of it.
29:59 Well, grab what you need.
30:01 It's good.
30:01 Yeah.
30:02 Throw some tests around it and switch later.
30:04 For me, it's sometimes just easy to forget what's out there since there are so many nice packages.
30:09 And I sometimes hear like I listen to a podcast and then I think, oh, that package sounds cool, but I don't have an application for it right away.
30:18 So I forget about it again.
30:20 And then in some context, I hear about it again.
30:23 And I think, oh, yes, you always wanted to try that.
30:25 But I think at least with adders now, like I will use it again quite a few times.
30:30 Yeah, I have that same problem.
30:31 I get excited about all these things, but I don't have a chance to use them.
30:34 And then I forget.
30:35 Then I'll rediscover.
30:36 I'm like, oh, yes, that's why I thought it was cool in the first time.
30:39 You should create a Harry Potter style project yourself for trying out all these things.
30:45 That's right.
30:45 Like awesome Harry Python, Harry Potter Python.
30:49 I'm going to work on the naming.
30:52 I like Harry Python.
30:53 Well, it might invoke images that are not exactly the same what you're thinking.
30:58 Oh, yeah.
30:59 Okay.
31:00 Never mind.
31:00 Yeah.
31:01 All right.
31:02 Well, you guys got anything extra?
31:03 I don't.
31:04 Brian?
31:04 No extras?
31:05 No.
31:06 No?
31:06 How about you?
31:06 Anna Lena, maybe take a moment and just tell folks like what you're up to.
31:10 We didn't give you a really introduction on the kind of work and stuff you're doing.
31:14 Yes.
31:14 So I think the first time Michael and I talked on Talk Python to me, I was still an AI resident
31:20 at Microsoft Research in Cambridge.
31:22 So I was doing a lot of machine learning research.
31:25 So I was doing a lot of machine learning research.
31:25 So working in the middle between a full researcher and a full software engineer.
31:29 And now I'm a machine learning engineer here in Germany in a company called InnoVex, where
31:36 I do like I apply machine learning to projects, proper real world problems, which is also very
31:42 interesting.
31:43 And I do all kinds of stuff now, data engineering.
31:46 So yeah, I'm always learning new things every day, which is really nice.
31:50 Yeah, that's very cool.
31:51 All right.
31:52 So I've got a couple of things really quick to share.
31:54 I was on a cool podcast TV-like show called TechNado, which was a cool experience.
32:01 It's a little bit like Python Bytes, but for the IT space.
32:05 So that was a lot of fun to be on there.
32:07 And on YouTube, you can check it out.
32:10 And we played the game Python, Python, Python, where we would get partial words out of a headline.
32:16 And we'd have to decide, is it Python the snake, Monty Python, or Python the programming
32:21 language that the article is about?
32:22 That was pretty fun.
32:23 So you could check that out over there if you're interested.
32:25 Sorry.
32:26 So did you win?
32:27 I completely got crushed.
32:29 I think I got last because I wanted everything to be about Monty Python.
32:32 And they're like, no, that's about a snake.
32:34 I'm like, oh, come on.
32:35 That would have been so funny if that was about Monty Python.
32:37 But no.
32:38 Yeah.
32:39 I let my hopes and dreams get ahead of me.
32:43 Maybe next time.
32:44 Exactly.
32:45 I'll come back for the championship later.
32:47 Brian, what do you think about this joke?
32:49 I haven't looked at it.
32:51 Oh, perfect.
32:51 Then you got to open it up.
32:52 Anna Lena is, well, this one is, as per usual for us, a visual joke in an audio format.
32:58 But I think it's going to work great.
32:59 So this one is called the only valid measurement of code quality.
33:04 And I know, Brian, you're very passionate about high quality code and testing and stuff like that.
33:09 Have you seen this metric built into any of the software you used?
33:12 Well, you can't.
33:17 Maybe with some voice recognition and some AI.
33:19 Anna Lena could put something together for us, like starting the code review now.
33:22 Yeah.
33:24 It looks so funny.
33:24 It looks so funny.
33:25 I love that.
33:25 Yeah.
33:26 So this is the only valid measurement of code quality is WTFs per minute.
33:30 I'll try to keep this without the explicit tag, but WTF.
33:35 So there's a comparison here.
33:37 On one hand, we've got the good code review, which is still, it's like a door that's closed.
33:43 And you can just see like statements of what people's going on.
33:46 It's going on the side.
33:47 You hear this, WTF, WTF.
33:49 What is this?
33:50 That's the good code.
33:51 The bad code is just full of them.
33:53 It's like WTF.
33:54 What the WTF is this?
33:56 A dude, WTF.
33:58 WTF.
34:00 I think this really captures code review pretty well.
34:02 It does.
34:03 Anyway, the only valid of measurement of code quality, WTFs per minute.
34:08 WTFs per minute.
34:09 Definitely.
34:09 All right.
34:10 Well, that wraps it up for this week.
34:13 All right.
34:13 Thanks, Brian.
34:14 Thanks, Elena, for being here.
34:15 Thanks.
34:15 It was a lot of fun.
34:16 Yeah.
34:16 You bet.
34:17 Bye-bye.
34:17 Bye.
34:17 Thank you for listening to Python Bytes.
34:19 Follow the show on Twitter at Python Bytes.
34:22 That's Python Bytes, as in B-Y-T-E-S.
34:25 And get the full show notes at Pythonbytes.fm.
34:28 If you have a news item you want featured, just visit Pythonbytes.fm and send it our way.
34:33 We're always on the lookout for sharing something cool.
34:35 This is Brian Okken, and on behalf of myself and Michael Kennedy, thank you for listening
34:39 and sharing this podcast with your friends and colleagues.