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.

00:09 And I am Brian Okken.

00:10 I'm Michael Kennedy.

00:11 Hi, I'm Gwen Farraday.

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

00:15 Yeah, thanks for having me.

00:16 We invited you because you're doing really cool stuff with Python, and you're doing some neat things on YouTube, and some, are you doing live streaming as well, or just videos?

00:25 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. We do almost entirely Django projects there. And I've really loved getting to use Django for the past couple years. On the side, I also teach at a coding school where we do full stack JavaScript. But most of our back end and computer science curriculum is actually Python. And then we also use Django for the final portion of the curriculum as well as the final project.

00:58 And then on the side, as Michael mentioned, I really like to make videos and content and things like that.

01:06 So I've done a mixture of JavaScript and Python content under the name Faraday Academy.

01:13 And I also have Twitch live streams.

01:15 So most recently for Python, I've been kind of diving into FastAPI live and trying to learn async Python since I haven't really done much with async Python in the Django world.

01:28 - Nice.

01:29 - Yeah, super fun.

01:30 FastAPI is great.

01:31 - Yeah, it's awesome.

01:32 - And technology to work with.

01:33 So you sound like you're busy, but in a good way.

01:36 - But I love programming, so it's like my passion.

01:39 It's not burdensome, I guess.

01:41 - Yeah, it doesn't count as work.

01:42 That's great.

01:43 Brian, you want to kick us off?

01:45 - Yeah, the first story I want to cover is about coverage.

01:48 (laughing)

01:49 Couldn't help the bad pun.

01:50 So Ned Batchelder put a post out just the other day.

01:56 there's a beta out for coverage.

01:58 It's a 5.6 beta one, and it's a big revamp.

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

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

02:16 This is actually amazing because in the workflow, one of the problems I've had before is, I'm just starting out with a project.

02:26 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:34 You have to tell coverage, if you don't give it any flags, it just measures everything.

02:42 But now it doesn't.

02:44 Now if you say coverage run pytest or coverage run your whatever your module is because you can run coverage without tests too, that's a thing.

02:54 It just grabs everything and reports everything, and that's hardly ever what you want.

03:00 The change in 5.6 Beta 1 is to knock out the third-party packages and not collect those.

03:09 I tried it out on a couple of projects, I want to try it out on more.

03:12 But for instance, if you do it on your current directory, even if you say, give it just your current directory, it's going to include all your virtual environment there if it's there also, and you don't want that.

03:22 So this is a really cool thing.

03:24 And he's also, it's beta because he'd like to hear from people to find out if there's problems.

03:31 So go out and test it out.

03:33 I haven't tried it on pytest plugins yet.

03:36 That's what I'd like to do next, but this is cool.

03:39 - Yeah, that's really nice because obviously you wanna have code coverage of your code, but you absolutely have no interest in testing other people's projects, right?

03:47 There are packages that you're using and whatnot.

03:49 So yeah, that's perfect.

03:50 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.

03:56 You have to initially install coverage equals equals.

04:00 We've got it in our show notes, but coverage equals equals 5.6b1.

04:05 It's also in the blog post that we linked to.

04:08 And it works with, so I tried it also with the pytest-cov plugin.

04:14 And if you install pytest-cov and then install this other version of coverage, they'll work together and you can use them together too.

04:22 - Yeah, very nice.

04:23 Gwyn, what's the coverage story for you all?

04:25 Do you do unit testing, code coverage, analysis, things like that?

04:30 - So as far as for our Python and Django projects, we do some testing.

04:37 I would say not enough testing.

04:39 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.

04:47 So our development team has been talking about it.

04:50 So actually this package, coverage.py, I've never used before, but I was reading about it in the show notes and looking it up before this episode.

04:59 So I was like, "Oh, that's a really nice tool. I think I'm going to use it." But mostly we do unit testing on 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 these few modules of code, you can say, just cover those and you can check the coverage on that.

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

05:34 >> Yeah.

05:35 >> Nice.

05:36 >> Yeah. I only care about this part, so just tell me about this part. 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 in the Python world, Heroku is very popular. But you know, these platforms as a service places you where you get push your code, and then it makes 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 past platform as a service you've ever scene and allows you to do a get push deployment to your own servers.

06:17 Isn't that cool?

