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


Transcript #229: Has one of your dependencies died?

Return to episode page view on github
Recorded on Thursday, Apr 15, 2021.

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

00:04 This is episode 229, recorded April 14th, 2021. And I am Brian Okken.

00:10 I'm Michael Kennedy.

00:11 Hi, I'm Gwen Faraday.

00:12 Hey, Gwen. Great to have you here. Thanks for coming.

00:15 Yeah, thanks for having me.

00:16 We invite you because you're doing really cool stuff with Python and you're doing some neat

00:20 things on YouTube and some, are you doing live streaming as well or just videos?

00:24 Maybe just tell people real quick about yourself before we get into our topics.

00:28 Yeah, sure. So I'm, I work as a senior software developer at a consulting company.

00:34 We do almost entirely Django projects there. And I've really loved getting to use Django for the

00:40 past couple of years. On the side, I also teach at a coding school where we do full stack JavaScript,

00:47 but most of our backend and computer science curriculum is actually Python. And then we also

00:52 use Django for the final portion of the curriculum as well as the final project. And then on the side,

01:00 as Michael mentioned, I really like to make videos and content and things like that. So I've done a

01:07 mixture of JavaScript and Python content under the name Faraday Academy. And I also have Twitch live

01:14 streams. So most recently for Python, I've been kind of diving into FastAPI live and trying to learn

01:23 async Python since I haven't really done much with async Python in the Django world.

01:28 Nice.

01:29 Yeah. Super fun. FastAPI is a great technology to work with. So you sound like you're busy,

01:34 but in a good way.

01:36 But I love programming. So it's like my passion. It's not burdensome, I guess.

01:41 Yeah, it doesn't count as work. That's great. Brian, you want to kick us off?

01:44 Yeah. The first story I want to cover is about coverage. Couldn't help the bad pun. So Ned

01:52 Batchelder put a post out just the other day. There's a beta out for coverage. It's a 5.6 beta one.

02:02 It's kind of a big revamp. Well, I don't know how much code he changed, but he says it's a big deal.

02:09 So the thing that's exciting about this is it's supposed to exclude third-party packages. This is

02:16 actually amazing because in the workflow, one of the problems I've had before is I'm just like,

02:24 I've just got some, just starting out with a project, say, and I got some code in a directory.

02:29 I've got my virtual environment there also, same directory, throw some test code in there.

02:33 And I want to tell, you got to have to tell coverage. If you don't give it any flags,

02:39 it just measures everything. But now it doesn't. Now, if you say like coverage run pytest or coverage

02:47 run your, like whatever your module is, because there's, you can run coverage without tests too.

02:53 It's a thing. It just, it just grabs everything and reports everything. And that's hardly ever what

03:00 you want. So the change in 5.6 beta one is to, to, to knock out the third-party packages and,

03:07 and not collect those. And I tried it out on a couple of projects. I want to try it out on more,

03:12 but like, for instance, if you do it on your current direct, even if you say, give it just your current

03:17 directory, it's going to include all your virtual environment there if it's there also. And you know what that,

03:22 so this is a really cool thing. and he's, he's also, it's beta because he'd like to hear

03:29 from people to find out if there's problems. So go out and test it out. I haven't tried it on,

03:35 pytest plugins yet. That's what I'd like to do next, but this is cool.

03:39 Yeah, that's really nice because obviously you want to have code coverage of your code,

03:43 but you absolutely have no interest in testing other people's projects, right? There, there are packages

03:48 that you're using and whatnot. So yeah, that's perfect. Do you have to do anything to make this turn on?

03:52 well, yes, you have to right now, because it's in beta, you have to initially,

03:57 you have to install coverage equals equals we've got, we've got it in our show notes, but coverage

04:03 equals equals 5.6 B one. It's also in the, the blog post that we linked to, but, and it works

04:10 with, so I tried it also with the pytest dash cov plugin. And if you install pytest cov and then install

04:18 this other version of coverage, they'll work together and you can use them together too.

04:21 So yeah, very nice. Gwen, what's the coverage story for you all? You do, unit testing,

04:27 code coverage analysis, things like that.

04:30 So as far as for Python and Django projects, we do some testing, I would say not enough testing. So just like most companies I've worked at, we always have the discussion. We should do more testing. And sometimes we do more testing and sometimes we don't. So, our development team has been talking about it. So actually this package, code or coverage.py I've never used before, but I was reading about it in the show notes and looking it up before this episode. So I was like, Oh, yeah.

05:00 That's a really nice tool. I think I'm going to use it, but mostly we do unit testing.

05:04 Yeah.

05:04 like really complicated areas that we think might break or might have edge cases or something like that.

05:11 That's actually a great use for coverage because you can, like, if you specify the sort, like which source to cover, you can zoom in and say, I just have this little directory or this, these few modules of code. You can say, just cover those. And, and you can check the coverage on that.

05:28 Yeah.

05:29 That's interesting. So you could generate reports on different areas, even.

05:34 Yeah.

05:34 Yeah.

05:35 Yeah.

05:35 Nice.

05:36 Yeah. Like I only care about this part. So just tell me about this part. Yeah, that's perfect.

05:39 Yeah.

