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


Transcript #327: Untangling XML with Pydantic

Return to episode page view on github
Recorded on Monday, Mar 13, 2023.

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

00:05 This is episode 327, recorded March 13th, 2023, and I am Brian Okken.

00:11 And I am Michael Kennedy.

00:13 This week's episode is sponsored by Compiler Podcast from Red Hat.

00:17 Listen to their spot later in the show.

00:19 And connect with the show on Fostadon at pythonbytes at fostadon.org.

00:25 And both Brian and Michael are there also, Brian Okken and M. Kennedy.

00:31 You can also join us on YouTube or join us live by going to pythonbytes.fm/live to be a part of the audience.

00:41 It's really kind of fun.

00:42 Usually it's Tuesdays at 11.

00:44 This week it's Monday, but usually it's Tuesdays at 11.

00:47 And you can watch older videos on the YouTubes as well.

00:52 So thanks, Michael, for showing up again this week.

00:56 We've got quite a few episodes under our belt.

00:58 So are you excited to get started?

01:01 We do.

01:01 I am.

01:02 You know, technology can be a tangled mess sometimes.

01:07 And not long ago we spoke about Untangle.

01:11 And then, I believe it was Ian, sent in and said, you know, that was really cool.

01:15 Yeah, it was Ian.

01:15 Thank you.

01:16 Said, I know you're a huge fan of Pydantic.

01:19 It's true.

01:20 And maybe you want to check out something that is similar to Untangle, which would let you talk to XML through Python in an object-oriented style way.

01:31 A little more dynamic.

01:32 So he sent in Pydantic, the Pydantic-XML extension.

01:37 Have you heard of this, Brian?

01:38 No.

01:39 No, I hadn't either.

01:40 It's totally news to me.

01:41 But the idea is basically, you know, the way Pydantic traditionally works is you point it at a JSON file or a Python dictionary.

01:49 And it can create an object graph hierarchy of all the pieces that it knows.

01:55 So you can say it has a name and a number, but then also has a list of locations and the locations model of these Pydantic objects and so on.

02:03 And that's how Pydantic has worked from day one, more or less.

02:06 It's based on dictionaries because that's the way that you speak APIs, right?

02:12 And so it was very closely tied to APIs and JSON exchange there.

02:16 So this one does basically the same thing, but for XML.

02:20 And it's glorious, right?

02:21 It's glorious with the data validation, the required versus optional, the type conversion, all of those things.

02:27 It supports dictionaries, listsets, tuples, unions.

02:30 It has LXML parser support for high-speed parser processing.

02:36 You can pass in an element tree as well, which is the XML-etree-element tree class, which allows you to do parsing traditionally.

02:46 So how do you get going?

02:48 Well, you create a class here with pure Pydantic.

02:52 You derive from base model.

02:53 Here you derive from base XML model.

02:55 So it's slightly different, but, you know, it's fine.

02:58 And check this out.

02:58 In the XML document that they're talking about here, there's a top-level node has a thing called status, an attribute called status in XML.

03:08 Okay.

03:08 And, yeah, or in the product it does, part of it anyway.

03:12 It has two possible valid values.

03:15 It can either be running or in development.

03:17 It can't be ran or prod or any.

03:21 It has to be those two words.

03:22 So because it's Pydantic, you can just say the type of this is a literal running comma development.

03:28 Isn't that awesome?

03:29 And that's it.

03:30 That is pretty good.

03:30 You're done validating that that is correct.

03:32 And you set that equal to an adder, which means it's not coming from the body of the XML node, but it's coming from this attribute name status down here.

03:41 So cool, huh?

03:42 Yeah.

03:43 Then you can have launched.

03:45 You could have launched, which is a numerical date.

03:48 So the running ones have 2023 and 2019 as launched, but the one that's in development, well, it doesn't have a launch date, so it's missing.

03:55 So the optional aspect of Pydantic is at play here.

03:59 And then there's a title for that element.

04:02 And that just comes, you say it's string, it just comes straight out of the body of the node because it's not set to an attribute, but it's just the base one.