06:17 Yeah.

06:19 Yeah.

06:19 So the idea is you basically set this up on your server and then you connect it basically directly through GitHub.

06:26 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 the right of the homepage, which is an animated GIF. You can go and check that out. But you just 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 push it done, it like continues on. It says remote creating app, deploying app, your branch is up to date. Now your app is detected 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.

07:12 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.

07:19 And that's pretty cool.

07:20 So it's really meant to be especially useful for low end devices.

07:25 So I think this originates actually from working on Raspberry Pi.

07:29 So like git push deploy to Raspberry Pi, which is a Raspberry Pi clusters, which is awesome.

07:36 So one of its, you know, some of its core ideas are it's supposed run on low-end devices, it's supposed to be accessible for hobbyists and lower school, like K-12 school grade students. 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 separation of concerns and separation of configuration and login and so on. Yeah, it's pretty neat, pretty simple to use. And then you just install the client and then you just do 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 if you just have also plain Linux x86 machines and you want to make them be something like Heroku.

08:25 I went through a lot of work over at Talkby.training so we can get push to a production branch and that automatically kicks off this whole workflow that not just updates the requirements and installs the new ones and restarts it.

08:39 But a little bit more than that, it was a lot of work.

08:41 This thing sounds really handy if you've got a pretty straightforward case, but you want that same workflow.

08:46 >> Does it just work with GitHub or can I use it with other things too?

08:51 >> I think it just works with Git.

08:52 I don't think it has anything to do with GitHub itself.

08:55 >> Okay. That's great.

08:57 >> Yeah, it's pretty cool.

08:58 If you go and you watch 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.

09:09 The code is already there, but it's not in source control.

09:11 Then they get init 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 internal servers, so we've got internal projects that we can't host them on Heroku or something like that.

09:31 That just ain't going to work.

09:33 But we could, you know, update the website and stuff and push to get and have it, 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:51 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 maintaining.

10:02 - Nice.

10:03 - Yeah, 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 Watchman Docker container running on my servers.

10:15 So I was looking at this, I was like, that's so easy.

10:18 Why don't I just use this?

10:20 - Exactly.

10:21 Yeah, I don't know how flexible it is and how much of a general solution it is.

10:25 'Cause like I said, I already have a solution that is like this, but I'm super glad to be able to just git push to a certain branch, and that means in 30 seconds it'll be deployed in a consistent, reliable way that I don't have to think about it, it just makes it so easy to go, oh, this part of the code is ready for production, git push, as opposed to all the steps that a lot of people go through manually to do various things.

10:47 So yeah, cool, definitely neat.

10:49 All right, Gwen, you got the next one?

10:51 Something kind of in the news these days?

10:54 - Yes, so I got this kind of fit in with everything that's going on on Reddit and the news and everything.

11:02 So blockchains, I think most of you have heard of blockchains and Bitcoin and Ethereum.

11:10 And there are ways to basically build applications for the blockchain using Python.

11:17 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.

11:33 And there's also a similar language to Python that was built for the Ethereum blockchain.

11:39 It's called Vypr.

11:40 So it's kind of Python, get it Python and Vypr, they're both snakes.

11:46 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 some other language.

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.

12:16 And especially with NFTs or non-fungible tokens and things like that being so big right now.

12:25 Using web3.py, 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:38 - Oh, this is really cool.

12:39 I haven't done nothing with the blockchain and nothing with cryptocurrency.

12:44 So Ethereum, is this more a blockchain thing, not a cryptocurrency thing?

12:49 What's the distinction there?

12:51 Or is it not?

12:52 So cryptocurrencies, basically they're built on the blockchain, right?

12:59 Or some other type of post blockchain technology which evolved from blockchain.

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

13:10 I think people have built trading bots and different things with these.

13:15 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, 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 and all of that stuff.

13:45 I'm thinking of taking 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:53 We could take multiple screenshots and just sell like hundreds of them.

13:58 Yes, exactly.

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

14:03 It's really far out there, 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.

14:11 I could certainly see if the world could ever get it together, some kind of online voting system based on the blockchain.

14:19 Yeah, 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:31 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.

14:41 but also with other possible future use cases, like things like voting.

14:47 >> Awesome. 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 I feel like we definitely got to talk about blockchain.