05:40 All right. Well, this next one that I want to cover has to do with platform as a service. So we often hear about Azure, AWS and, and the Python world. Heroku is very popular, but you know, these platform as a service places, you, where you get push your code and then it makes servers go.

05:56 Servers go and new versions get deployed and who knows how that happens. It's all well and good if you want to run in the public cloud, but what if you want to run just on your own servers? So Ian Maurer sent over this thing called Piku. So Piku is the tiniest pass platform as a service you've ever seen. It allows you to do a get push deployment to your own servers. Isn't that cool?

06:17 Yeah.

06:18 Yeah. Yeah. So the idea is you basically set this up on your server and then you connect it basically directly through GitHub. And then whenever you do a get push that automatically kicks off a new server creation.

06:33 I think it probably is running on Docker or something like that, but not a hundred percent sure. I haven't dug into the internal tout runs, but so here you can even see on, on the right of the homepage, which is an animated GIF. You can go and check that out.

06:46 But you just need to sort of see what it does. It says, as soon as you do a get push, it'll come along and says, you're remote creating as opposed to just, you know, writing objects, you know, push done. It like continues on. It says remote creating app, deploying app, your branches up to date.

07:00 Now your app is created creating virtual environment. And you can basically tell it what your requirements files is, what the execute file, just like Heroku, you give it a, like a proc file or something. It's called something like that, where it just basically says, when you run this project, what command do you give it?

07:17 And then it just runs. And that's, that's pretty cool. So it's really meant to be especially useful for low end devices. So I think this originates actually from working on Raspberry Pi. So like get push deploy to Raspberry Pi, which is a Raspberry Pi clusters, which is awesome.

07:36 So that one of its, you know, some of its core ideas are it's supposed to run on low end devices. It's supposed to be accessible for hobbyists and, you know, lower school, like K through 12 school grade students.

07:47 The whole platform as a service is about a thousand lines of code of Python, I think, and quite functional. It adheres to the 12 factor app of like separation of concerns and separation of configuration and login and so on.

08:02 Yeah. It's, it's pretty neat, pretty simple to use. And then you just install the client and then you just do your, your get pushes with this thing.

08:10 So if you've got a bunch of Raspberry Pis or other devices you want to use as a platform as a service, here's a pretty interesting option.

08:18 If you just have also plain Linux x86 machines and you want to make them be, you know, something like Heroku.

08:25 You know, I went through a lot of work over at TalkByThon training so we can get push to a production branch and that automatically kicks off this whole workflow that, you know, not just updates the requirements and installs the new ones and restarts it, but a little bit more than that.

08:40 It was a lot of work. This thing sounds really handy if you've got a pretty straightforward case, but you kind of want that same workflow.

08:46 Do you know, does it just work with GitHub or can I use it with other things too?

08:51 I think it just works with Git. I don't think it has anything to do with GitHub itself.

08:55 Oh, okay.

08:55 Yeah.

08:56 That's great.

08:57 Yeah. Yeah. It's pretty cool. So if you go and you watch, if you watch the GIF, the animated GIF and you click on it, it becomes like a little movie type thing.

09:04 You can see they start from an empty directory with the code that they create or the code is already there, but it's not in source control.

09:11 Then they get in it, the local repository, then they add a remote, which is not GitHub. And then as soon as they push to it, it kicks off the creation and running of this thing.

09:21 I think we're going to use this because just for like internal servers. So I've got internal projects that we can't host them on Heroku or something like that. That just ain't going to work.

09:32 Yeah.

09:33 But we could, you know, update the website and stuff and push to Git and have it pull it into the server automatically.

09:40 Yeah. There's all these little internal web apps that people run at companies that wouldn't make sense necessarily to run on a public cloud because maybe they need to talk to local infrastructure.

09:50 And you guys even have hardware devices where you're working that you actually talk to.

09:55 So yeah, here's a way to get a better deployment story without making it your next project to keep maintaining.

10:01 Nice.

10:02 Yeah. I was, I was looking at this and I have a somewhat clunky setup for personal projects where I have different Docker containers and watching and the Watchmen Docker container running on my servers.

10:15 So I was looking at this, I was like, that's so easy. Why don't I just use this?

10:20 Exactly. Yeah. I don't know how flexible it is and how much of a general solution it is. Cause like I said, I already have a solution that is like this, but I'm super glad to be able to just get, you know, get push to a certain branch.

10:32 And that means in 30 seconds, it'll be deployed in a consistent, reliable way that I don't have to think about. It's, it just makes it so easy to go, Oh, this, this part of the code is ready for production.

10:41 Get push. And as opposed to all the steps that a lot of people go through manually to do various things. So yeah, cool. Definitely neat. All right.

10:50 Gwen, you got the next one, something kind of in the news these days.

10:54 Yes.

10:55 So this kind of fit in with, you know, everything that's going on on Reddit and the news and everything. So blockchains, I think most of you have heard of blockchains and Bitcoin and Ethereum.

11:09 And there are ways to basically build applications for the blockchain using Python. So for example, web3.py is a popular library where you can interact with the Ethereum blockchain via a Python API.

11:30 So it's basically a wrapper that it gives you. And there's also a similar language to Python that was built for the Ethereum blockchain.

11:38 It's called Viper. So it's kind of a Python, get it? Python and Viper, they're both snakes.