04:10 I guess, presumably, you can only have one of those per node.

04:13 Okay.

04:13 So is title special or can you name it whatever you want then?

04:18 You can name it whatever you want, I'm pretty sure.

04:19 Okay.

04:19 Yeah.

04:20 Oh, yeah.

04:21 It says extracted from the element text.

04:22 Nice.

04:23 Okay.

04:23 Yeah, yeah, exactly.

04:24 And so then the overall XML document, I had it reversed when I first started talking about this.

04:29 There's a company and the company has products, right?

04:31 So there's a company class.

04:32 It has a trade name from its attribute, SpaceX in this case.

04:36 And then it has a node, which has a website as its text value.

04:40 But the text value is HTTPSSpaceX.com, right?

04:44 And so you can say the type is a URL and it'll actually parse it out as a URL, not just a string, which is really cool.

04:50 Okay.

04:51 And then in standard Pydantic style, it has a list of products and you give it the tag name that it's product.

04:59 The node name is product and it just loops through that list.

05:02 Isn't that a clever way to parse that with validation and data conversion and all that?

05:06 Not only that, I'm really glad you walked me through it because the first time I looked at this, I was a little bit lost on how to think about this and how it's building it up from different components and attributes and elements.

05:20 It's pretty neat.

05:21 Yeah.

05:22 If I've got to do XML again, I'm all over this.

05:25 So there's a bunch of stuff about how you talk about heterogeneous collections, aliases, union types, model.

05:31 You can go through it if you want.

05:32 But I think this little quick getting started bit they have right at the top of the website that I'm linking to.

05:38 That's pretty good.

05:39 Yeah.

05:40 Nice.

05:40 Cool.

05:41 Very good.

05:41 Yeah.

05:41 Anyway, that one's a great one.

05:43 Thanks, Ian, for sending that in.

05:44 I'm psyched to know about it.

05:45 Well, next, I kind of want to talk about virtual environments.

05:50 So I use the virtual environment, VENV, built into Python.

05:56 I, in the past, have used the virtualenv extra package that you can install.

06:04 But since, I don't know, it's been quite a few versions of Python, the built-in one's pretty darn good.

06:09 So I'm happy with it.

06:11 Anyway, there's a lot of people that kind of don't really get how they work.

06:17 Trying to get people on board with that they should use them is great, but trying to use them effectively.

06:23 Like, one of the mistakes I've seen a lot of people make with virtual environments is using them, but then when they go to test in CI, actually trying to activate the virtual environment.

06:33 And you don't really have to.

06:35 You can just use the binaries directly.

06:39 And so I'm really happy this article is around.

06:42 So Brett Cannon wrote an article called How Virtual Environments Work.

06:47 And this is excellent.

06:49 And it's a short read.

06:50 So one of the things that starts with a little history, not a lot of history, just a little to remind people that back in the day,

06:59 we had global and the working directory or your current directory, and that's it.

07:04 It wasn't anything else.

07:06 And I kind of remember this of trying to find if I'm sharing some code, trying to find some on the web,

07:12 and then just downloading it and sticking in my directory and see if it works.

07:15 It's just part of your code now.

07:16 That's not what we have today.

07:19 And partly in thanks to virtual environments.

07:21 So it's better now.

07:23 You can still complain about them.

07:25 That's fine.

07:26 But it's better now.

07:27 And then he goes on to talk about the structure.

07:30 And there's really not much there.

07:33 I mean, when you're building a virtual environment, it's kind of a lightweight throwaway thing.

07:37 Don't think of it as this huge thing.

07:39 It's just a little directory.

07:41 And it's got a bin and an include and a site packages directory for the Python that you're using.

07:48 And on Windows, it's a little different.

07:50 But we'll just hand wave around that.

07:53 In the Unix environment, it's mostly symbolic links to, I mean, you do have stuff installed there.

07:59 But as far as replicating the Python environment, it's your Python interpreter isn't copied in there.

08:05 It's symbolic linked.