15:01 >> That's interesting.

15:01 >> Yeah, that'll be fun.

15:02 >> Man, you get some cool hosts or guests on your show. That's great.

15:06 >> Thanks.

15:08 Yes, 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, every country is looking into blockchain. So I think it's a really good thing to get on board with.

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

15:30 So you'll see a lot of people want to find out about blockchain, and they'll build 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 could interact with that via web3.py.

15:55 Yeah. Okay, cool. 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 Tuna Army Captain says, "At what point does this become about monetizing?" Or cruxes.

16:08 Or cruxes, Brian, help me out here.

16:10 I think so.

16:14 Yeah.

16:15 Today. It's gotten there today.

16:17 Absolutely. All right. Well, very cool, very cool recommendation.

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

16:23 I checked this out. I'm super excited about this.

16:25 This is a great idea.

16:27 >> Yeah. This was a recommendation from Johannes Lippmann.

16:33 He mentioned in Episode 227, we talked about SNYK.

16:40 >> SNYK. Package Advisor, I think it was.

16:44 >> Yeah. It gives you a health recommendation or health score on any package.

16:51 Python package. Well, it's not really similar.

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

16:58 Dead dependency.

17:00 D-E-A-D dependency.

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

17:09 It's a GitHub thing or GitHub application.

17:13 >> Yeah, GitHub app.

17:15 >> What it does is it looks at your dependencies.

17:20 It looks at a lot of stuff.

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

17:27 Somebody who wants to add some functionality to your project, they change it and it adds a dependency.

17:37 One of the things you'll see in the pull request, if you use this, is a dead dependency will go out and look to see how healthy that dependency is.

17:47 So you've got a new one in there, 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 releases, recent commits.

18:02 And they're pretty broad. The defaults are like, has there been a commit in the last 12 months?

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

18:13 Yeah.

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

18:16 >> Yeah. Their example is you've got a jQuery UI that's added.

18:22 What it does is it doesn't just check for one thing, it looks for all your dependencies and it shows that jQuery UI hasn't been released for over 12 months.

18:33 Then package called nom nom, that's no commits for the last nine months, and it's been deprecated in the package registry.

18:43 It checks for deprecations and also things like, yeah, if it's been deprecated or if it's gone down to a single author, maybe that might be at risk for some projects.

18:55 But all of it's configurable, so this is pretty neat.

18:58 >> Yeah, I love the idea.

18:59 It works not just for Python or as JavaScript as you mentioned, but also Rust, Ruby, C#, Kotlin, bunch of stuff.

19:07 >> Yeah. I tried it out and I couldn't get it to work, but I know why I couldn't get it to work.

19:14 I'm using Flit now, so I'm using pyproject.toml for my dependencies and stuff in my projects, and this doesn't support it yet.

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

19:26 Last night I was playing with it and I sent him an e-mail and said, "It'd be really great if it would support setup.py and pyproject.toml." Gosh, within an hour, I got a response back and said, "Yeah, you're right. We should do pyproject.toml." 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 on its formatting.

19:52 There's a lot of crazy stuff out there for that.

19:54 >> Yeah, for sure. 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 poetry, so use pyproject.toml for the dependencies.

20:07 But like you said, It's an easy format, 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:19 Their website's all nice and great.

20:20 I'm like, "Oh, they must have been up for a while." As far as I can tell, it looks like at least their defect tracker, they've got a GitHub defect tracker that's only been alive since last September.

20:32 They already support a whole bunch of stuff, so hopefully, we'll get some new features here soon.

20:37 Yeah, fantastic. 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 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 in sync. And if you make changes, it'll update it.

20:55 And so you just work with whatever tools you want. That's my new idea.

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

21:06 >> Well, for packages, not everything is.

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

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

21:15 There is a lot of people converting.

21:18 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:27 >> I used to use a requirements file and then I switched to using Poetry like a year ago.

21:32 I was like, what have I been doing all this time? So much nicer.

21:35 - Yeah, poetry's nice, very cool.

21:38 Speaking of switching to new things, I wanted to talk about all the important changes and features in Python 3.10.

21:46 - So excited.

21:47 - So exciting, yeah.

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

21:52 Apparently, blog post number 47, 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 feature is changing, but now it's about to go beta, so it's about to stabilize and it's time to start thinking about what features are coming because they're most likely gonna 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 latest version is.