11:45 But it's basically a Pythonic language. So you can actually write these smart contracts or applications for the blockchain in that language or in Solidity or, you know, some other language.

11:59 Yeah.

12:00 And you can deploy your applications to the blockchain and then you can interact with them or interact with any general blockchain information using Python with web3.py.

12:12 So it's a really robust library and solution. And especially with, you know, NFTs or non-fungible tokens and things like that being so big right now, you know, using web3.py,

12:28 you can also interact with those types of contracts that you deploy to the blockchain and build applications for people as well and for users.

12:37 Oh, this is really cool. You know, I haven't done nothing with the blockchain and nothing with cryptocurrency.

12:44 So Ethereum, is this more, this is more a blockchain thing, not a cryptocurrency thing? What's the distinction there or is it not?

12:52 So cryptocurrencies, basically, they're built on the blockchain, right? Or some other type of post-blockchain technology, which evolved from blockchain.

13:03 So you can use this to interact with cryptocurrencies.

13:14 So you can use this to interact with these. But you can also build really any type of application on the blockchain and use web3.py to interact with it.

13:23 Whether it's a voting application or some kind of exchange or whatever you want to do on the blockchain.

13:32 You will have the API interface with web3.py.

13:35 I just bring up non-fungible tokens because of all the artwork and, you know, all the hype around, what was it, Dogecoin.

13:44 Yeah.

13:45 And all of that stuff.

13:45 So you could have taken a screenshot of Brian and we can make it a non-fungible token and sell him.

13:50 What do you think we could get from Brian?

13:52 We could take multiple screenshots and just, you know, sell like hundreds of them.

13:58 Yes, exactly.

13:59 Yeah, I think the non-fungible token stuff is, it's really interesting.

14:03 It's really far out there.

14:05 But the blockchain seems to be the most concrete, practical, you know, you could build stuff.

14:10 Like you mentioned voting and other stuff, I could certainly see if the world could ever get it together.

14:15 Some kind of voting, online voting system based on the blockchain.

14:19 Yeah.

14:20 And some places, some organizations, and also I believe some countries and localities are already using the blockchain for things like that.

14:30 Nice.

14:30 I think it's even being talked about in our own government.

14:34 They have some committees that are talking about using blockchain in different ways, of course, with securities and how it's going to affect securities, but also with other possible future use cases, like things like voting.

14:47 Awesome.

14:47 Yeah, I'm going to have a woman from the FEC, Federal Election Commission, on Hawk Python to talk about using Python for the FEC.

14:57 And I feel like we definitely got to talk about blockchain.

15:00 That's interesting.

15:01 Yeah, that'll be fun.

15:02 Man, you get some cool hosts or guests on your show.

15:05 That's great.

15:06 Thanks.

15:07 Thanks.

15:08 Yeah, so I'm really excited with where blockchain is going, you know, being used in supply chain, in refugee camps, in pretty much every major bank now.

15:19 Every country is looking into blockchain.

15:22 So I think it's a really good thing to get on board with.

15:24 And Python is a really easy entry way to prototype anything in Python.

15:30 So you'll see a lot of people want to find out about blockchain, like their own test blockchain in Python to understand it.

15:38 But there are also libraries where you can interact with real blockchains like Hyperledger SDKs in Python.

15:45 So you can use different kinds of popular blockchains or the most popular blockchain now, which is Ethereum.

15:52 So you can interact with that via Web3.py.

15:55 Yeah.

15:55 Okay, cool.

15:56 If people want to check it out, this is a great recommendation.

15:59 Quick question from or comment from the live show.

16:03 Tune Army Captain says, at what point does this become about monetizing?

16:06 Orcruxes.

16:08 Orcruxes, yes.

16:09 Orcruxes.

16:10 Brian, help me out here.

16:12 I think so.

16:14 Yeah.

16:14 Today.

16:15 It's gotten there today.

16:17 Absolutely.

16:17 All right.

16:18 Well, very cool, very cool recommendation.

16:21 What's the next one that you got here, Brian?

16:23 I checked this out.

16:23 I'm super excited about this.

16:24 This is a great idea.

16:26 Yeah.

16:27 So this was a recommendation from Johannes Lippmann.

16:32 He mentioned in episode 227, we talked about Snyk.

16:39 Snyk?

16:39 S-N-Y-K.

16:40 Snyk.

16:41 Snyk.

16:42 Snyk.

16:42 Snyk Package Advisor, I think it was.

16:44 Yeah.

16:45 It tells you how, it gives you a health recommendation or health score on any package,

16:51 Python package.

16:52 Well, this is a similar, well, it's not really similar.

16:56 It's, I guess, in the same category.

16:57 So dead dependency.

16:59 So D-E-A-D-Pendency.

17:02 So this is a tool that's got, there's a paid version, but it's free for open source projects.

17:09 And it's a GitHub thing or GitHub application that you plug in.

17:14 Yeah, GitHub app.

17:14 Yeah.

17:15 And what it does is it looks at your dependencies.

17:19 And so if you, and it looks at the, it looks at a lot of stuff and it looks at, so let's,

17:25 I'm just going to bring up an example.

17:27 Somebody who wants to add some functionality to your service and they, or your project, they

17:34 change it to, and it adds a dependency.