08:07 So you don't have to worry about that too much.

08:08 It's the site packages and the bin and everything and how that's there.

08:14 So how does Python deal with that?

08:16 Well, it deals with it through a pyvenv.cfg.

08:21 It's a config file that tells Python when you run Python from this virtual environment where the home directory should be, where the system, whether or not to include system packages in the site packages.

08:32 And then the version and the executable and some other stuff like the command, if you wanted to recreate it.

08:40 I don't know why that's there.

08:41 But in general, this is enough to tell Python if you just run it from that environment that you just get all the right stuff.

08:53 And so if you're putting it in a script, just use those.

08:56 But if you're using it from the shell, then, of course, you're going to activate the shell.

09:00 But the activation, he's stressing, and this is important to understand, it's optional.

09:05 You don't have to hit activate as long as you're calling stuff within the environment.

09:10 And it kind of goes on to talk about really what it's doing.

09:15 What does the activation do, though, if you're curious?

09:17 It doesn't do much.

09:19 It sticks some stuff in your path.

09:22 And it's like a virtual environment, sets a virtual environment variable.

09:28 And it registers a deactivate shell function.

09:31 And that's about it.

09:33 It changes your prompt, too, to let you know that you've activated it, which is cool.

09:36 And then he goes on to talk about how partly why he's dug into this lately is because for VS Code, they're creating a little tiny, but you can use it anywhere you want, a extra extension called microvenv.

09:51 Microvenv.

09:52 I don't know.

09:53 So this is a single file, less than 100 lines to kind of emulate all of that.

10:00 And the reason is because Debian doesn't include virtual environments by default.

10:07 So they kind of have to want to work around that.

10:09 So anyway, really great summary of virtual environments.

10:12 Yeah.

10:12 I'm peeling away a little bit of the magic to let you know what's happening in there, right?

10:16 Yeah.

10:16 Well, and also because it's sort of magical to some people, a lot of people are concerned about like trying to copy it or something.

10:25 And you shouldn't have anything kept that's important within your virtual environment.

10:31 You should be able to recreate it whenever you want.

10:34 So there should be lightweight things.

10:36 Oh, the one thing I really wanted to highlight, the reason why I really wanted to talk about this was because of a flag.

10:42 So where's that flag?

10:44 There's a flag, dash, dash.

10:47 I've got to find it.

10:49 Do you know what I'm talking about?

10:51 Anyway.

10:52 Okay.

10:52 I'll help you search.

10:54 There's like no, there's like, like, yeah, without pip.

11:00 Dash, dash, without dash pip.

11:02 Okay.

11:02 So without pip, excellent thing to know about because, oh, here it is.

11:08 BNV without pip.

11:10 That will get it.

11:12 So that doesn't ask you, ask you to upgrade pip.

11:15 So especially in CI and other places, you don't, you don't care about upgrading it right now.

11:21 I mean, I get it if I'm in the development mode.

11:24 I do want to upgrade it.

11:25 I want to use the latest one.

11:26 But in a CI environment or a lot of automated places, I don't need to do that.

11:32 I can just use whatever's there.

11:33 It's going to be fine.

11:34 So turning that off is awesome.

11:36 And it saves some time.

11:37 It's not just, it doesn't say not, it isn't really not install pip or upgrade.

11:42 It just doesn't try.

11:44 So it assumes pip's already there is all.

11:47 It uses the system pip.

11:48 So that's it.

11:49 Cool.

11:49 That's cool.

11:50 Yeah, it just falls back to the global one, but runs it for that environment.

11:53 Yeah.

11:53 Yeah.

11:54 And apparently it saves a lot of time of that.

11:57 So that's great.

11:58 Very cool.

11:59 Very cool.

12:00 Well, before we move on, our sponsor.

12:03 Oh, yeah.

12:04 Let's cover our sponsor.

12:05 And I really, really appreciate Red Hat and the compiler podcast for sponsoring this episode.

12:10 So just like you, both Michael and I are big fans of podcasts and really happy to share a new one from a highly respected open source company.