22:21 It's pretty simple.

22:22 So you just do the download and install from source, except for it has this comment to say make install.

22:29 You're welcome to run make install, but that will make your Python 3 in your system be the alpha Python 3.10, which you might not want to do.

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

22:38 If you say make alt, A-L-T, install, alt install is one word, then it'll just install it so you can refer to it as Python 3.10, but it won't replace your system Python, which I would recommend.

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

22:53 One of the things that's really nice about Python is you have this optional type hint, type 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 you express that and kind of almost like generic syntax, like generic from C++ style, it gets a little wild.

23:16 So one of the improvements is around union, 'cause you can say, well, this thing will either take an int or a float, and I can just deal with it as basically a number.

23:25 So you used to have to say, from typing import union, And then you would say union bracket int comma float bracket and that was the thing.

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

23:39 So int or, you know, vertical pipe float and that tells you it's a int or a float.

23:44 What do you think of this?

23:45 Yeah, you like it?

23:46 - I think it's nice.

23:47 - That seems cleaner to me.

23:48 - Yeah, I didn't really like it.

23:49 - The union stuff is wonky.

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

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

23:57 - Yeah, I almost never used the union 'cause it was just messy.

24:01 So anyway, this is pretty nice.

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

24:06 So you can, that exists already, but you can pass this int or string, int pipe string in, and it'll tell you if it's either an int or a string as an instance, which is kind of a cool thing as well.

24:18 - Oh, wow.

24:19 - Yeah, you can also create type aliases, and you could do that previously.

24:23 So if I have a thing I wanna call a file name, and right now it's a string, but maybe it becomes a class later, 'cause we're gonna upgrade it.

24:30 And I just wanna 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, and there's no real way to understand that I'm just, I'm trying to create a type definition, but in fact, it just tells me, well, there's 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 gonna be a file name colon type alias equals string, and that will tell you file name is an actual alias for the class string, not just it happens to be a thing that looks a whole lot like it.

25:02 So that's kind of cool.

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

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

25:11 Disk details, speaking of, I mean, you may want to know, but it's like not, I doubt it's a big question people want to know often.

25:18 Disk details are being deprecated.

25:20 They've pretty much been deprecated for a while.

25:23 You should be using setup tools and packaging, but they were officially deprecated in 3.10 and will be gone in 3.12, just so you all know.

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

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

25:42 So if I'm gonna open two files and I wanna make sure I close them both, even if there's 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're gonna have one with block and then indent another one just to have the second file, which is weird, you could create the files separately, the file objects separately, and then say with file one comma file two, and then use them, that actually worked.

26:05 But what if file two crashed when you tried to create it, then file one would leak, and there's just like all these weird situations.

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

26:17 So I can say with parentheses, thing one that has to be managed in the context, thing two that has to be managed in the context, and so on.

26:23 and then work with them and they're treated as a block, which I think is sweet.

26:27 - That's gonna be very useful 'cause I've had times where I've had two or three levels all the time, so.

26:32 - Yeah, yeah, so you're usually juggling some edge case that might not quite work, but usually works, and this is just make it part of the language, make sure it always works, I love it.

26:40 Also, a performance.

26:43 So it brings some performance improvements for constructors like strings, bytes, byte arrays, and so on.

26:50 And then also feeding, working with functions that have type annotations, I think, are something like two times faster.

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

27:02 They usually evaluate at run time, which would slow them down.

27:05 So that's nice.

27:07 And then the big one is the switch statement, which we're not calling switch statement, it's pattern matching.

27:13 And we actually talked a lot with Brett Cannon about that, and I think people appreciated that episode where we got to dig into that, right?

27:18 - Yeah.

27:19 - Yeah, that was fun.

27:20 So there's some nice examples of what you can do, like basically how it works, you know, 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 multiple fields.

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

27:41 This is like a person example, name, age, gender, and you could match on different things 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 you think?

27:58 - Do the case statements fall through like JavaScript?

28:01 - There is a fall through, it's not in these examples, but there is a fall through mechanism.

28:06 - Okay, but not by default.

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

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

28:16 - Oh, right, yeah.

28:17 - Yeah, you don't have to say break.

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