17:37 One of the things you'll see in the pull request, if you use, if you use this is a dead dependency.

17:43 We'll go out and look to see how healthy that dependency is.

17:46 So you've got a new one in there.

17:48 And, and it's got a whole bunch of configurable options that I really think are pretty cool.

17:55 It checks for things like how recent was, wanted to make sure that there's recent, recent releases, recent commits.

18:02 And they're pretty broad.

18:04 The defaults are like, has there been a commit in the last 12 months?

18:09 Yeah.

18:10 Can you scroll down just like one page to the jQuery example?

18:13 Yeah.

18:13 Okay.

18:14 Yeah.

18:14 That's a great example right there.

18:15 Yeah.

18:16 So the, one of the, their example is you've got a jQuery UI that's added.

18:21 And what it does is it doesn't just check for one thing.

18:25 It looks for all of your dependencies and it shows that, you know, a couple like jQuery UI

18:30 hasn't been released for over 12 months.

18:33 And then a package called nom nom that's no commits for the last nine months.

18:39 And it's been deprecated in the package registry.

18:43 So it checks for deprecations and, and, and also things like, yeah, if it's been deprecated

18:49 or if there's just, it's gone down to a single author, maybe that might be at risk for some

18:54 projects.

18:55 So, but all of it's configurable.

18:57 So this is pretty neat.

18:58 Yeah.

18:58 I love the idea.

18:59 And it works not just for Python or as JavaScript as you mentioned, but also Rust, Ruby, C#,

19:05 Kotlin, a bunch of stuff.

19:07 Yep.

19:07 There are some, I tried it out and I couldn't get it to work, but I know why I couldn't get

19:13 it to work.

19:13 I'm using Flit now.

19:16 So I'm using pyproject.toml for my dependencies and stuff in my projects.

19:21 And this doesn't support it yet.

19:23 It supports requirements.txt and pip file.

19:25 And last night I was playing with it and I sent him an email and said, it'd be really great

19:30 if it would support setup.py and pyproject.toml.

19:33 And gosh, within an hour, I got a response back and said, yeah, you're right.

19:38 We should do pyproject.toml.

19:40 It's a simple format and we'll try to support it.

19:43 But setup.py, a little more difficult because as we know, setup.py has no real restrictions

19:50 on its formatting.

19:51 So there's a lot of crazy stuff out there for that.

19:54 Yeah, for sure.

19:56 Quinn, what do you think?

19:57 Yeah, I was just going to say I was going to try this out on a project, but I also use

20:02 poetry.

20:02 So I use pyproject.toml for the dependencies.

20:06 But like you said, it's an easy format.

20:10 So maybe if they support it soon, I'll try this out.

20:13 It seems like a really good idea.

20:15 Yeah, it's fairly new too.

20:17 It looks really slick.

20:18 Their website's all nice and great.

20:20 And I'm like, oh, they must have been up for a while.

20:22 As far as I can tell, it looks like at least their defect tracker, they've got a GitHub defect

20:27 tracker that's only been alive since last September.

20:31 And they already support a whole bunch of stuff.

20:34 So hopefully we'll get some new features here soon.

20:36 Yeah, fantastic.

20:38 And I just came up with a new idea for a GitHub bot.

20:40 So you have a GitHub bot that if you put a pyproject.toml or a pip file, it'll automatically

20:46 create the others and keep them in sync.

20:48 So if you check in your pyproject.toml, it'll automatically generate a requirements.txt that's

20:53 in sync.

20:53 And if you make changes, it'll update it.

20:55 And so you can work with whatever tools you want.

20:58 That's my new idea.

21:00 Isn't everything switching over to pyproject.toml now, though?

21:06 Well, for packages, it's not everything is.

21:09 A setup is going to be supported for a long time.

21:12 But you can use setup tools with pyproject.toml.

21:15 So there is a lot of people converting.

21:17 But that's for packages and stuff and libraries.

21:21 A lot of applications don't use anything like that.

21:24 They just use a requirements file.

21:26 Yeah, I used to use a requirements file.

21:29 And then I switched to using poetry like a year ago.

21:32 And I was like, what have I been doing all this time?

21:34 So much nicer.

21:35 Yeah, poetry is nice.

21:36 Very cool.

21:37 Yeah.

21:37 Speaking of switching to new things, I wanted to talk about all the important changes and

21:43 features in Python 3.10.

21:45 So excited.

21:46 So exciting.

21:47 Yeah.

21:47 So this is a blog post by Martin Hines.

21:52 Apparently, blog post number 47.

21:54 Look at the URL here, which is interesting.

21:56 And basically what it does, it just walks you through all the stuff coming in Python 3.10.

22:01 So Python 3.10 has been in alpha for a little while.

22:04 That means features changing.

22:05 But now it's about to go beta.

22:06 So it's about to stabilize.

22:07 And it's time to start thinking about what features are coming because they're most likely

22:12 going to be fixed as they are.

22:14 First thing it talks about is how to go through installing the alpha or the beta, whatever the

22:20 latest version is.

22:21 It's pretty simple.

22:22 So you just do the, you know, download and install from source, except for it has this

22:26 comment to say make install.

22:29 You're welcome to run make install, but that will make your Python 3 and your system be