12:20 Compiler is an original podcast from Red Hat.

12:23 Compiler brings together a curious team of Red Haters to simplify tech topics and provide insight for a new generation of IT professionals.

12:31 The show covers topics like what are the components of a software stack?

12:35 Are big mistakes that big of a deal?

12:38 And do you have to know how to code to get started in open source?

12:41 Compiler closes the gap between those who are new to technology and those behind the inventions and services shaping our world.

12:49 They bring together stories and perspectives from the industry and simplifies its language, culture, and movements in a way that's fun, informative, and guilt-free.

12:59 I recently listened to an episode titled Testing PDFs and Donkeys.

13:04 It was great.

13:05 It's part of a Stack Unstuck series.

13:10 It's a great series, and it talks about the entire tech stack, software tech stack, especially around web stuff, starting with the great stack debate.

13:19 There's episodes on front-end frameworks, fundamentals, databases, and OS.

13:24 Even OS is in system calls, and then it even talks about testing.

13:29 Even though testing really isn't part of what you think of as the tech stack, it's kind of part of all of it.

13:34 So I'm glad they covered it, especially for people either jumping into software or software old hats like me trying on new hats like embedded systems or control systems, people learning how to do web applications.

13:46 These are great overview episodes, and they're going to be a great episode.

13:49 They're timed well.

13:49 They're timed how they need to be.

13:52 Some of them are 45 minutes.

13:54 Some of them are 25, and I like that flexibility.

13:56 Learn more about the compiler at pythonbytes.fm.compiler.

14:01 The link is in your podcast player show notes, and thank you to Compiler for keeping this podcast going.

14:08 Thank you, Red Hat.

14:09 Thank you, Compiler.

14:09 Good show.

14:10 Check it out.

14:11 All right.

14:11 On to the next one, Brian.

14:13 Okay.

14:13 This one is a project by Raid.

14:17 And if you've worked with databases in Python, especially if you're using an ORM like SQLAlchemy, SQL Model, Kiwi, any of these things, what's really nice about those is you create classes in Python.

14:28 And then through some sort of magic, somehow there's a startup thing that makes sure the database exists, that the database has tables that map over the classes.

14:39 So, for example, if I create a class and say it's these three columns, and here's an index, and this one must be unique, it'll talk to the database and make that happen.

14:46 But for the rest of database management, you've got to go and write stuff in SQL or DDL, data definition language, or whatever that is, right?

14:56 The stuff where you create the tables and create those types of scripts, create users.

15:01 So, Raid created DB declare, a declarative layer for your database that adds on on top of those types of things, like SQLAlchemy is what I described, for that kind of work.

15:14 So, it's a pretty new project.

15:15 People can check it out.

15:16 The idea is, let me find a quick example here.

15:20 So, what you can do is you can come and say, I want to create a database, and it's got this name, and I want to create a role.

15:27 And here they have the name of the role as a hungry user.

15:29 They have to log in.

15:31 Here's their password.

15:31 They get privileges on this certain database.

15:35 And you can model out those types of things.

15:38 And then on top of that, you can just use SQLAlchemy itself as part of this process.

15:43 You create a SQLAlchemy engine, and you call run on that.

15:46 And you can also, it'll create the SQLAlchemy models.

15:49 There's an example a little bit further, I'll also link to this, that shows how to do basically the standard SQLAlchemy stuff that will create the tables with the primary keys and so on.

16:00 So, this one's just a short one.

16:03 But if you like the way that SQLAlchemy works, also with SQLAlchemy, you get migrations.

16:09 Or with SQL model through Alembic.

16:11 The idea is that this is going to be extended in the future as well to have some of those type of transformational behaviors.

16:19 But for now, it's really the extra stuff like table creation, database creation, user roles, and management.

16:26 So, pretty cool.

16:27 People can check that out if they find that useful.

16:29 Want to stay more in Python and less in SQL scripts.

16:33 Well, especially the roles and permissions, having that covered by that, that's pretty cool.

