#230: PyMars? Yes! FLoC? No!
Watch the live stream:
About the show
Sponsored by us! Support our work through:
Special guests: Peter Kazarinoff
Brian #1: calmcode.io
- by Vincent D. Warmerdam
- Suggested by Rens Dimmendaal
- Great short intro tutorials & videos. Not deep dives, but not too shallow either.
- Suggestions:
- I watched the whole series on datasette this morning and learned how to
- turn a csv data file into a sqlite database
- use datasette to open a server to explore the data
- filter the data
- visualize the data with datasette-vega plugin and charting options
- learn how I can run random SQL, but it’s safe because it’s read only
- use it as an API that serves either CSV or json
- deploy it to a cloud provider by wrapping it in a docker container and deploying that
- add user authentication to protect the service
- explore tons of available data sets that have been turned into live services with datasette
Michael #2: Natural sort (aka natsort)
- via Brian Skinn
- Simple yet flexible natural sorting in Python.
- Python sort algorithm sorts lexicographically
>>> a = ['2 ft 7 in', '1 ft 5 in', '10 ft 2 in', '2 ft 11 in', '7 ft 6 in']
>>> sorted(a)
['1 ft 5 in', '10 ft 2 in', '2 ft 11 in', '2 ft 7 in', '7 ft 6 in']
natsortprovides a functionnatsortedthat helps sort lists "naturally”
>>> natsorted(a)
['1 ft 5 in', '2 ft 7 in', '2 ft 11 in', '7 ft 6 in', '10 ft 2 in']
- Other things that can be sorted:
- versions
- file paths (via
os_sorted) - signed floats (via
realsorted) - Can go faster using fastnumbers
Peter #3: Python controlling a helicopter on Mars.
- First Flight of the Mars Drone/Helicopter was April 19: https://mars.nasa.gov/technology/helicopter/#Overview. The Drone/Helicopter is called Ingenuity. The helicopter rode to Mars attached to the belly of the Perseverance rover.
- Community powers NASA’s Ingenuity Helicopter: DEVELOPERS AROUND THE WORLD CONTRIBUTE TO HISTORIC FLIGHT: https://github.com/readme/nasa-ingenuity-helicopter
- The Drone/Helicopter flight control software is called F’ (pronounced f-prime, sounds like Python f’strings :). You can clone and install the flight control software from GitHub. Make sure you have Python and pip installed. https://github.com/nasa/fprime
Brian #4: Pydantic, FastAPI, Typer will all run on 3.10, 3.11, and into the future
- suggested by an Angry Dwarf
- It’s a bit of an emotional roller coaster this last week even for those of us on the sidelines watching. I’m sure it was even more so for those involved.
Short version:
- Pydantic, FastAPI, Typer, etc will continue to run as is in 3.10
- Minor changes might be necessary in 3.11, but most likely all of us bystanders and users of these packages won’t even see the change, or we will be given specific instructions on what we need to change well ahead of time.
- If things change in 3.11, your code might still work fine, and you can test that today if you are worried about it.
- All project leads are involved and talking with the Steering Council.
- The Steering Council has all of our interests and Pythons in mind and wants to make improvements to Python in a sane way.
- So don’t freak out. Smart and kind people are involved and know what they are doing.
Slightly more detail that I don’t really want to read, and summarized to my perspective:
- Something about an existing PEP 563, titled Postponed Evaluation of Annotations
- It was part of 3.7 and it included:
- “In Python 3.10, function and variable annotations will no longer be evaluated at definition time. Instead, …”
- This would have implications on Pydantic and projects using it and similar methods, like FastAPI, Typer, …
- Panic ensues, people wringing their hands, bystanders confused.
- BTW, the Python steering council knows what they are doing and is aware of all of this already. But lots of people jumped on the bandwagon anyway and freaked out.
- Even I was thinking “Ugh. I use Typer and FastAPI, can I still use them in 3.10?”
- Luckily, Sebastian Ramirez posted:
- I've seen some incorrect conclusions that FastAPI and pydantic "can't be used with Python 3.10". Let's clear that up. In the worst-case scenario (which hasn't been decided), some corner cases would not work and require small refactors.
- And also if you are worried about the future and your own use as is, you can use
from __future__ import annotationsto try the new system out. Also thanks Sebastian - Then there is this message by Thomas Wouters about PEP 563 and 3.10
- “The Steering Council has considered the issue carefully, along with many of the proposed alternatives and solutions, and we’ve decided that at this point, we simply can’t risk the compatibility breakage of PEP 563. We need to roll back the change that made stringified annotations the default, at least for 3.10. (Pablo is already working on this.)
- “To be clear, we are not reverting PEP 563 itself. The future import will keep working like it did since Python 3.7. We’re delaying making PEP 563 string-based annotations the default until Python 3.11. This will give us time to find a solution that works for everyone (or to find a feasible upgrade path for users who currently rely on evaluated annotations). Some considerations that led us to this decision: …”
Michael #5: Extra, Extra, Extra, Extra hear all about it
- No social trackers on Python Bytes or Talk Python.
- Python packages on Mars
- More Mars
- NordVPN and “going dark”
- Nobody wants anything to do with Google's new tracking mechanism FLoC (Android Police, Ars Technica). From EFF: Google’s pitch to privacy advocates is that a world with FLoC will be better than the world we have today, where data brokers and ad-tech giants track and profile with impunity. But that framing is based on a false premise that we have to choose between “old tracking” and “new tracking.” It’s not either-or. Instead of re-inventing the tracking wheel, we should imagine a better world without the myriad problems of targeted ads.
Peter #6: Build Python books with Jupyter-Book
- There are many static site generators for Python: Sphinx, Pelican, MkDocs…
- Jupyter-Book is a static site generator that makes online books from Jupyter notebooks and markdown files. See the Jupyter-book docs.
- Books can be published on GitHub pages and there is a GitHub action to automatically re-publish your book with each git push.
- A gallery of Jupyter-books includes: Geographic Data Science with Python, Quantitative Economics with Python, the UW Data Visualization Curriculum, and a book on Algorithms for Automated Driving. All the books are free an online.
Extras
Brian
- 2021 South African Pycon, PyConZA - https://za.pycon.org/. The conference will be on 7 and 8 October entirely online
- deadpendency update . Within a day of us talking about deadpendency last week, the project maintainer added support for pyproject.toml. So projects using poetry, flit should work now. I imagine setuptools with pyproject.toml should also work.
Peter
- Peter’s Book: Problem Solving with Python (dead trees) or free online
Joke
// Dear future me. Please forgive me.
// I can't even begin to express how sorry I am.
try {
...
} catch (SQLException ex) {
// Basically, without saying too much, you're screwed. Royally and totally.
} catch(Exception ex){
//If you thought you were screwed before, boy have I news for you!!!
}
// This is crap code but it's 3 a.m. and I need to get this working.
One more:
From TwoHardThings by Martin Fowler: Original saying: There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton Then there’s This tweet.
Episode Transcript
Collapse transcript
00:00 Hey all, Michael here. Thank you so much for listening to this episode. Before we jump right
00:03 into it, I just want to make a quick announcement. I'm sure you've noticed that we've talked about
00:08 certain people being on the live stream or the live chat, and I want to make sure you know how
00:12 to get to that if you're interested in being part of the show. So if you just go to pythonbytes.fm,
00:17 up in the menu, there's a live stream link. Click on that. It'll take you over to our YouTube
00:22 channel where you can subscribe and get notified about upcoming live streams. Most people just
00:27 listened to the audio and that's fantastic, but it's really cool to be able to interact with
00:31 some of the audience to get that broader perspective. So hopefully we can see you
00:35 on the live stream recording sometime. Either way, so happy to have you here. Enjoy the show.
00:41 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to
00:45 your earbuds. This is episode 230, recorded April 21st, one day before Earth Day, I guess,
00:51 Earth Day Eve, Brian, 2021. I'm Michael Kennedy. I'm Brian Okken. Hi, and I'm Peter Kazarnoff.
00:57 Hey, Peter. Welcome to the show. So good to have you here.
01:00 Yeah, thanks so much for having me. So I work as an instructor at Portland Community College,
01:05 and I teach engineering. And I also blog at Python for Undergrad Engineers. And I'm a book author,
01:13 too. So if you're interested in like that NumPy, Jupyter, kind of matplotlib sort of stuff,
01:20 that's the kind of stuff that I'm into.
01:22 Yeah, fantastic. You do like engineering work at the local university, right?
01:26 Yeah, at the local community college, and that includes teaching Python in our engineering programming class.
01:32 Yeah, awesome. Well, you've spoken at the Portland Python meetup. You've been on Talk Python To Me. Now you're on Python Bytes. You're making the rounds.
01:42 Awesome. I'm excited to be here. Thanks for having me.
01:44 Yeah, you bet. Well, Brian, are you feeling calm today? Feeling a little chill?
01:49 Keep Calm and Program in Python, right?
01:52 Right.
01:52 Yeah.
01:53 So this was suggested by Renz Demondahl, something like that.
01:58 Cool name.
01:59 This is a site, but we've covered some of Vincent's stuff before.
02:04 This is a site by Vincent Wormerdam called comcode.io.
02:09 And what he's got is he's got a whole bunch of, basically a whole bunch of tutorial videos
02:14 on software topics.
02:16 but what i and their their little tutorials to go with them um i checked out the there's a whole
02:21 bunch of stuff there's a pi test there's rich data set and others i was checking out data set this
02:27 morning and i got kind of hooked and i watched like the entire series because it took like 20
02:32 minutes or something like that to like watch all of them um it was pretty quick and uh and i kind
02:38 of like the minimalist it's kind of the minimalist style it's um it seems to be a balance of like
02:45 not just overview and not a deep dive, but somewhere in between.
02:49 And it's kind of a nice place to be.
02:53 And I was kind of blown away at how much he did with Dataset just really quickly.
02:57 So the Dataset one, I started with a CSV file with a bunch of data in it,
03:03 turned that into a SQLite database with a tool that he pip installed, used Dataset to open that, and that opens a server on your own computer,
03:13 And then you use that to explore the data and then used a plugin to visualize the data with plots and charts and stuff.
03:20 And then showed us how to like actually just use raw SQL, see what the exploration is in raw SQL and see what that looks like.
03:29 And then take that.
03:33 But one of the things is it's like a little service.
03:37 So you could share that in your internal network with somebody else to look at it.
03:43 But the question of it's raw SQL should really let raw SQL be run.
03:48 And he said, yeah, it's fine because what data set does is open up the SQL database in a read only mode.
03:55 So you can't write anything.
03:56 So you're safe there.
03:57 You can't delete anything or anything.
03:59 Yeah, this is interesting in that it's like really intended to be 100% shared data.
04:04 And like you said, it's read only.
04:05 So little Bobby cables won't be a problem.
04:08 Exactly.
04:09 But and then then there's a couple of buttons that are like JSON or CSV, but they actually open up.
04:15 They just open up queries and you can use those as an API into the data.
04:22 And you essentially have just with the data set have had have an API that you can use directly for some something else then.
04:30 And then he's like, OK, well, this is good enough. Could you stick it out on the cloud?
04:35 And apparently Dataset has a tool to do that.
04:37 And you can just go ahead and create a Docker around it with a couple of commands and stick
04:42 it on a cloud service.
04:45 I was just blown away at how much you can do with Dataset.
04:48 And just watching somebody play with it is good.
04:50 And like I said, it's not a complete Dataset tutorial.
04:53 It's just a scratching the surface, a little bit more than scratching the surface, seeing
04:58 what kicking the tires sort of video.
05:00 So it's neat.
05:01 Yeah, cool.
05:02 Yeah, it seems really neat.
05:03 And there's a ton of small little tools and things you can go explore there.
05:07 So yeah, nice, nice, nice.
05:08 All right.
05:09 Peter, what do you think about this?
05:10 Well, I loved it.
05:11 I think this is a great resource for students too, because they're all free.
05:16 And the one I really liked was the one on SymPy, which is doing symbolic math with Python.
05:23 And that's kind of a confusing topic, because there's like a difference between using the
05:27 regular square root function that will give you a float as an output compared to like the
05:32 sympy function that is a symbolic math representation of a square root. And I was hoping
05:42 maybe it would be sort of like the ASMR videos that there would be very calming music while you were
05:48 doing it. But there wasn't. The instruction, though, is really calming and really, really good. So I'd
05:54 love to share this with students. Yeah. Very cool. Very cool. Nice. All right. On to the next one.
06:01 This one comes to us from Brian Skin, who pointed out that here's a cool thing that
06:07 I don't believe we've spoken about yet.
06:08 So Brian, thank you for telling us about natural sort or nat sort.
06:14 Have you guys heard of this one?
06:15 No, I've never seen this before.
06:17 So one of the things that can be frustrating is if you sort with something that is really
06:24 strings, but it has some other meaning like version numbers.
06:27 Like if I have a bunch of strings and they'll have version numbers and I say sort that, of
06:31 it's going to go, you know, like 2.0, then 12, then 100, you know, or maybe 100, then 12. Like
06:39 it's the way it sorts will just be, I guess, lexographically. It would be nice if I could
06:44 just go to certain things and say, sort it. And it automatically understood, oh, there's,
06:50 there's separators and there's like meaning between these. And if they're numbers, you know,
06:54 look at the number part and then sort based on the size of the number, not the, whether it starts
07:00 with a one or a two, but if it's a two or a 10, right? And so that's what this simple little
07:05 library does is it's simple natural sorting in Python. So one cool example, this one actually
07:12 might be interesting for you, Peter, for your students is if I had a list of strings like
07:18 quote, two feet, seven inches, one foot, five inches, five feet, two inches, and so on. If I
07:25 sort it is just going to go one foot, 10 feet, two feet, two feet, seven feet, right? You know,
07:30 the luxographical version. But if you natural sort, it does exactly what humans would do.
07:36 One foot, five inches, two foot, seven inches, two foot, 11 inches, seven feet, six inches,
07:40 and so on. So that's pretty cool, right? You can just go and basically use NAT sorted instead of
07:46 sorted, right? The sorted built in, just NAT sorted. And you could also import NAT sorted as sorted if
07:52 you wanted to go off the hook and just you know kind of globally replace that on a file there
07:57 so there's different things that you can do you know not just that one you can sort versions you
08:02 can sort file paths real numbers like scientific numbers you know 1.72 times 10 to the 20th or
08:10 whatever that kind of stuff you do locale aware sorting like basically case and sensitive sorting
08:17 you can customize it you can sort custom types but then if you select a key out of the like say
08:22 class or an object, a bunch of the instances of that class, then that key would then be naturally
08:29 sorted as if, as this thing does. So here's an example with versions like version dash one dot
08:34 nine, version dash two, version dash one 11. And of course it sorts the way humans would sort it,
08:40 right? One nine, one 10, one 11, then two Oh, and so on. That's pretty cool. You can get a sorted
08:46 directories. Now, some of these come from not the same NAT sorted, but like, for example, there's an
08:52 sorted and there's for the real numbers there's a real sorted and so on um there's ways to customize
09:00 it there's ways to build like custom sorters like i create an algorithm which is like real or and
09:06 locale and ignoring case and all of these things right like throw them all together with like the
09:11 or bitwise or operator and so on yeah and i think that pretty much covers it but it's it's pretty
09:17 neat. It has like some cool debugging stuff. Zdocs is asking if it NAT sort handles non-ASCII
09:26 Unicode. I think so. There is some talk about that actually working with bytes directly, but I think
09:34 it sorts on strings itself. So I don't know why it would necessarily be different. I mean, unless
09:40 you try to treat the Unicode as binary, then that might be something else. But yeah, thanks for that.
09:45 One other thing that's interesting, just looking through here, I'm like, okay, this is neat.
09:48 Kind of cool.
09:49 Here's how you customize it.
09:50 Oh, wait, there's this thing called fast numbers.
09:54 Most efficient, the most efficient sorting can be done if you install the fast numbers
09:58 package, which apparently, you know, it has nothing to do with this, right?
10:02 But it's something that it uses.
10:04 And what fast numbers does is it allows you to have different behaviors for like float
10:09 and int and stuff, parsing strings into floats and integers.
10:13 And apparently it does it faster as well.
10:15 So for example, instead of saying float of a string, that is a floating point number,
10:19 you can say fast float of that.
10:21 And of course you could go crazy and import as and wipe that out, right?
10:26 But you can do things kind of like the dictionary.get.
10:28 So you can say fast float, try to parse this, but instead of throwing a value error,
10:33 whatever type of exception it is, you can say the default that I'm going to get
10:36 if I can't parse it as zero or bad input, or what number will I treat as not a number
10:42 and all sorts of interesting stuff.
10:43 So if you're doing parsing of numbers, fast numbers is kind of cool.
10:46 Yeah, I got to check this out.
10:48 I do that all the time.
10:51 Yeah, yeah, that's cool.
10:52 So I think this is just, you know, that's not the main topic, but I do think it's a neat one there.
10:57 So anyway, yeah, people who do sorting of strings and stuff, they should check it out.
11:01 And ZDocs is talking about like sorting like a umlaut over a, I don't know the name of the little circle above a vowel,
11:10 But there's the locale-aware sorting.
11:13 And so you can give it the Swedish locale.
11:19 And I bet it does sort it okay, but I don't know for sure.
11:21 I haven't actually tested the Swedish locale.
11:23 But it does seem to have something that addresses that.
11:27 Nice.
11:27 Nice.
11:29 For me, the use case is always the 1 versus 0 1.
11:33 So if I've got something that's 10 and something that's 1, the way that that automatically gets sorted
11:39 And then I don't always like putting the zeros in front.
11:42 So this seems really useful.
11:44 Right.
11:44 You don't have to left pad it type of thing.
11:46 Yeah, absolutely.
11:48 Well, how about Mars, Peter?
11:51 So how about Mars?
11:52 So this is something I'm super excited about, the Mars Perseverance rover.
11:58 And the rover landed on Mars in February.
12:02 But just a couple days before this recording, on March 19th, the Mars helicopter, which is called Ingenuity, lifted off for the first time.
12:15 And so this was the first power-controlled flight on another planet, which is so cool.
12:22 And you can go to the NASA website and take a look at the Mars helicopter, like lifting off for the first time.
12:29 It's kind of got two counter-rotating rotors and a little solar panel up at the top and a little antenna up at the top.
12:39 And the cool thing about this is that some of the software that's running the Mars helicopter is built with Python.
12:50 It's also totally open source.
12:53 So on GitHub, there's this package for something called F' and NASA writes it F apostrophe.
13:03 And F' is the flight control software that Mars Helicopter uses.
13:11 And if you look at the GitHub repo, you'll notice in the installation instructions that you have to make sure that you have Python 3 and pip installed in order to install F Prime, the Mars helicopter software.
13:27 So I just think that that's super, super neat that Python's being used as part of the Mars mission and that open source to make this F prime flight software was used in order to make this happen.
13:46 So Brian, you excited about space and the Mars rover?
13:51 Yeah, and also one of the things that happened with this is GitHub put a bunch of achievement awards on it, a whole bunch of people's GitHub accounts to anybody that contributed to a project that was used by F-Prime.
14:07 And it may have been other packages too, but at the very least with this.
14:12 And so a bunch of us got these like, you know, you contributed to the helicopter Mars mission thing.
14:18 Yeah, I felt cool being an Arctic Code Vault contributor.
14:22 And now that's just out of this world, man.
14:25 It's awesome.
14:26 Yeah.
14:28 Yeah, I love in that post how they showed like a screen capture for Marietta, one of the core devs, and showed like her little shield.
14:37 So I thought that that was awesome.
14:39 Yeah.
14:39 Yeah, that's really cool.
14:40 Yeah.
14:41 Sam Morley also called that out that she got a badge for contributing to the helicopter.
14:45 Yeah.
14:46 and apparently I got one for contributing to pytest which is cool so I didn't know pytest was used by this
14:53 but that's neat no kidding you have one of these badges?
14:56 yeah let me pull it up oh my gosh oh that is so awesome that is super cool
15:03 yeah and while you're pulling it up ZDoc says super amazing great work by NASA
15:06 crazy that Python is considered stable enough to be used by them I totally agree
15:10 oh where is it?
15:11 oh my gosh you have the badge Oh, dude, I am so jealous.
15:17 It's pretty cool.
15:18 Yeah, that's really cool.
15:19 So one of the things I was going to talk about is some extra, extra, extra stuff.
15:23 But two of those have to do a little bit with like what we're talking about now.
15:26 So I'll mention them in a moment.
15:28 So Aram mentions on Twitter that points out for us, there's this quote from Dustin Ingram
15:37 who runs the IPI along with some other folks and says, Python packaging sucks in sort of quotes,
15:42 but now it sucks on multiple planets which is pretty awesome and then it goes off on this long
15:46 like this he goes for a long thread about like how it's being used what it's being used with
15:50 and i linked to this in the show notes there's like a ton of stuff you can follow along there
15:55 and then also um a lot work points to an article over here that talks about this badge that you
16:01 were referring to brian and the various people were getting in the repositories that
16:06 qualified for it. So Linux, F prime, CPython, Boto3, BotoCore, see what else jumps out at me.
16:12 That's Python, a matplotlib, numpy, opencv, Python, Python dateutil, requests. Yeah,
16:20 I saw Kenneth Wright saying how humbled he was to see that S3 transfer, which I use.
16:25 I mean, the list is like, this is a list on GitHub, but this is actually like a list of many
16:30 of the big hitters of Python. And it talks just about, I mean, it hints at how important Python
16:34 is for this whole mission.
16:36 It's awesome.
16:37 Yeah, that's great.
16:38 Cool.
16:38 Yeah, absolutely.
16:40 Absolutely.
16:41 Super cool.
16:41 All right.
16:43 I guess real quick, before we move on to the next thing, just point out that this episode
16:47 is brought to you by us.
16:49 So if you want to support us, check out the things that we're doing, like check out the Talk Python training courses,
16:54 check out Brian's pytest book, and things like that.
16:58 And yeah, Anthony Lister gives you a little shout out there.
17:01 Well done, Brian.
17:02 You're basically an astronaut.
17:06 You know what I mean?
17:09 Well, I'm almost embarrassed, though, because I contributed one test to a defect report
17:16 and then wrote the test to show the defect.
17:19 That was my contribution to pytest.
17:21 But yeah.
17:22 All right.
17:23 That's all good.
17:24 It's all good.
17:25 Cool.
17:26 All right.
17:26 Take us back to Earth.
17:28 Well, let's.
17:29 So we, there's a lot of cool projects in Python.
17:34 One of the cool projects is FastAPI, and that's built on Pydantic.
17:37 And Pydantic's used by itself for lots of stuff.
17:41 And anyway, why am I talking about this?
17:44 Well, one at school, but we've talked about it before.
17:46 But this topic was, we've been following it anyway, but I got to give a shout out to the person's name that mentioned it to us.
17:55 Somebody named Angry Dwarf said we should cover it.
17:57 And I just love that he had his name in his email was Angry Dwarf.
18:01 So cool.
18:02 Thanks, Angry Dwarf.
18:03 Anyway, it's been a bit of an emotional roller coaster, but the punchline is Pydantic, FastAPI, and Typer will work just fine in 3.10.
18:12 And they'll work in 3.11.
18:13 And they'll always work.
18:15 They're going to work forever.
18:16 I mean, I don't know that for sure, but that's my guess.
18:20 So why am I saying that people should calm down and it's going to be fine?
18:24 Because people were freaking out last week.
18:26 So people were freaking out that maybe FastAPI and Pydantic weren't going to work in 3.10.
18:33 Including the creator of Pydantic, not just random people on the internet.
18:37 Oh, really?
18:38 People involved in the projects.
18:39 Yeah, yeah.
18:39 They were like, this is going to be not good.
18:42 Okay, so this starts...
18:45 Okay, I'll jump into a little bit of the details.
18:49 There's a PEP 563 that was titled Postponed Evaluation of Annotations.
18:56 And there was a little bit in there, and this went into Python 3.7.
19:01 And this said, it went into 3.7, but there was a clause in there that said,
19:08 in Python 3.10, the functions and variable annotations will no longer be evaluated at definition time.
19:15 They'll be lazy evaluated later.
19:19 Or something like that.
19:20 I didn't read it that closely.
19:22 But that's the bit that makes people scared about 3.10.
19:25 And 3.10 is coming out like really pretty soon.
19:28 So does that mean that Pydantic and FastAPI, they kind of rely on this and are they not going to work in 3.10?
19:38 And it turns out there was some corner cases.
19:41 At least that's my understanding of it.
19:44 Sebastian Ramirez, who did FastAPI, he wrote, there's been some incorrect conclusions that FastAPI and Pydantic can't be used with 3.10.
19:56 Let's clear that up.
19:57 The worst case scenario, which hasn't been decided, is that some corner cases would not work and require small refactors.
20:06 And then he goes on to show the refactors.
20:08 So the refactors really are just there that if you define your types within a function,
20:17 you won't be able to do that.
20:18 You got to pull the types out of the function and put it at a top level or something like that.
20:24 And even if you're stressed about this, you can try it out by saying in the code you have,
20:29 you can say from Dunder future import annotations, and that will show you what the future implementation is.
20:37 So you can try it out and see if there's any problem.
20:39 But then we got, and I don't have a link to this, but we had a notice from, who is it from?
20:47 I'm missing the name.
20:48 Anyway, I've noticed just the other day that basically said they're not going to do it for 310.
20:54 So basically they're putting the brakes on 563, the switch over in 310 for 310.
21:01 They're going to push that to 3.11 so that they all have time to figure out what to do about it and how to figure it out.
21:07 So they got another year to figure out what's or approximately.
21:12 As users, I have another year to not worry about it.
21:15 But the steering council, they know what they're doing.
21:20 They're aware of this.
21:21 They're aware of this issue.
21:23 They're aware of the that everybody loves FastAPI and Pydantic and things that are built on that.
21:29 So, there's going to be a solution and I think people should just trust the people
21:35 involved that things are going to be okay.
21:37 So anyway.
21:39 Yeah, it's, there's a really, what's the right word?
21:45 Energetic, energetic, conversation over on the Identic issue tracker.
21:52 And it just closed a little bit, just a little bit, you know, last six days just
21:56 recently closed, which is good.
21:58 but it was basically important pep563 and 649 in the future of pydantic and i just had sam and
22:07 samuel colvin who is the creator and maintainer of pydantic on talk python that episode should be
22:12 out this week actually but on there he talked about how some things looked very bad for how
22:18 things work but then they've talked it through and it looks like some of the changes are not going
22:22 to be super significant basically the problem was a lot of the hype annotation evaluation is
22:28 longer concrete types like a python type you can go to the and say give me your type what are you
22:33 it was converting those to strings so that they could be evaluated more quickly but then in doing
22:39 so if i have a string called customer that's very different than having the actual customer class
22:44 that i can then use for type information so then how does pydantic go back and find the customer
22:49 class like throughout all the things what if there's two of them and so on so that was the
22:54 concern and it sounds like it's things are looking better. So it's all good. So Brian,
22:58 what's kind of the take home message of this? Well, one of the things, I don't know,
23:04 my take home message is the people involved like Samuel and Sebastian and the steering council,
23:12 they're talking with each other. They know what that's going on. And occasionally stress happens
23:17 as to what's going to, you know, I don't know how to fix this, but they they're, they're talking
23:23 with it. I'm going to try as a, as a bystander, I'm not going to jump on the bandwagon and try to
23:28 like, one of the things that, that came out was people, some people started sending a bunch of
23:32 emails and jumping on the threads saying, you have to fix this, you have to fix this. And that doesn't
23:38 help. It just adds noise and adds work to the steering council. So making, I think it's fine
23:43 to make sure that it's addressed, but it's going to be addressed. And I don't know. I actually
23:49 was one of the people because I use FastAPI, I use Typer, and I was like, do I need to be
23:55 worried about this? And especially somebody using it, just take a deep breath and realize
24:02 that something as large as FastAPI or Pydantic is somebody's going to figure out how to fix it.
24:08 Hopefully.
24:09 I mean, it's possible that something might break.
24:11 I mean, it is the dynamic language.
24:14 I just don't, there's enough people paying attention that, I don't know.
24:17 That's probably a long-winded takeaway.
24:20 It's like a repeat of what I just said, but anyway.
24:23 So if you're using FastAPI right now, there's not a whole lot to be worried about.
24:28 Nothing to be worried at all.
24:30 And if you are worried about it at all, you can use this future import thing
24:35 to try out your code to see what it'll be like in the change.
24:38 And even if that breaks, they'll probably fix it by 3.11.
24:42 Yeah, and then Nick Harvey threw out that you can't test this from future,
24:46 thunder future right now.
24:47 So that's cool.
24:48 Yep.
24:49 Cool.
24:49 All right, Brian.
24:50 I tried to keep it down to just a couple of things, but then they started piling up in
24:54 my extra section to where I don't know we wouldn't be getting through it in a reasonable
24:58 amount of time.
24:58 So welcome to another section of extra, extra, extra, extra here all about it, but minus one
25:05 extra because I already told you about the one with the package list and so on.
25:09 All right.
25:10 So let me take you through a couple of things.
25:12 First, here.
25:14 Did you know we're live streaming right now, by the way?
25:16 On pythonbytes.fm.
25:18 Hello.
25:20 pythonbytes.fm.
25:21 I say that because there's a huge banner on the site I pulled up.
25:23 We had something that would let us get some real-time analytics and sort of know where
25:28 people are coming from.
25:29 You know, advertisers sometimes ask for that.
25:31 But what I've noticed is a lot of the new browsers, a lot of the good ones anyway, are very much
25:37 blocking those things, right?
25:38 So for example, Firefox automatically blocks our analytics anyway.
25:43 Brave automatically blocks our analytics anyway.
25:45 So we're not getting a lot of information back.
25:48 And we're getting, I don't know, my theory is about 40% of the traffic is being measured,
25:52 which gives you some stuff like what countries people are coming from and whatnot.
25:55 But I decided, you know what?
25:57 We already have our ads.
25:58 Like in our ads, we do no tracking, no retargeting, no cookie setting and so on.
26:02 So why don't we just do that with our analytics?
26:04 Like how much do we really need that anyway?
26:06 We got downloads and so on.
26:08 So if you go over here and you click on the little shield, we now have a perfect privacy score on Python Bytes.
26:15 Oh, very cool.
26:16 Check this out. Tracking content, non-detected. No social media, no cross-site, no fingerprinters,
26:21 no crypto miners, nothing. And same, by the way, for Talk Python training and Talk Python itself and
26:28 so on. No known trackers to Firefox were detected on this page. Cool, huh? Yeah. I didn't know
26:33 about that little badge thing. Yeah. It's like a security score. How much is blocked? How bad is it?
26:39 And so on. But because so many of them are blocking them by default, I'm like, let's just
26:43 take this stuff off, right? It's somewhat useful, but not that useful. Related to that, have you
26:47 heard of this Flock, Federated Learning of Cohorts? Have either of you heard of this?
26:52 No. No, I'm worried that that joke is coming though.
26:56 No, this is just Orwellian business right here. It has this eye looking at you. So there's an
27:03 article on Ars Technica, Everybody Hates Flock, Google's Tracking Plan for Chrome Ads. The EFF
27:09 has a beautiful article that you really should read if you at all care about the future of the
27:15 web, the future of tracking the future of privacy called Google's flock is a terrible idea from the
27:21 EFF. And they've got some pretty insane quotes in there. For example, one of them from the EFF is
27:28 Google's pitch to privacy advocates. I'll tell you what flock is in just a second, but Google's pitch
27:32 to privacy advocates is a world with flock. Is that the world with flock will be better than a
27:38 world that we have today where data brokers and ad tech giants can track and profile with impunity.
27:45 But that framing is based on a false premise that we have to choose between old tracking and new
27:49 tracking. It's not either or. We can reinvent the world where we're not being tracked in every way
27:55 and sliced and diced and so on. And I totally concur with that statement. So yeah, check this
28:02 thing out. This Google's block is a terrible idea. The idea is instead of having third-party cookies,
28:07 which so if I go to CNN.com, you know, we could try that.
28:11 It probably won't show up here because I have it blocked at like a higher level.
28:15 So now it's not showing up here.
28:16 How many things get blocked?
28:17 But anyway, if you would go there, very likely they would set a cookie from, say, double click that you saw this ad,
28:23 not this ad that you saw this article.
28:26 Then you go over to, I don't know, your dentist or your psychologist or whatever.
28:32 And then they also can have this thing.
28:34 And so they actually were just reading this article, basically, right?
28:36 Like they can profile what type of person you are, very, very fine grained through these cookies.
28:42 So Flock, you know, basically Google said they're going to get rid of these cookies
28:45 because as I already pointed out, everyone's blocking these third-party cookies,
28:48 Firefox, Brave, VPNs, and so on.
28:51 So what do you do to keep the ad retargeting happy and the, like the super analysis
28:56 of what everyone's doing happy?
28:58 You come up with a new idea.
28:59 The idea is your browser is going to use machine learning to put you into these cohorts.
29:04 Like, are you a young female lesbian?
29:08 Are you a divorcee woman in her 40s?
29:11 Like, what group are you in?
29:12 And then every advertiser that you visit can basically receive like, oh, what kind of person?
29:17 Oh, this is a divorcee who's coming.
29:19 Even if they've never been to your site or anything, right?
29:23 You sort of get your flock advertised to you, your group.
29:27 It's not private data, but it's pretty private.
29:30 It's like this group.
29:32 It means a lot.
29:32 Anyway, I thought that this was a pretty big deal on the web and people should check it
29:36 out.
29:36 So I put that out there for you all to consider.
29:39 What do you all think?
29:40 I think tracking is a terrible idea and it's mean too.
29:43 I don't have the link to it, but I was reading an article recently about how somebody had,
29:48 I don't know, they were expecting a baby.
29:51 So they were looking up all sorts of baby stuff and then they lost the baby with the
29:55 miscarriage and they still got tracked for that.
29:58 And so they get, they get stuff and then somebody, a couple of stores figured out what their address was and figured out when the due date probably was. And then they get like, they keep getting these things like your child's probably about four now. Maybe they need a bike. And they're just, that's terrible. Yeah. So.
30:18 Yeah. Yeah. But here's, here's part of the thing. Like all this is not so good, right? Like, I mean, they're both not good, but how do you clear your flock, right? Like I can hit command shift delete and clear my history, my cookies. How do you clear out your flock? Like you're just, no, you're just a divorcee and it's recomputed every week. So like it goes, like you could actually track like the stages of somebody's life, the different groups they've been, it's, it's super bad news. So anyway, I think this, we don't need it at all. I mean, we don't, yeah, we don't need it at all.
30:45 People did advertising in magazines and newspapers for a really long time with no tracking.
30:51 Yep.
30:52 Yep.
30:52 And as I've already pointed out, so do we.
30:54 Not in newspapers, but nonetheless.
30:57 Yeah.
30:57 So anyway, people should check this out.
30:59 That's worth pointing out.
31:00 And then also kind of related to that, I recently started using NordVPN and it's not an ad.
31:05 I know they sponsor a lot of podcasts, but it's not that.
31:08 I just started using it.
31:09 It's super cool.
31:09 You can set this up to automatically, like when you log in, just join your VPN.
31:14 Like I go to Seattle right now.
31:16 And it also, it does all that cookie blocking and all those different kinds of things
31:23 like automatically at the network level.
31:25 So now, for example, it automatically does that when I turn on my iPhone, it's just always on the VPN.
31:29 And if I fire up an app that doesn't allow ad blocking, that app is already blocking ads
31:34 because the ads are blocked at the network level.
31:35 So for example, I've used like Flipboard or like Apple News, like the ads are blocked.
31:40 So anyway, that's worth throwing out there.
31:42 And yeah, that's all my extras.
31:44 but kind of a privacy intensive one, but I thought they'd all kind of go together well.
31:48 So I ended up making that a thing.
31:50 And then Alexander Siminov says, I believe that human classifier trackers will backfire.
31:57 Yeah, I think there's a lot.
31:59 I agree with you, Alexander.
32:00 And I think there's a lot of negative effects.
32:02 Like for example, you can target and disadvantage marginalized groups.
32:07 And Google actually talks about like when they detect that enough marginalized groups
32:11 have been harmed, they'll recompute the flock.
32:14 it's like enough yes yeah exactly it's it's really orwellian uh i'm not you know trying to be
32:22 hyperbolic when i say that like actually is so um people should check that out and just be aware
32:27 and uh yeah peter you want to uh talk about your last item here uh jupyter book yeah i'd love to
32:33 talk about jupyter book so there are a lot of static site generators uh for python as well as
32:40 for other languages.
32:42 So this is like a good party game.
32:44 How many static site generators can you list?
32:48 Like Sphinx, Pelican, MKDocs.
32:51 Do you have any other ones off the top of your head, Michael?
32:53 Oh, I think probably is Ghost one.
32:55 I think Ghost might be one.
32:58 Like Hugo, all of those.
33:02 But I do a lot of my work in Jupyter Notebooks.
33:05 And when I'm working with students, a lot of our notes are in Jupyter Notebooks.
33:11 And this package called Jupyter-book is a Python package that allows you to take Jupyter notebooks and build static sites out of them.
33:23 And primarily it's designed so that you can build free online books based on Jupyter notebooks, but also Markdown files.
33:36 So I've got like a little book going.
33:38 So you could put like a little scientific website that has some like analysis and various things.
33:43 You could kind of put that together as a series of notebooks and publish it, right?
33:47 Yeah, yeah.
33:48 And you can even do it with interactivity too.
33:51 So this is part of the executable books project.
33:55 And kind of the idea is that you'll be able to interact with things like plots if you make them with Bokeh or Altair.
34:05 And the code output that you see in the Jupyter Notebook, that actually came from the code that was written in the Jupyter Notebook.
34:12 And I think that's pretty neat as well.
34:16 And on the docs, there's this way that you can automatically deploy your book to GitHub pages for free, which I think is really nice.
34:27 And then there's also a GitHub so that you can hook into GitHub.
34:38 And then automatically, every time that you push, your book gets republished.
34:44 So every time you change that notebook and you push up to GitHub, now your book gets republished with all of your new content.
34:52 And I think that that's really, really neat.
34:54 It allows you to make revisions and publish super easily.
34:57 um so the that's cool and you could probably you could probably put it on a specific branch
35:03 right so if you like you make all your changes and then you're like ready to push out the next
35:07 version of of the book you could like push to the main deploy branch or whatever yeah yeah i mean in
35:14 uh your GitHub action you could set whichever branch you want is the one that kicks off uh the
35:20 action that builds uh your book uh one thing i'm kind of interested in is could we make a github
35:25 action that would kick off a build of the PDF of your book. And then you could have a releases
35:32 page where it would be like the PDF if people wanted to print it out or kind of have more of
35:38 a hard copy of it. I think that's pretty cool. And the book gallery that they have, they've got some
35:46 awesome titles that they have listed, like geographic data science with Python. That sounds
35:52 interesting. Quantitative economics with Python. The UW data visualization curriculums from the
36:00 University of Washington, how to use a lot of Python plotting tools. Oh yeah, this looks super
36:06 like it came out of Jupyter, but it's a legit website. It has a read the docs type of feel.
36:12 Yeah, yeah, definitely. And up in the right hand corner of these, you've got these
36:17 buttons that you could like download a PDF or download the notebook. You can launch a Bender
36:24 instance so that you could like run that Jupyter notebook. And you can have a default button that
36:31 will automatically take you to GitHub where that notebook is hosted. So it's pretty slick, I think.
36:38 Yeah, this is super cool. Brian, as a book author, what do you think?
36:42 Well, it's one of the things that confused me when I was thinking about this is,
36:46 And it did with Jupyter Notebook in the first place.
36:50 What does a book mean if it's not a book?
36:54 This idea of a book is not a book anymore.
36:58 It's something else.
36:59 I never really got it why Jupyter Notebooks went to the...
37:03 I don't get the tie-in between book and book, but maybe somebody can explain it to me.
37:10 Yeah, I mean, it's sort of blurring that release line that it's officially version one of the book and version two of the book.
37:17 If you do it, every single push is a new version.
37:21 Then it's sort of like just rolling like CI/CD book release, which I think is kind of neat.
37:28 But in my area, teaching engineering, textbook costs are huge.
37:34 Textbooks can cost hundreds of dollars for college students.
37:37 So if there's a way that we can make a lot of open education resources books,
37:43 I think that that would be great for college students.
37:46 I really like the design of having like the table of contents on the left of the book.
37:50 And then on the right, there's the contents of the individual page.
37:55 So you can jump to it. That's a really cool idea.
37:58 I actually I was joking a little bit. I really think that would be cool if maybe it already does this.
38:03 but if there's a way to turn one of these into an e-book or a PDF from this.
38:13 Where's the Kindle version of this?
38:15 Yeah, exactly.
38:17 And I mean, I'm not even joking.
38:18 I think a lot of these sorts of things would be great to be able to throw onto a Kindle
38:24 to be able to walk around and read.
38:26 Yeah, you can definitely output PDFs and LaTeX documents with it, but I don't know about like Kindle ebook format.
38:37 Maybe somebody can like write that in and give them a contribution.
38:41 That'd be cool.
38:42 Yeah.
38:43 Yeah, for sure.
38:44 Sam Morley says having free interactive coding textbooks would be a real game
38:48 changer for a lot of people, particularly somebody figures out how to make this portable to mobile devices.
38:54 Yeah, for sure.
38:56 All right.
38:56 A couple other comments also from Sam.
38:59 He says, congrats, Brian, about your, your badge.
39:02 nice to know that nasa does test their software i bet they test the heck out of that software
39:10 before you send it up it's got to get tested maybe to a fault i don't know but it's got to get
39:14 really really tested and then also just uh i'm in the comments james abel hey james
39:19 says uh and michael be presenting at the python meetup tonight yeah i didn't necessarily think
39:24 to cover this because it's so close to you know it's like six hours from when i'll be presenting
39:28 But yeah, I will be doing a Thon Memory deep dive sort of live coding type of thing over there.
39:34 The Python meetup in San Francisco, you know, virtually because that's the world we live in.
39:39 But yeah.
39:39 Nice.
39:40 Very cool.
39:40 Yeah.
39:41 And then John Sheehan says it's a short hop from LaTeX to EPUB with Pandoc.
39:46 Oh.
39:48 Yeah.
39:48 You may all be right there.
39:50 Right there.
39:51 All right.
39:51 Well, I did my extra section already.
39:53 Brian, you got anything else you want to do a quick shout out to?
39:55 Yeah, speaking of virtual, Python, the PyCon ZA, the South African PyCon is coming up.
40:04 Shout out to them there.
40:07 I don't I don't have a link to them up here, but it's a conference that's going to be on the 7th and 8th of October.
40:14 It'll be entirely online.
40:16 And I was just curious because it sounds like I was curious about the whole virtualness.
40:22 It's a little bit early in the morning for us.
40:25 but um they are so i had a little bit of an exchange email exchange they are going to be
40:30 able to have uh some pre-recorded so you can pre-record your talk if you want to so
40:35 if you're afraid of doing it live in the middle of the night um don't worry about that but they
40:40 you can submit anyway and uh and they're they're allowed but they'd like to have the author be
40:46 live while it's playing so they can answer questions and stuff and that seems fair
40:51 the second update is last week we covered dead dependency or dead dependency
40:57 I don't know how to say that dead dependencies I don't know and so one of the things we said was
41:05 it's too bad that it doesn't cover it doesn't do pipeproject.toml and within a day it was
41:10 it was supporting it so the there was an update the very next day that it
41:19 It supports both Flit and Poetry with PyProject.toml.
41:22 And since it's doing PyProject.toml, I imagine it'd do setup tools as well
41:28 if you're doing PyProject.toml setup tools.
41:31 That's so awesome.
41:32 Well done, folks, about updating that straight away.
41:34 I mean, isn't it amazing, Brian?
41:36 We'll talk about random things.
41:38 Like, this is cool, but...
41:39 And then the next day, so the dead dependencies folks added PyProject.toml support.
41:46 I talked about being...
41:47 oh, it needs a way to have indexes next episode.
41:49 Oh, here, they heard us and they added indexing features and so on.
41:54 Part of it's the podcast.
41:55 And also part of it is since I'm doing research for the podcast, I just reach out to people more often
42:01 and say, this is a cool project, but it doesn't do this.
42:05 Is there plans to do that?
42:07 And I mean, project owners love to hear back from people.
42:11 And even if I wasn't, I think other people should do that more often.
42:15 Don't just complain about something.
42:16 ask somebody if it's going to be supported or if you can help out.
42:19 Yeah, absolutely.
42:21 Peter, anything you want to throw out there?
42:22 Any little extras?
42:23 Tell people how they can find your book or something like that?
42:26 Yeah, if you search for Problem Solving with Python on Amazon, or there's a free open education resources version online too.
42:37 And one little shout out I got is our community college is looking into how to integrate artificial intelligence into curriculum.
42:46 So if anybody's in the Portland area that does AI stuff, reach out to me.
42:51 And I'd love to talk to you about how we can integrate AI into community colleges.
42:55 Oh, yeah, that'd be really cool.
42:56 Yeah, it's a super fun project.
42:59 Awesome.
42:59 It does sound fun.
43:00 You know, ready for a joke?
43:01 This is a team effort here.
43:03 Yeah.
43:04 I'm going to close the other tabs.
43:05 There we go.
43:06 So that's a little large.
43:08 This is, again, one of these funny code comments.
43:11 I guess I'll go last.
43:12 Brian, you want to do, oh, let's have Peter go do the first one.
43:16 So these are from comments that were found in real code, supposedly.
43:22 And then they're just kind of funny.
43:24 Peter, you want to do a first comment?
43:25 All right.
43:26 Our first comment is, dear future me, please forgive me.
43:31 I can't even begin to express how sorry I am.
43:37 And here we go.
43:38 That's great.
43:39 All right, Brian.
43:40 This is one that, I don't know, is here to take on the optimist.
43:43 I don't know.
43:44 I'm not sure how you put this, but it's an exception handling block.
43:47 What do we got?
43:49 Okay.
43:49 So, yeah, a try block with a catch sequel exception and a comment that says,
43:56 basically, without saying too much, you're screwed, royally and totally.
44:01 And then another catch exception, like a raw exception, says, If you thought you were screwed before, boy, have I got news for you.
44:13 That was my favorite.
44:14 That was so good.
44:17 And I'll just close it out with one of these ones where you just kind of have to accept life, I guess.
44:21 And it says, this code is crap.
44:23 This is crap code, but it's 3 a.m.
44:25 And I need to get it working.
44:29 Yeah.
44:30 Oh, boy.
44:31 Okay.
44:32 I wanted to share one more.
44:33 All right.
44:34 Because I was talking with my coworkers the other day, and we were talking, somebody actually mentioned how hard that we had a problem with cache invalidation.
44:44 And it reminded me of that old joke of there's only two hard things in computer science, cache invalidation and naming things.
44:51 And so I went to look it up, and then I found this other joke.
44:56 There's two hard problems in computer science.
44:59 We only have one joke, and it's not funny.
45:06 oh that's great i love it i love it all right uh we'll round it out with uh nick harvey here
45:11 says exceptions while handling exceptions are just the best indeed they are yes indeed they are
45:18 all right well brian it's great to chat with you and talk by them things as always good to talk to
45:23 you yeah and peter thanks for joining us this time thanks for having me yeah great to have you on the
45:27 show bye everyone bye