22:33 the alpha Python 3.10, which you might not want to do.

22:36 I mean, you may, but you might not.

22:37 If you say make alt, A-L-T install, alt install is one word, then it'll just install it.

22:43 So you can refer to it as Python 3.10, but it won't replace your system Python, which I

22:48 would recommend.

22:48 So there's some interesting improvements for type checking.

22:52 One of the things that's really nice about Python is you have this optional type hint type

22:56 checking, type hint type annotation stuff, but it can get kind of crazy with the generics.

23:03 Like if I have a generator that returns a list of integer, I mean, it's just like the way

23:09 you express that and kind of almost like generic syntax, like generic from C++ style, it gets

23:15 a little wild.

23:16 So one of the improvements is around union because you can say, well, this thing will either take

23:20 an int or a float and I can just deal with it as basically a number.

23:24 So you used to have to say from typing import union, and then you would say union bracket

23:31 int comma float bracket.

23:33 And that was the thing.

23:34 So now you can just use the pipe or the or the bitwise or operator.

23:39 So int or vertical pipe float.

23:41 And that tells you it's a int or a float.

23:44 What do you think of this?

23:44 You'll like it?

23:46 I think it's nice.

23:47 That seems cleaner to me.

23:48 Yeah.

23:49 Wonky.

23:50 Yeah.

23:51 I didn't like the union before.

23:52 I mean, I was glad it was there because we needed it, but the or makes it nice and clean.

23:57 Yeah.

23:57 I almost never used the union because it was just, it was just messy.

24:00 Anyway, this is pretty nice.

24:02 There's also some stuff about is instance and is instance.

24:06 So you can, you know, that exists already, but you can pass this int or string, you know,

24:11 int pipe string in, and it'll tell you if it's either an int or a string as an instance,

24:16 which is kind of a cool thing as well.

24:18 Oh, wow.

24:19 Yeah.

24:19 You can also create type aliases and you could do that previously.

24:23 So if I have a thing, I want to call a file name and right now it's a string, but maybe

24:27 it becomes a class later because we're going to upgrade it.

24:30 And I just want to refer to it as this right now as a file name, right?

24:33 So you used to say file name equals str, S-T-R.

24:37 And there's no real way to understand that.

24:39 I'm just, I'm trying to create a type definition, but in fact, it just tells me, well, there's

24:44 this other name for the string class, right?

24:46 And that worked, but there was no way for the tools to know what your intention was.

24:51 So now there's going to be a file name colon type alias equals string.

24:55 And that will tell you file name is an actual alias for the class string, not just it happens

25:00 to be a thing that looks a whole lot like it.

25:02 So that's kind of cool.

25:03 There's some stuff about knowing on integers to figure out how many bits are involved.

25:09 That's not super applicable or usable.

25:11 Disky tools, speaking, I mean, you may want to know, but it's like not, I doubt it's a big

25:16 question.

25:16 People want to know often.

25:17 Disk details are being deprecated and they've pretty much been deprecated for a while and

25:23 you should be using setup tools and packaging.

25:25 But, you know, they were officially deprecated in 3.10 and will be gone in 3.12, just so you

25:30 all know.

25:31 This next one I'm excited about quite a bit.

25:33 It's super common to want to have more than one thing that is tied to a context block, like

25:40 a with statement.

25:42 So if I'm going to open two files and I want to make sure I close them both, even if there's

25:46 an error, it would make a lot of sense to say with file one, with file two.

25:51 And so what were your options?

25:52 You could have one with block and then indent another one just to have the second file, which

25:56 is weird.

25:57 You could create the files separately, the file object separately and say with file one, comma

26:03 file two, and then use them.

26:04 That actually worked.

26:05 But what if file two crashed when you tried to create it, then file one would leak?

26:10 And there's just like all these weird situations.

26:12 So now with blocks support multiple lines with parentheses.

26:16 So I can say with parentheses thing one that has to be managed in the context thing two that

26:21 has to be managed in the context and so on, and then work with them.

26:24 And they're treated as a block, which I think is sweet.

26:27 That's going to be very useful because I've had times where we've had two or three levels

26:31 all the time.

26:32 So yeah.

26:33 Yeah.

26:33 So you're usually juggling some edge case that might not quite work, but usually works.

26:37 And this is just make it part of the language, make sure it always works.

26:40 I love it.

26:40 Also a performance.

26:42 So it brings some performance improvements for constructors like strings, bytes, byte arrays,

26:49 and so on.

26:50 And then also working with functions that have type annotations, I think are something

26:55 like two times faster.

26:57 They are now the type annotations are evaluated at compilation time.

27:02 They are evaluated at runtime, which would slow them down.

27:05 So that's nice.

27:06 And then the big one is the switch statement, which we're not calling switch statement.

27:11 It's pattern matching.

27:12 And we actually talked a lot with Brett Cannon about that.

27:15 And I think people appreciated that episode where we got to dig into that, right?

27:18 Yeah.

27:18 Yeah, that was fun.

27:19 So there's some nice examples of what you can do, like basically how it works, you know,

27:24 match on day, case Monday, case Friday, case Saturday or Sunday, and so on.

27:29 And then some more interesting ones about matching objects like classes where you're looking at

27:35 multiple fields.

27:35 So you can match on age and you could match on gender.