16:39 That's a piece that always trips me up.

16:41 You don't just have the root user, just have read access, full access, just run as admin.

16:47 Just kidding.

16:49 Yeah, exactly.

16:50 It always seems like it's covered as an advanced topic, but it's almost the first thing you need to figure out.

16:57 Yeah, exactly.

16:58 How to separate user roles.

17:00 Right.

17:01 Are we going to put this on the internet and just let people have at it, or are we going to put a little data protection in there?

17:06 Anyway, people can check that out.

17:08 It's a good one.

17:09 Next, let's talk about Nox.

17:11 So, I use both Tox and Nox on various projects.

17:15 A lot of my open source stuff is Tox-based for testing, just because I'm used to it.

17:21 But I'm starting to use Nox more and more.

17:23 And I want to cover this article by Seth Larson called Testing Multiple Python Versions with Nox and PyEnv, P-Y-E-N-V.

17:33 Now, I personally don't use PyEnv, but I have before.

17:37 And one of the things that's tripped me up before is how to use it with Tox and Nox.

17:42 So, basically, even – so, check this out if you want to – check this article out if you want to learn more about Nox.

17:48 But also, the trick about – even if you're a Tox user, the trick about how to use PyEnv with it, with the global.

17:55 There's an example here.

17:56 It's awesome.

17:57 So, let's go over this a little bit.

17:58 So, if you want – one of the first things I want to try to do with Nox, when it wasn't obvious to me from the documentation,

18:05 is just how do I set it up like I would Tox to just test multiple – my stuff with multiple Python versions?

18:11 And that's the example that it shows right off the bat.

18:14 You have a Nox file.

18:15 It's NoxFile.py.

18:18 And it's Python code.

18:20 So, you import Nox, and you can set up a session for multiple Python versions.

18:25 And then, within this defining test, this can be anything.

18:30 So, the function names around a session are – they're just – they're what you'll use later.

18:36 So, we'll cover that in a little bit.

18:38 But then, within your session, you do stuff.

18:42 You either install or run.

18:44 There's probably other stuff, too.

18:45 But this is what I use, is install and run.

18:47 So, installing . means installing the current project that you're working on.

18:51 And then, there's an example here for requirements files.

18:54 So, a dev requirements.

18:55 But if you're using pyproject.toml, it could be also part of your .install, if you want.

19:01 And then, run test.

19:02 And, of course, run pytest.

19:05 So, good job, Seth.

19:06 And then, it goes through how to run it.

19:09 So, you can either just type Nox, and it'll run everything.

19:12 Or you can say Nox-S for –session to run test.

19:17 And if you want to run a specific one, like just 3.11, Python 3.11, you can say test-3.11.

19:25 I kind of like that there's a dot in there.

19:27 It's pretty easy to understand.

19:29 So, I just really like how simple this is to get the basics down.

19:33 The basics of, I want to run tests on my project on over multiple Python versions.

19:39 And this is pretty clean.

19:40 This is already a decent argument to switch to Nox if you're on the fence between Tox and Nox.

19:46 I agree.

19:47 It's so nice because not only is it clean, you get autocomplete support from your editor.

19:56 You get whatever editor you're using.

19:57 It'll tell you if you've done something wrong.

19:59 There's more support than just, well, here's an arbitrary text file I'm typing stuff into.

20:04 I hope it works.

20:05 Yeah.

20:06 And then, you can – I mean, I've used it also to, just like I do, is Tox with doing something

20:11 like adding linting and coverage checks and all sorts of stuff.

20:17 I do want to – actually, that's one of the things.

20:19 I'm glad you wrote this because it's a reminder.

20:21 I did want to write a – like an example of the workflow differences between using Tox and Nox

20:27 and showing a side-by-side comparison of those two.

20:30 So hopefully in the future I can get that written.

20:31 But one of the things that gets me is that with the run command, you have to separate every little piece of your command by –

20:40 they have to be quoted as quoted strings.

20:43 Like pytest tests has to be two different parameters to the run argument.