28:20 - Yeah, it doesn't fall through.

28:21 - Yeah, yeah, 'cause in C++, if you don't say break, you're gonna print all, it's gonna run every case top to bottom, right?

28:27 Well, depending where it matches.

28:28 From where it matches onward, basically, yeah.

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

28:34 But Brian's right, there's a default, yeah.

28:36 - But the fall through mechanism in C++ and C and Java, other type language, C-like languages, it's caused me more problems than it ever solved.

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

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

28:54 - Yeah, I agree.

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

28:58 So it's still fine.

28:58 (laughing)

29:00 Dean out there in the live stream says, "Can't wait for 3.10 now with a double context or multi-line context." I agree, those are quite awesome.

29:09 I think that's a really good feature and it's super simple, so I like that a lot.

29:13 - I wanted to add a couple things.

29:15 I just found out today that one of the things that's going in 3.10 is some better error messages if you use an attribute error, if you try to access from name tuple import something else, and you get something wrong.

29:36 It tries to give you a suggestion for what the right thing is, and that'll be really cool, especially for working on the REPL and stuff.

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

29:50 I would just download it.

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

29:58 You can download it there.

29:59 - Without compiling it?

30:01 - Yeah, it's just the installer.

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

30:04 - Yeah.

30:04 - Or use pyenv.

30:06 - Yeah, pyenv.

30:07 - Right, yeah, you can use pyenv, yeah, sure, cool.

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

30:15 That's yours, Gwen.

30:16 So you wanna tell us about it?

30:16 I think I can just Google it.

30:18 I'm not gonna Google, I'm gonna DuckDuckGo, but carry on.

30:21 - Good, I use DuckDuckGo too.

30:23 - Nice.

30:24 - So yeah, I wanted to give a shout out to Free Code Camp's Python curriculum.

30:29 So last year, they launched a Python curriculum with I think it's almost a thousand hours of curriculum material between challenges, lessons, lessons, and of course, projects and certifications as 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 programming skills and algorithms and other types of things.

31:04 So that Python curriculum was in the works for a few years. I've been a top contributor with Free Code Camp for a couple years. So I got to go to their summit before the whole COVID thing hit. And I remember everyone getting together kind of talking excitedly several years ago about Python coming out. So it was definitely in the works for a long time. And a lot of people put a lot of effort into it. So I think it's a really good curriculum.

31:30 And Free Code Camp has also done a really good job of putting out a lot of supplementary material in Python and data science. So you can see on their YouTube channel, I believe they have over 100 hours of Python content, including this one 12 hour Python data science crash course on their YouTube channel. And they also have one of the most popular developer blogs on the internet. I'm also a writer for them.

31:59 Recently i wrote one jango article and i have a whole bunch more jango articles that i'm 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 to anybody even on mobile devices.

32:20 and one that stayed true to its mission, it didn't just build to kind of sell out to another company, but you know, since I believe the end of 2014, when it's launched, it's kept this mission of making coding education accessible to everyone. 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, right now they're working on an even bigger expanded curriculum for that data science and machine learning that they have right now in Python.

32:53 It's going to include all the different math and a lot more elements of machine learning than it currently covers. So yeah, I'm excited for that. They were raising money for it this year and they've been working on it since last year.

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

33:11 Yeah, very cool. I put my, 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, it wasn't even a real web framework, it was something that kind of was just a simple CLI app that talked to it to keep it, you know, not complex.

33:32 Oh, okay.

33:33 Yeah, very cool.

33:34 I've been using Django, or Django in MongoDB.

33:38 Okay, that's cool.

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

33:45 Okay.

33:46 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 you use in Django.

33:56 Oh, that's fantastic. I use Mongo engine for my main stuff, which is very much modeled on Django, but it's not, you know, not Django itself.

34:04 Cool.

34:04 Nice.

34:05 Let's see, 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:14 That's a good idea.

34:15 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. 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 clear.

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 >> We talked about possibly just formatting your error message nicely so that you could Google it, or DuckDuckGo it, of how to search for this on the Internet.

34:55 Escaping quotes and things like that.

34:57 >> Exactly.

34:58 >> That'd be cool. Somebody else, let's see, Pailang mentioned, and I think this is right, that the fall through on the pattern matching is the underscore.