27:40 This is like a person example, name, age, gender, and you could match on different things.

27:45 And depending on how it matches, you kind of fall into these case statements.

27:48 So we've gone over that a lot.

27:49 I don't want to dive into it too much, but pretty neat to see these examples here.

27:54 So that's, I would say that's the big change that's coming.

27:56 Don't know what you two think.

27:57 Do the case statements fall through like JavaScript?

28:00 There is a fall through.

28:02 It's not in these examples, but there is a fall through mechanism.

28:05 Okay.

28:06 But not by default.

28:08 Well, it's not called default, but I think there is, I can't remember the syntax.

28:11 Oh, I mean like, so from the first case.

28:15 Oh, right.

28:16 Yeah.

28:17 Yeah.

28:17 You don't have to say break.

28:18 I don't think it falls through.

28:19 Yeah.

28:20 It doesn't fall through.

28:20 Yeah.

28:21 Yeah.

28:21 Because in C++, if you don't say break, you're going to print all, it's going to run every

28:26 case top to bottom, right?

28:27 Well, depending where it matches, from where it matches onward, basically.

28:30 Yeah.

28:31 No, I don't think it falls through in that sense.

28:33 But there's a default.

28:36 But the fall through mechanism in C++ and C and Java, other type language, C-like languages,

28:43 it's caused me more problems than it ever solved.

28:46 I mean, I've actually wanted it to fall through.

28:49 I'd rather have a fall through keyword than have it have to put a break everywhere.

28:54 Yeah.

28:55 I agree.

28:55 Yeah.

28:56 I just use my go-to statements and we're good.

28:57 So, it's still fine.

28:58 Dean out there in the live stream says, can't wait for 310 now with a double context or multi-line

29:05 context.

29:05 I agree.

29:06 Those are quite awesome.

29:09 I think that's a really good feature.

29:10 And it's super simple.

29:11 So, I like that a lot.

29:12 I wanted to add a couple things.

29:14 I just found out today that one of the things that's going in 310 is some better error messages

29:25 if you use an attribute error, if you try to access from name tuple import something else.

29:34 And you get something wrong.

29:35 And you get something wrong.

29:36 It tries to give you a suggestion for what the right thing is.

29:40 And that'll be really cool, especially for working on the REPL and stuff.

29:44 And I also wanted to point out that I don't think I would build Python.

29:49 I would just download it.

29:51 If you Google Python 310 download, you can get it just from Python.org.

29:57 You can download it there.

29:59 Without compiling it?

30:00 Yeah.

30:01 It's just the installer.

30:02 I'll put a link in the show notes.

30:03 Yeah.

30:04 Or use PyEv.

30:05 Yeah, PyEv.

30:06 Right.

30:07 Yeah.

30:07 You can use PyEv.

30:08 Yeah.

30:08 Sure.

30:08 Cool.

30:09 All right.

30:10 Well, that brings us to the next item, but I don't have the link to it.

30:14 That's yours, Glenn.

30:15 So you want to tell us about it?

30:16 I think I can just Google it.

30:18 I'm not going to Google it.

30:19 I'm going to DuckDuckGo, but carry on.

30:20 Good.

30:21 I use DuckDuckGo too.

30:22 Nice.

30:23 So yeah, I wanted to give a shout out to FreeCodeCamp's Python curriculum.

30:29 So last year, they launched a Python curriculum with, I think it's almost a thousand hours of

30:37 curriculum material between challenges, lessons, and of course, projects and certifications as

30:47 well on topics from Python basics to data science, machine learning, algorithms, all sorts of things.

30:54 And that's in addition to the thousands of hours they already had learning JavaScript and basic

31:00 programming skills and algorithms and other types of things.

31:04 So that Python curriculum was in the works for a few years.

31:08 I've been a top contributor with FreeCodeCamp for a couple of years.

31:12 So I got to go to their summit before the whole COVID thing hit.

31:16 And I remember everyone getting together, kind of talking excitedly several years ago about Python

31:22 coming out.

31:23 So it was definitely in the works for a long time.

31:25 And a lot of people put a lot of effort into it.

31:28 So I think it's a really good curriculum.

31:30 And FreeCodeCamp has also done a really good job of putting out a lot of supplementary material

31:38 in Python and data science.

31:39 So you can see on their YouTube channel, I believe they have over 100 hours of Python content,

31:46 including this one 12-hour Python data science crash course on their YouTube channel.

31:52 And they also have one of the most popular developer blogs on the internet.

31:57 I'm also a writer for them.

31:58 So recently I wrote one Django article and I have a whole bunch more Django articles that I'm

32:06 planning to write when I get around to it.

32:08 So as far as Python education, I think this is a really good option that's free, accessible

32:17 to anybody, even on mobile devices.

32:20 And one that stayed true to its mission.

32:22 It didn't just build to kind of sell out to another company.

32:25 But since I believe the end of 2014, when it's launched, it's kept this mission of making coding

32:33 education accessible to everyone.

32:35 So I think they've done a really good comprehensive job of now adding Python onto that.

32:40 Oh, and they're also adding on...

32:42 Right now they're working on an even bigger expanded curriculum for that data science and machine

32:51 learning that they have right now in Python.

32:52 It's going to include all the different math and a lot more elements of machine learning than