20:47 And if you have a bunch of flags, each of the flag needs to be different things.

20:51 Now, this – most – some people might not care about this.

20:54 I kind of care, and it bugs me because I don't have to do that with Tox.

20:58 So what I do is I just – since it's Python, I just write a string with all of the things that I want in it,

21:06 and then I use split to create a – Split on space, something like that.

21:10 Yeah.

21:10 I just use split on space to create an array with all of the elements.

21:16 And then when I run – I pass it to run and do the star thing so that it explodes it and passes it in altogether.

21:22 Yeah.

21:23 Nice.

21:23 And then here's the trick – the magic trick about PyEnv at the bottom is that if you say PyEnv global

21:31 and list all of the environments that you want to have available, it makes it available.

21:36 If you're using PyEnv, it isn't by default.

21:39 So you have to run this for each session or shell invocation to get it to work for PyEnv people.

21:46 Cool.

21:47 But that trick works with Tox also.

21:49 And the other thing I wanted to mention was one of the things I really like about Nox is that if you –

21:56 like this example has PyPy3 and 3.8, 9, 10, 11, 12 all there.

22:02 By default, Nox will not fail if you don't have one of these around.

22:06 So if you only have like 3.11 installed, it'll just run that and it'll skip the others.

22:11 You can make it fail if it doesn't have it, but you don't.

22:14 By default, it just skips them, which is kind of cool.

22:16 The Tox is the reverse.

22:17 Tox is if by default, it'll fail if it's not there, but you can tell it to skip if it's not there.

22:23 Yeah, that's cool.

22:25 One really quick thing if people are copy and paste from that example, I'm pretty sure the –r dev requirements needs a –r space dev requirements in there.

22:33 Just people are copy-pasting, right?

22:34 Because that's the command is install, pip install –r space filename.

22:39 This always surprised me.

22:40 I've seen it in multiple tutorials.

22:42 I don't know if that's true.

22:43 I think you might be able to do my way without the space.

22:46 I don't know.

22:46 Okay, well, you may be able to.

22:49 We could try it.

22:51 Yeah, we could try it later.

22:52 Yeah.

22:53 All right.

22:54 Quick question for you, Brian, because I don't know the answer.

22:56 Damian asked, does someone know if, how, Nox or Tox work with poetry?

23:01 Do you know?

23:01 Nothing works with poetry.

23:03 I don't know, actually.

23:07 So, poetry, I'm sure there's – I don't know.

23:11 Probably, you talked about the PyProject Toml integration.

23:14 So, I mean, it probably is more or less – It probably works.

23:17 Probably.

23:18 Yeah, it probably works.

23:19 I'm sure many people listening know.

23:22 Sorry, Damian.

23:23 I don't know.

23:23 Either.

23:24 All right.

23:26 Hold that thought.

23:27 Hold that thought.

23:28 Yeah, that's all of our things, isn't it, Brian?

23:29 Do the search.

23:30 Yeah.

23:31 We were quick.

23:32 Do you have any extras for us?

23:34 Oh, I always got extras.

23:35 So, let's go through here.

23:38 Remember when we talked about how much drama there was around – how was it?

23:44 Google, maybe.

23:44 Someone was giving away, like, two or 4,000 YubiKeys to the top 100 or top 1,000 maintainers on PyPI – maintainers of the top projects on PyPI.

23:57 And that was because there was going to be a requirement for PyPI that the very top 1% or some small percent was required to have 2FA.

24:06 Yeah.

24:07 Well, guess what?

24:08 If that caused drama, wait until you hear about this.

24:12 GitHub makes 2FA mandatory next week for anyone who is an active developer.

24:19 So, basically, like, if you're making contributions to projects, public projects, I believe, something like that.

24:25 So, yeah.

24:27 Okay.

24:27 Security accounts of more than 100 million users.

24:30 I'm not sure exactly what the definition of an active developer versus an active contributor because I might contribute to the code without writing any actual software.

24:40 But whatever.

24:41 It's splitting hairs.