35:09 I think that's correct.

35:09 >> Is that the default? I think that's the default case, not the fall through. Is that right?

35:13 >> Right. Not the fall through, the default case.

35:15 >> Okay.

35:15 >> Thanks. I don't think there is a way to, I don't know.

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

35:21 There's always, I don't know.

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

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

35:28 Remember you'd ask why what?

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

35:40 I don't remember what that's called, but sadly, that was a fun one.

35:43 >> That'd be a great package name, Python WTF.

35:47 >> Brian, is that it for our main topics?

35:49 >> Yeah.

35:50 >> Yeah. All right. You got any extras you want to cover?

35:52 Yeah, 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.

36:03 So an adventure game, a text-based adventure in Python.

36:06 But yeah, I got to talk to the creator on the testing code.

36:12 So there'll be an upcoming testing code.

36:15 I'll go in depth into that.

36:16 So that'll be good.

36:18 >> Yeah, very fun.

36:19 >> How about you?

36:20 >> Let's see. I got a couple of things.

36:22 Let's see. This one.

36:24 We talked about the Supreme Court ruling on Java, the Google versus Oracle, Or maybe for the Oracle versus Google, maybe how it should be said.

36:33 But I think it's just in passing, interesting that Microsoft has now unveiled its own Java distribution, 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:58 A lot of people already have Microsoft distributions all over their workplace.

37:01 Yeah. Gwen?

37:03 Yes.

37:03 Any comments? Any thoughts?

37:05 Oh, comments on Java?

37:07 Yeah, yeah, yeah. On this thing? No, okay.

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

37:12 PyCharm 2021.1 is out.

37:15 It has a very colorful splash screen, which is always fun.

37:18 But its main thing is it has much better support for 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 like in one tab completion.

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

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

37:57 But yeah, 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 which is an ODM for MongoDB based on Pydantic, which is super cool by Roman Wright.

38:11 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 Gwyn just mentioned migration.

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

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

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

38:35 Is more or less the way that you say that.

38:38 So yeah, that's, it'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 that, seeing that thing grow.

38:48 Gwyn, I know you got a couple of things want to talk about mem.dev. That's a really cool thing. I didn't know about this before, but I checked it out when you put it in the show notes.

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

39:02 So a lot of people use Anki, which is its own algorithm. I also use Anki synced across my desktop and mobile phone and everything to learn different concepts, mostly programming, or 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 directly copy snippets from places like Stack Overflow.

39:27 In all those coding boxes, it will have a mem.dev icon in the corner of any coding box, and I can just copy the snippet to make into a card later on mem.dev.

39:40 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, 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 spaced repetition learning systems so I don't forget different parts of the API even if I haven't used it in a couple months 'cause I'll have to recall that for a future project or something like that.

40:26 - Yeah, so I looked at this and you can go to places and sort of save these web snippets and then turn them into stuff you wanna 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 say, make this a snippet, and then I could even upgrade that to this repetition practice.

40:46 Yeah, that's pretty neat.

40:47 - Yeah.

40:48 - Cool.

40:49 - And then what about graphing Django?

40:52 - Yeah, so this probably isn't a secret to anybody.

40:57 So it's basically 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, 'cause I use mostly Django REST framework, 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, and then I'm managing, you know, how my data gets sent back from my different schemas and stuff.

41:31 I feel like as your application grows, it's much more easy to manage and maintain with GraphQL than with the 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 gonna play around with that a little bit soon.

42:04 - Yeah, very cool.

42:05 - Yeah, so it's Django enhancement built upon Graphene itself.

42:09 - Yes.

42:10 - Very cool.

42:11 And Brian, out in the live stream, who was it that 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, it gives you, when it crashes, you get, what is it, like a little REPL type thing that you can go ask questions about.

42:31 - Yeah, that's the one where you're gonna ask who, what, - Yeah, exactly, yeah.

42:36 - I guess maybe not who, but.

42:38 - Yeah, perfect.

42:38 - That's interesting.

42:39 - That's it for this one.

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

42:43 - Yeah, thank you.

42:44 - It was a lot of fun.

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

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

42:50 - Yeah, thanks, Michael.

42:51 Thanks, Brian.

42:52 - Yeah, you bet.

42:53 Bye, Brian.

Back to show page