32:59 it currently covers.

33:00 So yeah, I'm excited for that.

33:02 They were raising money for it this year and they've been working on it since last year.

33:07 So I'm hoping we'll see at least the initial stages of that soon.

33:11 Yeah, very cool.

33:12 I put my...

33:14 I worked with them to put my free MongoDB course up there, which is a Python course.

33:18 Oh, awesome.

33:19 A little bit up there, yeah.

33:20 What were you using with MongoDB?

33:23 It was just some...

33:25 It wasn't even a real web framework.

33:26 It was something that kind of was just a simple CLI app that talked to it to keep it not complex.

33:31 Oh, okay.

33:32 Yeah.

33:33 Very cool.

33:34 I've been using Django for Django and MongoDB.

33:38 Okay, that's cool.

33:39 It actually works pretty well, except the migrations are a little bit funky.

33:44 Okay.

33:45 So it's not easy to roll back the migrations like it is if you use Postgres.

33:51 But overall, it works really well and you can use the same ORM in Django.

33:56 Oh, that's fantastic.

33:57 I use MongoEngine for my main stuff, which is very much modeled on Django, but it's not Django itself.

34:04 Yeah.

34:04 Nice.

34:05 Let's see.

34:06 Really quick, a couple of fallbacks.

34:08 Robert Robertson says they should create an error message package that breaks down your error into plain English.

34:13 That's a good idea.

34:14 Cool.

34:14 Yeah, that's a great idea.

34:16 And then Dean says there are third-party packages that do it nicely.

34:18 Brian, do you remember if we've covered any?

34:20 I don't.

34:20 I mean, Dean, if you've got some ideas, throw them out there.

34:22 I think we do, but I think we did cover them, but I don't remember them.

34:25 I know we've covered stuff that do things like pretty print the message or highlight certain parts so it's clearer.

34:32 Yeah.

34:32 But I feel like it would be cool if it would just print the first stack overflow response, accepted response underneath the crash.

34:41 That would be fantastic.

34:43 Well, and we talked about possibly just formatting your error message nicely so that you could Google it or duck-duck-go it of like how to search for this on the internet.

34:55 So, like escaping quotes and things like that.

34:57 Exactly.

34:58 That'd be cool.

34:59 Somebody else, let's see, PyLine mentioned, and I think this is right, that the fall-through on the pattern matching is the underscore.

35:08 I think that's correct.

35:09 Is that the default?

35:10 I think that's the default case, not the fall-through.

35:12 Is that right?

35:13 Right.

35:13 Right.

35:13 Not the fall-through, the default case.

35:15 Yeah.

35:15 Okay.

35:15 Thanks.

35:16 So, I don't think there is a way to, I don't know.

35:19 There might be a way to fall-through.

35:20 There's like always, yeah, I don't know.

35:23 I haven't played with it yet.

35:24 Yeah.

35:24 Dean points out that we covered the one that has, you can ask why.

35:27 Remember, you'd ask like why, what?

35:30 There's a bunch of Ws, and we're kind of coming up with the name of like a name for the better name or for another what we can ask, like WTF or something like that.

35:40 I don't remember what that's called, though, sadly.

35:41 That was a fun one.

35:43 Oh, that'd be a great package name, Python WTF.

35:46 All right, Brian, is that it for our main topics?

35:49 Yeah.

35:49 Yeah.

35:50 All right.

35:51 You got any extras you want to cover?

35:52 Yeah.

35:53 I do, as always, but yeah, how about you?

35:55 Well, I don't know when it'll get released, but I just recorded it.

35:59 But a few episodes ago, we talked about Python Adventure, so an adventure game, a text-based adventure in Python.

36:06 Yeah, there's Python.

36:08 Yeah, I got to talk to the creator on the testing code, so there'll be an upcoming testing code.

36:15 I'll go in-depth into that, so that'll be good.

36:17 Yeah, yeah, very fun.

36:18 How about you?

36:20 Let's see.

36:21 I got a couple things.

36:22 Let's see this one.

36:24 We talked about the Supreme Court ruling on Java, the Google versus Oracle.

36:29 Maybe for the Oracle versus Google is maybe how it should be said.

36:32 But I think it's just, in passing, interesting that Microsoft has now unveiled its own Java distribution,

36:38 the Microsoft version of OpenJDK, to compete with Oracle in the Java distribution space.

36:44 I know that we're not really a Java podcast, for sure, and I don't do any Java, but I think it's an interesting open source follow-on to covering that last time.

36:53 What do you think?

36:54 I think this is going to be big.

36:57 A lot of people already have Microsoft distributions all over their workplace.

37:01 Yeah.

37:02 Gwen?

37:02 Yes.

37:03 Any comments?

37:04 Any thoughts?

37:04 Oh, comments on Java?

37:07 Yeah, yeah, yeah.

37:08 This ain't no.

37:08 Okay.

37:09 I got a couple more, and then I know you have some things to throw out there as well.

37:14 It's a very colorful splash screen, which is always fun.

37:18 But its main thing is it has much better support for a Windows subsystem for Linux.

37:23 It has better indexing, so much faster indexing.

37:28 It does cool things like if you need to type, let's say you have requests installed, but you haven't imported it into the file.