24:42 The only reason I really bring this up is not to, like, go into depth.

24:45 That's why this is an extra.

24:46 But if it was a big deal that, you know, 1,000 Python developers had to do 2FA and it sounded like it was, what about 100 million?

24:55 It's going to cost some drama.

24:58 And then how many of those people who are contributing to PyPI are doing so in some way or another through GitHub?

25:05 I would say the majority, probably.

25:07 Yeah.

25:08 Yeah.

25:09 Actually, so I don't think it's going to be drama.

25:12 Hopefully, people are just cool with it.

25:14 I think the mess up with PyPI was the dongle thing.

25:17 I think people thought they had to have the hardware thing.

25:20 And they don't.

25:21 I mean, I use a software 2FA system.

25:24 And it's not just them.

25:26 I don't know about you.

25:27 But I just looked.

25:28 I got, like, half a dozen, dozen different things I got to log into with Authy.

25:32 Yeah.

25:33 I think I have about 30 accounts or so that are 2FA.

25:37 Yeah.

25:38 And I'm happy that I do.

25:39 That is not a complaint.

25:41 I mean, that's not me whining.

25:42 That's me, like, going, yes.

25:44 Occasionally, I'm annoyed by it.

25:45 Sometimes I'm lying.

25:46 Yes.

25:46 Like, right now, I went to look at a GitHub thing, and I have to log in, so I don't have

25:53 time to do that right now.

25:54 So, occasionally, it's annoying.

25:56 Well, here, let me tell you why this is annoying so often.

25:59 I'm going to take this and make it a whole episode, aren't I?

26:01 So, the reason it is annoying is there's so many places.

26:06 Like, what is the point of the 2FA?

26:08 The 2FA is if somebody steals your account login information through some kind of data breach

26:15 or through password reuse or whatever, that someone else can't go and use those credentials

26:21 to log in as you.

26:22 They have to have the second factor.

26:24 Well, here's why it's annoying.

26:25 Every time I log into my credit card processor, I think almost every time I log into DigitalOcean,

26:33 it's like, hey, how are you doing?

26:35 What's your 2FA factor?

26:38 It's like, you know, I've given that to you about 100 times in the same browser, right?

26:42 It should, at some point, go, you know what?

26:44 They've given us the 2FA.

26:45 We trust them.

26:46 It's not, I'm not concerned someone is on my computer logging into my thing.

26:51 I'm concerned about the seven other billion people who might want to log in from somewhere

26:56 else, right?

26:57 So, I think there should be a little bit of like, hey, if you've already logged in on this

27:02 device, maybe you don't need the 2FA every time.

27:04 You could even refresh it monthly, but not four times this morning, right?

27:08 That's when I'm like, ah, 2FA.

27:10 It's driving me nuts.

27:11 So, that's my right.

27:12 Yeah, but I mean, to be fair, GitHub doesn't do that, or PyPI.

27:15 No, GitHub is great.

27:16 GitHub, I have no complaints.

27:18 Okay, because I don't have to do it every time for GitHub.

27:21 No, no, GitHub is really good.

27:24 Yeah, and I've been using 2FA for GitHub for quite a long time.

27:27 It's been optional for a long time.

27:29 Yeah.

27:29 Or a while, at least.

27:31 I have a short, very short memory.

27:32 I'm really good with open source because I have the same memory span as the general technology

27:38 memory of open source.

27:41 Nice.

27:42 All right.

27:43 I have one other really quick thing.

27:45 You know, Brian, we always have good luck reaching out to our listeners about things.

27:50 And this one is a little bit different.

27:52 So, I recently got a brand new adventure motorcycle as of last week, which is awesome.

27:58 And I found some fun places to take it and ride.

28:00 Like, I rode up into the snow around here and the coastal range and stuff like that.

28:05 I'm looking for somewhere fun in the Northwest to go riding that's like not intense motocross

28:12 off-road.

28:12 But, you know, it would be a lot of fun for these types of things.

28:15 Just a nice view.

28:16 Yeah.

28:16 Just get out and get out in the woods and cruise around this summer, this spring.

28:19 And so, listeners out there who know where to ride around here, that's not one of the

28:24 couple huge off-road vehicle like state-sponsored areas around Portland.

28:29 People got it.

28:30 Shoot it in.

28:31 And if you want to know why I kind of got this bike, how much fun it was, there's a cool

28:35 video I linked to with Ben Townley and another guy, something Raymond.

28:40 I can't remember his first name.

28:43 Anyway, you can check that out.

28:44 And, yeah, that's all I got for my extras.

28:47 How about you?

28:47 I mean, while we're asking for, like, contributors, I just, we just passed.

28:52 We were driving around this weekend and saw, like, a group of motorcy, like, 10, 20 people

28:59 riding motorcycles.

28:59 And since we've got a couple of Harley places around here, so there are, like, Harley groups

29:05 around.

29:05 But when I was a kid, I was, like, scared of these people.

29:09 And these people.

29:10 Just people with motorcycles.

29:11 Mostly wearing black leather.

29:13 But now they're, like, I mean, it's mostly people my age or older.

29:18 You know, it's 50 to 70-year-olds riding motorbikes just to hang out with your friends.

29:23 Well, that's cool.

29:24 I mean, at least that's what I see.

29:25 But I think it'd be cool if I could see, like, are there, like, e-bike gangs?

29:31 Or, like, are there e-bike groups of people, like, just a bunch of e-bikes riding together?

29:37 Anyway.

29:38 I bet there are.

29:39 E-bikes are awesome.

29:40 Like, electric bicycles.

29:41 They're so cool.

29:42 And I'm sure there are, actually.

29:44 But how are you going to find them, right?

29:45 That'd be cool to see a picture of, like, a bunch of them.

29:47 Yeah.

29:47 Anyway.

29:49 Do you have to get one of those club patches for it?

29:51 Can we get it?

29:52 Probably.

29:52 Do you have any extras before?

29:53 No, I don't have any extras.

29:56 I was just BSing.

29:57 So let's do a joke.

29:58 Yeah, awesome.

29:58 All right.

29:59 Let's do a joke.

30:01 And, boy, I didn't do this.

30:02 I didn't plan this.

30:03 But, boy, did it line up good.

30:04 So this one comes to us from ProgrammingHumor on Reddit.

30:07 And just check out this picture, Brian, here really quick.

30:10 Describe the picture to folks.

30:14 You see this?

30:15 I don't know what I'm saying.

30:15 So it's some sort of logging into GitHub.

30:17 Okay.

30:18 And somebody's got to do a code review here on the end of the morning.

30:22 Oh, there's over a million lines changed and 20 deletions.

30:26 1,094,000 lines changed, 20 removed.

30:30 So not too bad there.

30:31 But 2,945 files to review.

30:35 And it's zero of those.

30:36 It's like, let's get started.

30:38 So the title is, anyone else have this kind of colleague?

30:43 What a way to start a Monday.

30:44 So any guesses what they did?

30:49 I'm guessing they, like, applied black to their project.

30:52 And it just changed everything.

30:54 Yeah, maybe.

30:55 The comments section is pretty good, too.

30:59 Someone else, like, suggested that maybe the git commit message is fixed typo.

31:03 Fixed typo.

31:05 Or something like that.

31:07 Added stuff.

31:08 Small update.

31:09 Small update.

31:10 Yeah.

31:11 That's funny.

31:13 Reformatted every line of gun.

31:15 Exactly.

31:16 So it's a case of the Mondays.

31:20 One of the best shows ever.

31:21 Replace all spaces with tabs.

31:23 Exactly.

31:26 Nice.

31:26 So anyway, cool.

31:28 All right.

31:29 Well, that's what I got for you.

31:30 For this wonderful episode.

31:31 I had a lot of fun.

31:33 Hope everybody else did, too.

31:34 Yeah, I did, too.

31:34 And thanks, everyone, for listening.

31:35 See y'all later.

Back to show page