37:36 If you type RG, it very likely may propose to you request.get as an autocomplete option.

37:45 If you choose it, it'll write import request and then autocomplete request.get all in one tab completion.

37:52 So they've done some really cool stuff with the autocomplete to kind of ramp that up.

37:56 And there's a few other things as well.

37:57 But yeah.

37:58 Anyway, if people are into that, check that out.

38:00 We covered Beanie a couple times.

38:03 We covered Beanie the first time introducing it, which is an ODM for MongoDB based on Pydantic, which is super cool, by Roman Wright.

38:12 And then I said, I reached out to him and said, oh, that's great, but you should have a way to add indexes.

38:17 So he did, which was really cool.

38:19 And Gwen just mentioned migrations.

38:21 So he just added migrations for Beanie as well.

38:25 And there's some really interesting ways to write your migrations and convert from one schema to another.

38:31 So basically you say, here's the old model.

38:33 Here's the new model.

38:34 Fix it.

38:35 It's more or less the way that you say that.

38:38 So yeah, that's pretty cool.

38:40 We already covered it, but definitely just a neat thing to see that he's adding it.

38:45 So congrats on seeing that thing grow.

38:47 Gwen, I know you got a couple of things you want to talk about.

38:50 Mem.dev.

38:51 That's a really cool thing.

38:52 I didn't know about this before, but I checked it out when you put it in the show notes.

38:55 Yeah, it's basically a spaced repetition learning system, but built specifically for developers.

39:01 So a lot of people use Anki, which is its own algorithm.

39:05 I also use Anki synced across my desktop and mobile phone and everything.

39:10 To learn different concepts, mostly programming, computer science, all of that stuff.

39:15 But one thing I like about also using Mem.dev is that there's a browser plugin and I can

39:22 directly copy snippets from places like Stack Overflow.

39:27 In all those coding boxes, it will have like a Mem.dev icon in the corner of any coding box.

39:33 And I can just copy the snippet to make into a card later on Mem.dev.

39:39 Another really cool feature is it lets you practice keyboard shortcuts now.

39:44 So to get faster and better as a developer, it's really good to practice different kinds of keyboard shortcuts.

39:53 Also, I find it helpful because things like Django have a massive API.

39:57 And as a consultant, I feel like I'm being pulled in so many directions.

40:02 It's really hard for me to keep up with everything I'm doing and still feel like I'm really good at the technologies I'm using.

40:11 So that's why I'm using supplementary resources like these space repetition learning systems.

40:16 So I don't forget different parts of the API, even if I haven't used it in a couple months,

40:22 because I'll have to recall that for a future project or something like that.

40:26 Yeah.

40:26 So I looked at this and you can go to places and sort of save these web snippets

40:32 and then turn them into stuff you want to remember and practice, almost like flashcards.

40:36 So one example is if I'm on Stack Overflow and I see some code, I can go to that code thing and say,

40:40 make this a snippet.

40:41 And then I could even upgrade that to this like repetition practice.

40:45 Yeah, that's pretty neat.

40:46 Yeah.

40:47 Cool.

40:48 And then what about Graphene Django?

40:52 Yeah.

40:53 So this probably isn't a secret to anybody.

40:56 So it's basically the kind of the standard package to be able to use GraphQL with Django.

41:04 But as I've been using it more and more, because I use mostly Django REST framework,

41:09 but now that I'm using Graphene Django, it's like, oh, this is so nice.

41:14 You know, I don't have to update and manage all of these different endpoints.

41:19 I just have one endpoint.

41:20 And then I'm managing, you know, how my data gets sent back from my different schemas and stuff.

41:30 I feel like as your application grows, it's much more easy to manage and maintain with GraphQL than with a standard REST interface.

41:41 So that's something that I've been playing around with a lot.

41:44 I want to, before I use it in a professional project, I want to kind of get better with using authentication with it.

41:51 So there is kind of a standard library for Graphene Django.

41:56 I think it's called Graphene Django Auth and it uses JWT tokens.

42:00 So I'm going to play around with that a little bit soon.

42:03 Yeah.

42:04 Very cool.

42:04 Yeah.

42:05 So it's Django enhancement built upon Graphene itself.

42:09 Yes.

42:09 Very cool.

42:11 And Brian, out in the live stream, who was it that it told us?

42:16 It was Dean.

42:17 Dean told us that we did in fact cover Friendly, the Friendly library, which allows you to ask, you know, it gives you, when it crashes, you get like, what is it?

42:28 Like a little REPL type thing that you can go ask questions about.

42:31 Yeah.

42:32 That's the one where you're going to ask who, what, why, where.

42:34 Yeah, exactly.

42:35 Yeah.

42:36 I guess maybe not who.

42:37 Yeah.

42:38 Perfect.

42:38 That's interesting.

42:39 That's it for this one.

42:40 Well, thanks a lot for joining us, Gwen.

42:43 Yeah, thank you.

42:44 Yeah, Gwen, it was great to have you here.

42:45 Thanks so much for being here and keep up the good work on YouTube and everywhere else.

42:50 Yeah.

42:50 Thanks, Michael.

42:51 Thanks, Brian.

42:52 Yeah, you bet.

42:53 Bye, Brian.

42:53 Bye, everyone.

Back to show page