Latest / Talk Python To Me / #360: Removing Python's Dead Batteries (in just 5 years)
Transcript
- 0:00Python has come a long way since it was released in 1991.
- 0:03It originally released when the standard library was primarily the totality of functionality
- 0:08you could leverage when building your applications.
- 0:10With the addition of pip and 368,000 packages on PyPI, it is indeed a different world where
- 0:18what we need and expect from the standard library is not the same.
- 0:22Brett Cannon and Christian Himes have introduced PEP 594, which is the first step in trimming
- 0:28outdated and unmaintained older modules from the standard library.
- 0:32Join us to dive into the history and future of Python's standard library.
- 0:36This is Talk Python To Me, episode 360, recorded March 29th, 2022.
- 0:56Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:59This is your host, Michael Kennedy.
- 1:01Follow me on Twitter where I'm @mkennedy and keep up with the show and listen to past
- 1:05episodes at talkpython.fm and follow the show on Twitter via at Talk Python.
- 1:10We've started streaming most of our episodes live on YouTube.
- 1:14Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming
- 1:19shows and be part of that episode.
- 1:21This episode is sponsored by Microsoft for startups founders hub.
- 1:26Check them out at talkpython.fm/founders hub to get early support for your startup.
- 1:32And it's brought to you by Fusion Auth.
- 1:34Your authentication and authorization platform built for devs by devs.
- 1:39Check them out at talkpython.fm/fusion auth.
- 1:43Transcripts for this and all of our episodes are brought to you by Assembly AI.
- 1:46Do you need a great automatic speech to text API?
- 1:49Get human level accuracy in just a few lines of code.
- 1:52Visit talkpython.fm/assemblyai.
- 1:56Brett, Christian, welcome to Talk Python To Me.
- 1:59Thanks for having us.
- 1:59Yeah.
- 2:00Thank you.
- 2:00First time for me.
- 2:01Yeah, Christian, it's great to have you here.
- 2:03That's super.
- 2:04And Brett, I think you may have been on before.
- 2:06Memory recollects.
- 2:07Yes, I have been on.
- 2:09I have been on previously.
- 2:10I love having you on.
- 2:11It's always fun to talk about stuff.
- 2:12And it always seems like somehow we touch on WebAssembly.
- 2:15I think one of the very last conferences I went to was PyCon and we recorded like on the
- 2:21expo floor talking about WebAssembly.
- 2:23So maybe we'll find a way to get back to that.
- 2:24I do remember that conversation very distinctly, actually.
- 2:26Yeah, that was fun.
- 2:27Even though you've been on a lot, maybe just real quick, tell people about yourself.
- 2:30You've been Python core deving for a long time and something to do with VS Code and Python
- 2:36as well.
- 2:36So tell people about that.
- 2:37Just stuff.
- 2:38Yeah, just keep it short and sweet.
- 2:40I am the dev manager for the Python experience in VS Code at Microsoft.
- 2:44I have been a Python core developer for 19 years.
- 2:48And I've been a member of the Python Steering Council since its inception back three and
- 2:54some odd months ago, I think.
- 2:57I don't even keep track of when that started.
- 2:58Yes.
- 2:58And that's me.
- 2:59Awesome.
- 2:59Christian, how about you?
- 3:01Tell people about yourself.
- 3:01I work for Red Hat.
- 3:03You may have seen that.
- 3:05So first...
- 3:06You have a Red Hat and you work for Red Hat.
- 3:08That's awesome.
- 3:08Yeah.
- 3:08At Red Fedora, by the way.
- 3:10So I work for Red Hat in the security engineering department.
- 3:13I work on something that could be easiest to describe as an open source implementation of
- 3:19Active Directory.
- 3:21And currently working on just containerizing all the things and getting that up to the internet.
- 3:26So that's a fun one.
- 3:28As part of my security work, I also do security for CPython.
- 3:31So I take care of some of the models and I'm part of the security response team.
- 3:38Been in quite a while for the, I think, 14 years, give or take, probably.
- 3:44A long time, eventually.
- 3:45So I started doing Python like 20 years ago.
- 3:47That was fun.
- 3:48Awesome.
- 3:48Yeah.
- 3:49Anything else you want to know about me?
- 3:51No, I would just like to say thank you on behalf of everyone for not, for keeping our
- 3:56machines from getting rooted because we're running Python web apps.
- 3:59That's pretty awesome.
- 3:59You're welcome.
- 4:00Seriously, though, how often are there meaningful security problems in CPython?
- 4:06I know that one of the big talking points about moving away from Python 2 was like, well,
- 4:11if you don't come along for the ride, you're not going to get security updates.
- 4:15But how often is that a big problem, really?
- 4:17How often are there problems where our CVE is filed?
- 4:20You're like, oh, we got to jump on this and quickly get it out before.
- 4:23The last version of Python that came out before we had the emergency release for the bugfish.
- 4:27So the 3.10.2, I think, had like 11 or 13 CVEs.
- 4:33Although only one that directly affected was in the Python code.
- 4:37So we also ship a bunch of extensions.
- 4:40Like we ship a library to pass XML that had like six or eight CVEs.
- 4:45We had a Zlib fix.
- 4:46We had something else.
- 4:48So it's not just Python core that's affected.
- 4:51But since we bundle and ship several libraries with CPython, especially Windows and the Mac installers,
- 4:58you may be also affected.
- 5:00If you have Linux distros, they typically have their libraries debundled and use system libraries and they update them out of bounds.
- 5:08But yeah.
- 5:09Okay.
- 5:09Well, that's actually more than I realized, to be honest.
- 5:13You don't hear too often about it being a big public problem, like log4j or something like that.
- 5:18Yeah.
- 5:18I'd say typically the CVEs we end up dealing with is the bundling that Christian mentioned, right?
- 5:23Like Christian does a lot of work to make sure we're constantly compatible with the newest versions of OpenSSL.
- 5:27So for instance, on 2.7, had you not moved over, you're going to have to do the work to be able to use OpenSSL.
- 5:33I think 3 is the newest one or the one coming up.
- 5:36So that's the real kind of concern and less of we screwed up as core devs and we have a nasty CVE.
- 5:43It's usually something we depend on that typically triggers this kind of thing.
- 5:46Thank goodness.
- 5:47Interesting.
- 5:48Yeah.
- 5:48Yeah.
- 5:49All right.
- 5:50Well, speaking of the standard library and stuff, let's start out by talking about Python just on GitHub,
- 5:58because I think maybe the time of yours releases, it might be already a week old.
- 6:03But Brett, you were one of the big proponents of moving CPython and the Python organization over to GitHub, right?
- 6:09Yeah, I drove that move.
- 6:11Thank you.
- 6:11That's awesome.
- 6:12It's so nice to be over there.
- 6:14But one of the challenges has been that bugs.python.org has kind of been its own island, especially since this move, right?
- 6:21Yeah.
- 6:22So when I helped move us off of Macarial to Git and thus moved us to GitHub for pull requests and stuff,
- 6:30I basically had to choose my battles.
- 6:32And the battle I chose was changing our version control system and no longer self-hosting our version control system.
- 6:40I was not up mentally to the challenge of also trying to move the development team over to a new issue tracker as well.
- 6:49So I purposely punted on that problem and tackled the one I thought I was capable of handling and dealing with.
- 6:56And that's why we ended up with this somewhat split personality problem of Python being on GitHub for pull requests and for code hosting, but not for issue tracker.
- 7:04Well, Ido said yesterday, I believe it was yesterday, maybe the day before yesterday on Twitter that, hey, it's happening.
- 7:10The bugs, python.org is migrating over and then it got delayed until April 1st.
- 7:16So hopefully that happens really soon.
- 7:18But what was really surprising to me was just how long that migration is, right?
- 7:23It's not like a copy the files over, get in it, git commit or the equivalent of the for the issues.
- 7:30It's days to migrate all the issues.
- 7:33Yeah.
- 7:33So there's tricky parts to this.
- 7:35I mean, one is we're getting internal help from GitHub, but obviously it's not common to move issue trackers into GitHub per se.
- 7:44Like a lot of projects, I think, just start on GitHub and have for like a decade.
- 7:48So the idea of moving over is kind of a new thing.
- 7:52And on top of it, not very many projects have the volume of issues historically to move over that we have, right?
- 7:58Like we have like 7,000 open issues, I think, alone.
- 8:02So the volume there also kind of causes an extra overload.
- 8:08And because GitHub, as I said, they have some internal tooling for this, but it's not like something that they work on month over month.
- 8:14It's there and we're using it, but it's not optimized because it's just not a typical business concern, which I mean, totally makes sense, right?
- 8:21How often do you have a project of our size and age wanting to migrate over like this?
- 8:26Just for the numbers, so we have almost 59,000 bugs in total on the bug tracker.
- 8:32Yeah.
- 8:32And almost 8,000 open.
- 8:34Yeah.
- 8:347,000 some hundred.
- 8:36Yeah.
- 8:36And trying to translate over as much metadata as possible is computationally expensive, right?
- 8:45Because what we have to do is we have to generate a dump and then the dump has to get...
- 8:48It's a different data model, right?
- 8:49And it's a different day model on top of it.
- 8:51Correct.
- 8:51So, for instance, one of the reasons this took so long was we had to first decide we wanted to do this, convince people that we should do it, find someone.
- 9:02It was at Summelade initially to come in and kind of figure out how to map things and get things working.
- 9:07And then earlier this year, we had Wukash step in and help out as well as the developer in residence to help push this over the finish line.
- 9:15And on top of all that, having to process all that data, export it to the right format, and then have GitHub's tools pull it in and not cause a strain on their system.
- 9:24Because, I mean, this is a lot of data to suddenly dump in and have to replicate across their entire cluster, right?
- 9:30So, there's a reason why it takes so long.
- 9:32And we also don't want to have it happen during...
- 9:35Because we're probably going to be run at a low process priority, which also means we want to do it on a Friday in the afternoon so that it's over the weekend and not when GitHub gets hit the hardest.
- 9:46So, there's a lot of coordination going on.
- 9:48And as we all know, GitHub had some stability issues the other week.
- 9:51And so, they just said, can we just wait until a little later to make sure that Sol's good and solid and everything looks good.
- 9:58So, the plan is April 1st.
- 9:59Excellent.
- 10:00Very exciting.
- 10:00And we also have a good track count to actually break GitHub.
- 10:04I'm not sure if anybody interviewed the live stream.
- 10:07Pablo's changed the master branch to main branch to rename the default branch.
- 10:13But, yeah, we broke GitHub.
- 10:15And it took a while to recover from that, too.
- 10:18So, since our repos are so gigantic.
- 10:20So, we started with ZVS, then moved to SVN, subversion, then went, recorded all this stuff to Mercurial,
- 10:29and then to Git.
- 10:30And I'm not sure how many revisions we have in the tip, but it's gigantic.
- 10:36So, just to be ultra clear here, thanks to GitHub for working with us directly.
- 10:41And actually, they donated money to help us make this all happen.
- 10:44So, they've been really great partners in all this.
- 10:46Thanks to Ezio for getting this started.
- 10:48Marietta for the initial pep, by the way, and even starting this conversation.
- 10:52And for Rukash to stepping in and helping get it finished.
- 10:56Yeah, definitely a team effort.
- 10:57A lot of people involved, and thanks to all of them.
- 10:59So, Tushar out in the audience is joking, is this why GitHub has been crashing the whole
- 11:02week?
- 11:03But, Christian, you were joking, like, maybe, is this actually, did you guys actually cause
- 11:06problems?
- 11:07Not that I know of, specifically.
- 11:08Yeah, okay.
- 11:09But I also, yeah, not that I know of.
- 11:11Yeah, okay.
- 11:11I hope not.
- 11:12I apologize to the world if we did, somehow.
- 11:14Well, it wouldn't be the first time.
- 11:16There's been other outages and other crazy things.
- 11:19Yeah.
- 11:19And unfortunately, at our sites, we would not be the first time.
- 11:21Yeah, for sure.
- 11:23I think there was a huge DDoS attack not too long ago.
- 11:27Anyway, also, Kim out in the audience asked, assuming there are usernames and email addresses
- 11:30on the original issue.
- 11:31So, like, how much did you all care about having fidelity across those?
- 11:36And, you know, this could have been an opportunity to just say, you know what's awesome?
- 11:39Command A, archive in your inbox.
- 11:42To just kind of catch up and be okay.
- 11:44Like, you could have just dropped it and said, we're just going to start over.
- 11:46And if it's important, it'll find its way here.
- 11:48And if it's not, then it wasn't.
- 11:49Yeah.
- 11:50I mean, there has been talk about this.
- 11:52There's varying opinions on how important the digital archives are.
- 11:57Like, do we need to move all the closed issues over?
- 11:59Should we only move open?
- 12:00Like, we actually discussed this when we were looking at potentially up to a week to do the
- 12:05migration versus the two or three days it's actually going to take now.
- 12:08So, but everyone has different opinions of how important the history is.
- 12:12To specifically answer the question, though, from the audience about usernames, as long as
- 12:16you have your GitHub username attached to your bugs.python.org account, that should map over.
- 12:21And you've got until April 1st to get it in there?
- 12:24Yeah.
- 12:24I don't remember if we map email to email.
- 12:28There might be some privacy issues.
- 12:30I can't remember where that all landed.
- 12:31Like, lawyers were consulted.
- 12:33And I was out of the loop on those.
- 12:35But I believe if you at least have specified your GitHub username on bugs.python.org, we will be able to do the map.
- 12:40Yeah.
- 12:40Fantastic.
- 12:41All right.
- 12:42Well, thank you both for the update on that.
- 12:43It's not exactly why we're here, but it's so timely.
- 12:46And I think, you know, you're both involved in it and stuff like that.
- 12:49So quite cool to see it coming along.
- 12:50I personally really think that it's fantastic that CPython is on GitHub.
- 12:55I know it's not that different if it was, say, self-hosted Git or GitLab or even Mercurial or SVN.
- 13:02But there's just something about it.
- 13:04It seems more open to contributors given just sort of the status of GitHub where a lot of people seem to hang out and the whole PR flow and those kinds of things.
- 13:12That was part of the motivation.
- 13:14Somewhat ironically, we actually had to teach a bunch of core devs how to use GitHub as part of the migration.
- 13:18Because, I mean, to be fair, some decent chunk of the core devs don't contribute to other open source.
- 13:23I mean, Python alone is a big enough of a project that it absorbs a large chunk of your time.
- 13:27So they just didn't have to know how to do any other open source development for a different project other than however Python did it.
- 13:34And if we weren't on GitHub, they just didn't have a need to.
- 13:36Plus, we also did the move a while ago.
- 13:39So I think it's coming close to a decade at this point.
- 13:42So it was also a different time.
- 13:47This is a great question of Talk Python To Me is brought to you by Microsoft for Startups Founders Hub.
- 13:50Starting a business is hard.
- 13:52By some estimates, over 90% of startups will go out of business in just their first year.
- 13:57With that in mind, Microsoft for Startups set out to understand what startups need to be successful and to create a digital platform to help them overcome those challenges.
- 14:07Microsoft for Startups Founders Hub was born.
- 14:10Founders Hub provides all founders at any stage with free resources to solve their startup challenges.
- 14:16The platform provides technology benefits, access to expert guidance and skilled resources, mentorship and networking connections, and much more.
- 14:25Unlike others in the industry, Microsoft for Startups Founders Hub doesn't require startups to be investor-backed or third-party validated to participate.
- 14:34Founders Hub is truly open to all.
- 14:37So what do you get if you join them?
- 14:39You speed up your development with free access to GitHub and Microsoft Cloud computing resources and the ability to unlock more credits over time.
- 14:47To help your startup innovate, Founders Hub is partnering with innovative companies like OpenAI, a global leader in AI research and development, to provide exclusive benefits and discounts.
- 14:57Through Microsoft for Startups Founders Hub, becoming a founder is no longer about who you know.
- 15:02You'll have access to their mentorship network, giving you a pool of hundreds of mentors across a range of disciplines and areas like idea validation, fundraising, management and coaching, sales and marketing, as well as specific technical stress points.
- 15:16You'll be able to book a one-on-one meeting with the mentors, many of whom are former founders themselves.
- 15:21Make your idea a reality today with the critical support you'll get from Founders Hub.
- 15:26To join the program, just visit talkpython.fm/founders hub, all one word, no links in your show notes.
- 15:32Thank you to Microsoft for supporting the show.
- 15:34So let's start by maybe talking about, speaking at different times, let's talk about the standard library from, maybe you guys could approach it from a historical perspective to start.
- 15:47Because we're going to focus on stuff that's in there that maybe should be removed and the benefits of taking it out and stuff.
- 15:54But when it got put in, it seemed like a good idea.
- 15:57So when I think about Python, one of the key phrases I hear, I don't know its origin, but the batteries included story, right?
- 16:05Python comes with batteries included and then its frameworks did like Django and so on.
- 16:09And it's a huge selling point, right?
- 16:11This is a language that has a bunch of support built in, right?
- 16:15Yeah, so the rough history, for those who don't know, Python went public February of 1991, right?
- 16:21So 32 years ago, it's predates Linux, right?
- 16:26Like it's really crazy when you look at the history of when projects came out, how long Python's been around.
- 16:30But the other thing to think about is who was on the internet or the World Wide Web even in 1991?
- 16:36Like who even had internet or even a modem back then?
- 16:40And so what that led to was people contributing things to Python that Guido would look at and go, oh, yeah, that's useful.
- 16:48And then just pull it in and put it in the standard library.
- 16:50And it grew and grew and grew.
- 16:52And then at some point in the 90s, like there was a website called the Vaults of Parnassus, which had animated GIFs of wall sconces with little candles with the flickering, whatever, like totally a bit like you can imagine what this is like.
- 17:04It's back in GeoCities days, right?
- 17:06And that's where you went to get your code.
- 17:08And all it was was zip files of Python code.
- 17:10There's no concept of wheels or conda packages or anything like this.
- 17:15There were literally just zip files of code that you just unpacked and just copied over the directory that contained the other Python code.
- 17:22And you just vendored everything.
- 17:24There was no there was nothing else.
- 17:26And stuff moving stuff around the internet was slow as well back then.
- 17:29I mean, a lot of people were on dial up.
- 17:30Yeah.
- 17:30Like internet made noise back then.
- 17:32You were blazing fast with your 56k modem if you were lucky enough to have that, right?
- 17:36So that meant that it was really hard to find high quality code out there, right?
- 17:44And getting done and put up and all that.
- 17:46So things just kept getting added and added to the standard library.
- 17:49And it kept getting bigger and bigger and continued to be useful.
- 17:52And it was just a different time, right?
- 17:54Like, hell, not even everyone in the internet even had a web browser, right?
- 17:59Like I remember when I first got on the internet.
- 18:00Right.
- 18:01I mean, didn't Mosaic come out in 93?
- 18:04Yeah.
- 18:05And actually, one of the very first graphical web browsers was Grail written by Guido in Python, right?
- 18:10Like if you go look up the history, right?
- 18:12It was like, I think Guido missed being the first graphical browser for like months or something crazy.
- 18:17There's a weird history in Python in terms of early web.
- 18:21But what this all led to, right?
- 18:23Like, and I remember, by the way, when I first got on the internet, it was Usenet and Gopher.
- 18:27It wasn't even the worldwide web, right?
- 18:29That was still AOL days back then, for those of you who can date yourself based on that knowledge.
- 18:34Usenet, Gopher.
- 18:34Yeah, it was a different time, Michael.
- 18:37It was a bit of a sidebar.
- 18:38Like, things were so basic back then.
- 18:41But at the same time, there was so much like imagination for what could be, I think.
- 18:45Because so much of it was unmaterialized.
- 18:47And you're like, ah, I can see where this is going to go.
- 18:49Yeah.
- 18:49And internet was even much more expensive in Germany.
- 18:52So I know that until, so I was lucky, I went to university in 2000.
- 18:57But before, when I was living with my parents, I had to pay the internet by the minute.
- 19:03So local calls, so we're not free in Germany.
- 19:07You had to pay for them.
- 19:08And I know that like end of 99, I was lucky.
- 19:12I paid like several hundred a month to have like a free, like a persistent internet connection.
- 19:22Very persistent.
- 19:23But I used the only phone line we had, but I didn't have to pay by the minute.
- 19:26But I paid like in bulk.
- 19:28Right.
- 19:28It's super expensive.
- 19:30That's why lots of people.
- 19:32So I started actually using mailboxes.
- 19:35So I dialed in mailboxes.
- 19:37Right.
- 19:37And they're like this weird concept that you were sending messages.
- 19:40You push the message and later in the night, the mailboxes would call other mailboxes.
- 19:45They do this Unix, Unix copy to copy the like the messages around.
- 19:49And next day you receive the message from a friend who was living like in a different city.
- 19:53Yeah.
- 19:53I remember that was amazing.
- 19:54Like all the backends that would just kind of sync up.
- 19:57And it was like sort of this distributed, like the PBS world and some of the other stuff.
- 20:01Yeah.
- 20:01So it made a lot of sense back in the days to have all the useful bits and pieces in Python.
- 20:08So that's why the library was so big.
- 20:11And so we have just Python code.
- 20:13It was easy.
- 20:14But we also have lots of C code and C extension.
- 20:17And these were really complicated to compile and build.
- 20:20So you had to like make files and figure out which compilers and libraries you need.
- 20:25And building things for Windows was super painful for the Windows people that they had to get the right compiler version.
- 20:34They had to figure out their VC vars bat setup.
- 20:37Yeah.
- 20:37And each Python version had like its requirements for different like Visual Studio versions.
- 20:42Yeah.
- 20:43So I think that's, you know, people get a sense of the time, right?
- 20:47Like at that time, it was amazing for Python to say, as much as we can get into the standard library, it's going to be a benefit to people.
- 20:55Because if you need to parse CSS color codes, hex color codes, and it's built in, that's a bonus, right?
- 21:02There's not the idea of pip and fast internet and all those things, right?
- 21:07Or even disk details, right?
- 21:08Like as Christian was saying, compilation was hard enough as it is.
- 21:11So getting something in the standard library and ported over to C code for performance was a huge deal.
- 21:16So it's not even just distribution.
- 21:19It was literally just creating these things.
- 21:21It was difficult.
- 21:22Sure.
- 21:23So it just shows how far we've come, right?
- 21:25That these were even problems that we used to have.
- 21:27Yeah.
- 21:27It's pretty interesting.
- 21:28Do you think if Python were designed today from scratch, you know, this is the kind of the language we want, it would be packaged in the same way that it is now?
- 21:39Like, would it have a large standard library?
- 21:42No.
- 21:42So that would be controversial.
- 21:43I agree with Brett.
- 21:45Yeah.
- 21:46Yeah.
- 21:46Well, which is why we're friends and why we wrote this pet that we're going to be talking about.
- 21:50It would just all be written in WebAssembly.
- 21:52Oh, we have friends.
- 21:54Thank you.
- 21:56We went to a movie together, one of the PyCons of Portland, man.
- 21:59Yeah.
- 21:59And we are friends on Nintendo Network.
- 22:02Yes, on Switch.
- 22:03Yes.
- 22:03Yeah.
- 22:05Look at more recent languages like Rust and Go and stuff.
- 22:07They have a much more targeted standard library.
- 22:10They're able to lean on the community and people seem fine with it.
- 22:13And I think that's a key thing is we get to learn the less.
- 22:17People have gotten to learn lessons from us, but we also can learn.
- 22:20We would have been able if we started now to learn lessons from other people.
- 22:23And I think that'd be one of them is targeted standard library that is very tight and very
- 22:28targeted, very foreign, very stable.
- 22:30And that's much easier to maintain would probably be the good way to go.
- 22:34Because it makes getting yourself up and going a lot easier versus, oh, this isn't useful
- 22:38until I have this huge standard library, which as a burgeoning project would have been really
- 22:43difficult because you had to build a lot of code to make that happen.
- 22:46Right.
- 22:47I do value having it there, though, at the same time.
- 22:50I understand why it would be smaller.
- 22:52I just think there would be some use cases that it would be less of an obvious choice to
- 22:56use Python.
- 22:56Like, for example, if I just want to script something on my computer, knowing that it has
- 23:01Python means it has all these libraries where as opposed to if you've got to start installing
- 23:08dependencies just to get your sort of automation scripts to run, like there's this bootstrapping
- 23:13stuff that has to happen.
- 23:14Yeah, from a philosophical perspective, we actually don't have a definition of what the
- 23:18standard library is, right?
- 23:20There is no PEP.
- 23:21There is no guidance over what the standard library is now meant for, what it should or
- 23:26shouldn't have.
- 23:27It simply doesn't exist.
- 23:28It's always been previously based on Guido's opinion somewhat.
- 23:32And then now that's the steering council, it's somewhat based on just kind of consensus on
- 23:38the dev team.
- 23:38And that's kind of what the steering council will approve more or less.
- 23:42But there is no guidance, right?
- 23:44Like, should we make it so that, as you said, that simple automation script for managing
- 23:49your computer?
- 23:50Should that be, have enough in the standard library to make that happen?
- 23:54Should we be able to have a simple HTTP server?
- 23:59Right.
- 23:59I don't know.
- 24:00Should we have Tkinter?
- 24:01Right.
- 24:02Where is the line?
- 24:03And we don't have an answer right now.
- 24:06There is a discussion going on right now, actually over on Python Dev discussing this kind of
- 24:12thing because there was a proposal to potentially rip out URL Lib.
- 24:15I think it was partially done by Victor Center to kind of not get a rise out of people, but
- 24:20to kind of spark a conversation.
- 24:21And some people are going like, okay, URL Lib was written back in the day when OSes did not
- 24:28necessarily ship with the network stack.
- 24:30Right.
- 24:30And when we could plug into it.
- 24:32Would it be better to actually rely on the OS?
- 24:34Right.
- 24:35Do we really have to have all of that code in there just to parse things and figure things
- 24:39out to make the right HTTP requests versus just going to macOS or going to Windows or using
- 24:43curl and Linux or any Unix platform really, and just have it handle the request?
- 24:49I don't know.
- 24:50But I mean, this is the kind of question we're getting into now.
- 24:53And we'll probably get to, I mean, we'll talk about later.
- 24:56I have one of my infamous Brett's grand plan things around the standard library.
- 25:01And this all ties into actually finally into making that decision of what do we want the
- 25:06standard library to be?
- 25:07So we have better guidance for ourselves as to where it should go.
- 25:11And that's what should or should not be in the standard library.
- 25:13Now, not to spook people, I don't know if this means we never deprecate anything that
- 25:17doesn't follow this policy that's in there now.
- 25:18But I would like to, at least as a core dev, know what we want it to be for today compared
- 25:24to the cheap shipment model of useful Python code on the internet, pre-internet.
- 25:31Right.
- 25:31So, and Michael, earlier you asked me about security bugs.
- 25:35And so Victor's proposal or Victor's threat on Python dev sparked by a discussion I had
- 25:42with Victor on internal communication channels where I pointed out that ULLIP is actually a
- 25:49place where we have lots of security bugs.
- 25:52And even in very trivial things like to insert like parsing like in URL.
- 25:58So something like splitting up the protocol, the host, the path name, the suffix.
- 26:03This is not trivial.
- 26:05And the way how our internal like parser works, it's written for a more forgiving and more open
- 26:13world.
- 26:14But people also use the routines, the like real open URL parse to verify and validate potential
- 26:23hostile requests that sometimes fails because we are too open.
- 26:27We are too nice.
- 26:29And so this was one of the other reasons why the discussion should spark.
- 26:33It's also a bit related to WebAssembly, but I think we can postpone it for later.
- 26:38But there are two interesting interactions with how WebAssembly or the WebAssembly runtimes
- 26:43environments work and what's not going to work with ULLIP.
- 26:46Yeah.
- 26:47And the WebAssembly discussion also comes back to what Brett was talking about for sure just
- 26:51a minute ago.
- 26:52So defining what is the standard library.
- 26:54Do you want to come back as well to that later?
- 26:58But let's talk about your PEP.
- 27:01Which one of you wants to introduce?
- 27:03PEP 594, removing dead batteries from the Python standard library.
- 27:07Christian is the original author.
- 27:08I just PM'd it to the finish line.
- 27:11So I'll let Christian take this.
- 27:12Yeah.
- 27:13I ran out of steam and Brett just pushed and pushed it.
- 27:15Helped me to push it over the finish line.
- 27:18Yeah.
- 27:18So what's the idea here?
- 27:19The idea here is to remove things that are in our personal opinion and maybe with some
- 27:27reasoning no longer like super required in the modern world.
- 27:31So there are especially some parts that cost us lots of time and energy.
- 27:38The interesting or the most relevant library for that is like NNTP.
- 27:41So the library to interact with new servers that we've got your information.
- 27:48Like Usenet?
- 27:49Usenet.
- 27:49Yeah.
- 27:50Usenet.
- 27:50So since we don't have a server implementation of NNTP, so the use standards, only the client
- 27:57libraries, we need to use like actual new servers for testing.
- 28:03So we need to connect to some servers and do some testing.
- 28:05These servers are no longer like stable.
- 28:08So we used to use libraries like sites like Gmain a lot or one French new server that was
- 28:16stable, but they're sometimes don't work like we expect it to work.
- 28:21They're sometimes just not available or the NTP connection fail or get like issues with
- 28:26GLS connections.
- 28:27And these issues we're having blocked our whole CI chain.
- 28:31So when you do pull requests, you run your tests against Windows and Linux on X664 and
- 28:40on also MacOS.
- 28:42So like think for platforms.
- 28:45But once your pull requests is merged, it also kicks off the whole build bot farm.
- 28:50There are like 20, 30, 40 different platforms that run the tests host commit.
- 28:55Anytime one of the NNTP servers had a hiccup, we have like false alarms and like indicating
- 29:03problems somewhere which were not problems with the code or with the test, but rather with
- 29:08the infrastructure that was failing.
- 29:10And it was one of the motivations while I wanted to remove an NNTP.
- 29:14Sure.
- 29:14And how often are people depending on that these days?
- 29:17One.
- 29:18Two.
- 29:19Who's maintaining it?
- 29:20There was a really interesting list you all have of like, these are the things we want to
- 29:24consider to remove.
- 29:25There is somebody who understands and maintains it now.
- 29:28A lot of them have a no for that, right?
- 29:30Yep.
- 29:31That's another aspect of this, right?
- 29:32It wasn't, it was things that were failing our test suite because the thing we had to rely
- 29:38on just wasn't stable enough or available.
- 29:41But our parts were just simply no one wanted to step forward and say, I will make sure that
- 29:48this keeps working in modern versions of Python and compiler errors are dealt with.
- 29:53And I will deal with any feature requests and bug reports and all that.
- 29:58Right.
- 29:58Because the standard library before this PEP was more, had numerically more modules than
- 30:04there are countries in the world.
- 30:05Right.
- 30:06Like the standard library is that vast.
- 30:08And I think, I don't even remember if I even delved into sub sub modules of packages.
- 30:12Like I think literally the top level namespace.
- 30:14Top level.
- 30:15Yeah.
- 30:15So there is a aspect here of maintainability of just simply, there are only so many core
- 30:21devs to handle the influx.
- 30:24Hence why we have 1,600 pull requests that are currently open.
- 30:27And at some point you just have to kind of stop and go like, okay, who is benefiting from
- 30:33us carrying this forward?
- 30:34And how much of a detriment is it to the project to keep it going?
- 30:37And some of these things, yeah, it was just a question of, right, is this useful enough
- 30:43to the world for us to put the effort into maintaining it and having to make a call on some of them?
- 30:47And sometimes no one stepped forward.
- 30:49And sometimes some people very much stepped forward and said, I totally rely on this.
- 30:53And then it became a question that's like, okay, is it just you that needs it?
- 30:58Or is it a large or decent enough size chunk of the community that still needed it that
- 31:03it warranted keeping around and continuing to support it?
- 31:05Because I did a number crunch the other day of certain sub directories in the Git repo.
- 31:12And if you look at just straight code between the standard library and the interpreter, 60%
- 31:19of that is standard library.
- 31:21Wow.
- 31:21Yeah.
- 31:21How much does it influence your feeling and opinion about something, whether it has some
- 31:27C component or if it's just pure Python?
- 31:30Is it easier to keep a pure Python thing around that just is sort of higher level, doesn't
- 31:35require as much nuance, or does it not really matter?
- 31:38At least for this PEP, I don't think we really took that view specifically.
- 31:41The management is more just a side effect almost.
- 31:45But this was mainly, as the title puts it, dead batteries.
- 31:49So when Christian brought this list up initially, it was, I don't think these are useful in modern
- 31:54times.
- 31:55Less than, oh, well, this is also written in extension modules, which makes it harder
- 31:59to maintain because you can't just ask an average Python developer to come in and help maintain
- 32:04it.
- 32:04You have to ask someone who knows Python and C extension modules to come in and help maintain
- 32:09it.
- 32:09It was, that was never the motivation directly.
- 32:11Okay.
- 32:11Yeah.
- 32:12But knowing cross-platform networking code in C is, is technically, I would say, harder than
- 32:17knowing standard Python.
- 32:18Oh, yeah.
- 32:18This portion of Talk Python To Me is brought to you by Fusion Auth.
- 32:24Fusion Auth is an authentication and authorization platform built by devs for devs.
- 32:30It solves the problem of building essential user security without adding risk or distracting
- 32:35from the primary application.
- 32:36Fusion Auth has all the features you need with great support and a price that won't break the
- 32:41bank.
- 32:42And you can either self-host it or get the fully managed solution hosted in any AWS region.
- 32:48Do you have a side project that needs custom login and registration, multi-factor authentication,
- 32:53social logins, or user management?
- 32:55Download Fusion Auth Community Edition for free.
- 32:58The best part is you get unlimited users and there's no credit card or subscription required.
- 33:04Learn more and get started at talkpython.fm/Fusion Auth.
- 33:09The links in your show notes.
- 33:11Thank you to Fusion Auth for supporting the show.
- 33:13Let's first talk about the status.
- 33:16So, accepted.
- 33:17All right.
- 33:18So, this is happening.
- 33:19The first PR to document the modules being removed got committed last week.
- 33:24And I now, now you all get to see the curtain pulled behind how Python is developed.
- 33:30I'm going to publicly ask Christian to review my PR to deprecate AIFC.
- 33:34I know he's busy, so.
- 33:35But the first PR to actually, or maybe he reviewed it before the podcast.
- 33:40I don't know.
- 33:40But the first PR to actually deprecate AIFC, the first module in alphabetical order is now up.
- 33:46So, I'll just be cranking through them until beta.
- 33:49I feel like I saw in the release notes here that the Python 310.4 was out.
- 33:55And this has deprecated various modules according to this PEP.
- 33:59Is that right?
- 33:59Yeah.
- 34:00So, the steering council made the decision that it was useful enough to backport the documentation deprecation.
- 34:09So, Python 311, obviously, because that's going to raise a deprecation warning.
- 34:14But 310 and 3.9 also document that these modules are deprecated.
- 34:19Because we didn't want people coming in in a company where they're on 3.9 at the moment,
- 34:24start using these modules, and then be surprised in two years' time or what have you when they upgrade to 3.11 or later.
- 34:30And suddenly, oh, this thing I've been using is suddenly deprecated.
- 34:33Oh, this went back farther than 3.10, huh?
- 34:35Mm-hmm.
- 34:35Because 3.9 is still accepting bug fixes.
- 34:37Got it.
- 34:37So, that's what that means.
- 34:39It's purely documentation.
- 34:40The code is not changed at all.
- 34:41It is literally just, if you go to the module index or any of these modules,
- 34:46it will just have a big deprecated term on it.
- 34:49Yeah.
- 34:49Quick bit of nomenclature, real-time follow-up.
- 34:52Mr. Hypermagnetic says, what is pure Python if not CPython?
- 34:56Christian, you want to sort of disambiguate the CPython from Python that has C?
- 35:01So, in Python, we have models that don't have, like, dedicated C models that are just written in Python code.
- 35:11There are other models that have a minotary backend in C.
- 35:16Like, if you look at the SSL model, which I maintain, the binding still must have written in C.
- 35:22And the public-facing SSL model is FSA and adds on top of the C backend.
- 35:28And this we would consider as a non-pure Python package because it requires C code.
- 35:35There are also other models we had in the past.
- 35:39A lot of the data structures like list and so on, right?
- 35:42Yes.
- 35:42All the core data types are written in C.
- 35:44Yeah.
- 35:44But they count.
- 35:45They are present always.
- 35:46So, we're just talking about, like, things you would import and use.
- 35:50Got it.
- 35:50I see.
- 35:51Yeah.
- 35:51Yeah.
- 35:51And then we have accelerator modules as well, like Datetime, where they're implemented twice.
- 35:55Once in pure Python and once in C.
- 35:57So, like, PyPy will use the pure Python version or any platforms that can't compile the C code for whatever reason.
- 36:04And then there's the full C version for performance.
- 36:07So, pure Python just means the entire chunk of code for that module that you import is written only in Python code.
- 36:14There's no C code at all.
- 36:15Directly.
- 36:16Obviously, what you import can transiently cause that.
- 36:19For sure.
- 36:19Yeah.
- 36:19Christian, what's the idea?
- 36:20Are we just going to, just when 3.11 comes out, all the modules are just yanked?
- 36:24At 3.30.
- 36:25So, 3.11, they will.
- 36:28What's the plan here?
- 36:29It's not so immediate or so abrupt, is it?
- 36:32No.
- 36:32It's going to take a couple of years.
- 36:35So, in 3.11, you'll get, like, the deprecation warnings.
- 36:40I think that's a plan, Brad, to just emit a deprecation warning.
- 36:45So, if you would import a model and have the warnings model enabled to show you deprecation warnings,
- 36:50then you would get a warning pop-up.
- 36:52And even in your CI, turn the deprecation warnings into deprecation exceptions, so into a hard failure.
- 37:00And then you see, I would fail and inform you that you're importing something deprecated.
- 37:05This will continue in 3.12 and 3.13, the models are gone.
- 37:11Right.
- 37:12Okay.
- 37:12So, that's over, basically, a more or less two-year period because 3.11 is pretty imminent, right?
- 37:18Yeah.
- 37:18October.
- 37:18October.
- 37:19So, 3.13 would be October 2024.
- 37:24Yeah.
- 37:24Sounds far off now.
- 37:26I'm sure it's not in practice.
- 37:27Yeah.
- 37:28And to be clear, if, for some reason, the community really spoke up very vocally across a large swath of people, we might consider postponing.
- 37:37I don't think there's anything here we would not yank.
- 37:39But if people need, for some reason, more time to move, we might consider holding off.
- 37:43But we're fairly confident that most of these aren't.
- 37:46And already, honestly, the ones that people really care about are already getting copied and put onto PyPI.
- 37:50So, people can totally still get the original code.
- 37:54And to be very clear, you're already using code from Python, which means you're already using the Python license, the PSF license for this code.
- 38:02So, copying and pasting this code is totally fine.
- 38:05And we encourage it if you need this code, right?
- 38:08Because it's deprecated, it's not going to be changing.
- 38:11Unless it flat out breaks because of some change in Python that requires an update, this code is more or less after this deprecation lands.
- 38:18That code is not getting in touch.
- 38:20Which means you could totally copy what's in there just prior to the deprecation or what's in 3.10, honestly.
- 38:25Because, once again, these modules aren't really being updated.
- 38:28These are the ones that are being basically ignored and just dragging along anyway.
- 38:31Exactly.
- 38:31So, you could totally go in, copy the code over into your own code base, paste it in.
- 38:37Save it under the exact same name and it should more or less keep working the same way.
- 38:41You'll have to maintain it.
- 38:42Yeah.
- 38:43So, there's kind of two paths forward for people who are like, no, I really need AIFC audio file parsing or whatever that is.
- 38:50One, somebody might decide it's really important and they want the CPython version as a pip installable thing that you can then add back into Python with a dependency.
- 39:00Right?
- 39:00That could be a possibility.
- 39:01Yeah.
- 39:02Or, as you just described, you could vendor it, which means just copy the file and you just have a copy of the source code internally and it's just part of your app now.
- 39:10Yep.
- 39:10Exactly.
- 39:10Oh, and IFC has an interesting backstory.
- 39:13So, when I posted my first draft of the pap, I got contacted by a lead technical director from DreamWorks Animation Studios.
- 39:22They wanted to keep the model in CPython.
- 39:26So, Python is heavily used in the movie industry.
- 39:32So, if you see any blockbuster, it's probably powered by Python internally.
- 39:38Even so far that Python just won a special prize for the animation awards, the annies, what they're called.
- 39:47That's right.
- 39:47And Guido got that award, right?
- 39:49Yeah.
- 39:49Basically, the...
- 39:50Guido got the physical award and some core devs, including Christian, got requested certificates.
- 39:55Yeah.
- 39:56And I believe, yeah, Christian's getting his.
- 39:58Oh, that's fantastic.
- 39:59The UIworks Award, that's the second guy who invented Mickey Mouse, for example.
- 40:05So, UIworks and Walt Disney invented Mickey Mouse together.
- 40:10Fantastic.
- 40:11That's a cool honor.
- 40:12And probably an unexpected one from working on Python.
- 40:14Christian and I have been doing this long enough that I think I've mentioned this on the podcast.
- 40:18When I first got involved as a core dev of Python, I still had to explain to people what Python even was, right?
- 40:23Or if I was lucky enough that they knew what it was, they just would go, is that the language where white space matters?
- 40:28Right?
- 40:28Yeah.
- 40:29Yeah.
- 40:29Is that the one that's weird?
- 40:30Yeah.
- 40:30So, it was a totally different time.
- 40:33And now we're being used to help power helicopters, help plan flight paths for helicopters on Mars and hunting the video of the lander that made that helicopter take off and processing images of black holes and gravitational waves.
- 40:50I just had an interview.
- 40:52Your JWST episode that I haven't listened to.
- 40:55Yeah.
- 40:55Yeah.
- 40:55Yeah.
- 40:55It's nuts.
- 40:56So, no.
- 40:57I never thought any of this would ever happen.
- 40:59So, yeah.
- 41:00Having blockbuster movies have their entire management pipeline for their assets written in Python, it's always mind-boggling where Python is and what it's powering.
- 41:10I mean.
- 41:10That's cool.
- 41:11It's not just all your cat videos and photos on Instagram anymore or videos on YouTube.
- 41:16Yeah.
- 41:17It's both amazing and par for the course.
- 41:19Yeah.
- 41:20And I can't believe I just said it's not just Instagram and YouTube anymore.
- 41:23We've also been there long enough that people have realized we power huge websites.
- 41:27Yeah.
- 41:28Absolutely.
- 41:28Lots of stuff in the world.
- 41:29Yeah.
- 41:30No, it still blows my mind constantly.
- 41:31Yeah.
- 41:32YouTube was originally written in Python.
- 41:33I think it's still lots of parts of YouTube are powered by Python.
- 41:37Last time I spoke with someone there, it was.
- 41:41Yeah.
- 41:41Sydney out in the audience has an interesting question.
- 41:43Like, so there's a list of things that are deprecated here.
- 41:45Some that were threatened but kept.
- 41:48You know, they were on the list and then they're just like, ah, maybe not.
- 41:50Sydney asked, might there be further removals in the future?
- 41:54Maybe.
- 41:55Yeah.
- 41:56So here's the deal.
- 41:56This PEP was done because Christian, I personally think rightfully so, thought we needed to do
- 42:03a bit of house cleaning and get rid some stuff that was just kind of just sitting there rotting
- 42:06in the corner and not being loved.
- 42:08Some things got kept because to keep the controversy low, Christian was very conservative with the list.
- 42:14And basically, if anyone stepped forward and said, no, no, please don't take that out.
- 42:16That was a core dev.
- 42:17It more or less just got left.
- 42:18Very few things are on this list that people still pushed back and said, we're removing
- 42:22even if core dev wanted to keep it.
- 42:23That being said, as I said earlier in this podcast, right?
- 42:28Like Brett's crazy grand plan here is, was to help Christian get this PEP done, get initial
- 42:33clean done.
- 42:34I've started a conversation over on Python committers about how to maintain the standard library,
- 42:39right?
- 42:40Like what does it take to add a module and to remove a module?
- 42:42Because that's actually not very clearly stated either.
- 42:45It's been very just kind of open.
- 42:48My perspective from the outside of what defines the standard module is just, it's write only,
- 42:54like stuff only gets added and it's defined to be what's in the shipping version of Python,
- 42:59right?
- 42:59I mean, that's kind of an implicit definition.
- 43:01Right.
- 43:01But how do you get something in there?
- 43:03Right.
- 43:03Like, did you know that GraphFlip was added by a couple of core devs just because they thought
- 43:09it was a good idea?
- 43:10Yeah.
- 43:10It wasn't, no one asked like the chain counts or anything.
- 43:12That's how it's been historically maintained.
- 43:15It's very much just an open thing.
- 43:17And there's a proposal to kind of make it a bit more structured and you could argue more
- 43:22rigid depending on your view of this whole process.
- 43:24More modern.
- 43:26Maybe.
- 43:26Maybe.
- 43:27By suggesting that you need a PEP to add something because it's a shared cost to all the core
- 43:32devs that we have to maintain it.
- 43:33You'll notice I have a slight theme here of maintenance costs.
- 43:37Or...
- 43:38I have a puppy for you.
- 43:39One that's fluffy or one that I'm going to have to pay vet bills for?
- 43:43Clean up the poop.
- 43:45Might ruin your carpet, but it's also cute.
- 43:47So you'll...
- 43:47Yeah.
- 43:47I've got a cat.
- 43:48I'm good.
- 43:49I don't know if it's not the joke.
- 43:50So I've just watched Brad's keynote from PyCon like three or four years ago.
- 43:54I think it was...
- 43:56Maybe.
- 43:56It was the first one in Cleveland, whichever one that one is.
- 44:00I can't remember.
- 44:012018, I think.
- 44:02I think it was 18.
- 44:03Yeah.
- 44:03Once that's settled, my hope is, once again, come up with a policy of what that means for
- 44:09the standard library.
- 44:10Once we have that policy, there will probably be a discussion about what does that mean for
- 44:14the current standard library?
- 44:14Do we leave it as is?
- 44:16Do we maybe slowly transition over or not?
- 44:18I don't know.
- 44:19Some people like Lukash, for instance, have advocated never removing anything from the standard
- 44:23library ever again.
- 44:24And literally just saying, this is deprecated.
- 44:27We will never touch it or update it.
- 44:28It's dead, but it's sitting here so we don't break code.
- 44:32Other people are way more, let's strip it to its bones.
- 44:35And if you need this stuff, we'll make it as a separate package or something.
- 44:40Some people have talked about keeping it as is, but separating the development process.
- 44:44So it's actually an externally maintained thing and it has its own release process and schedule
- 44:49and all that.
- 44:49The answer is, I don't know, but this is not the first time I've deprecated modules and
- 44:54had them removed.
- 44:54I was also in a competition with Fred Drake back in the two to three transition to see who could
- 44:59remove the most number of lines of code in Python.
- 45:02And I won thanks to removing the compiler package.
- 45:04So I have been around long enough to say, probably, I just don't know when, just because I will
- 45:11never say never when it comes to a project that's 32 years old.
- 45:14But there are no specific plans right now outside of this PEP of deprecating and removing anything
- 45:19else from the standard library.
- 45:20So if that's the question concretely, no plans.
- 45:23But philosophically, I am not willing to say anything.
- 45:26I never say never.
- 45:28Yeah.
- 45:28Yeah.
- 45:28So one of the things that stands out, let's talk about the modules real quick.
- 45:32Then I want to, I want to kind of talk a broader thing because I think it's going to lead us
- 45:36down a path.
- 45:37So maybe just give us a quick overview of the highlights, let's say, of things being removed.
- 45:43I talked about this table here.
- 45:45It's under the deprecated modules heading on the PEP.
- 45:47And it has a module name, when it's deprecated.
- 45:51Some of them are like deprecated in 3.6, when it's to be removed, when it was added, whether as a
- 45:57maintainer.
- 45:57And interestingly, I thought this was cool.
- 46:01There's an alternative that's new or better and maintained that you could just use, right?
- 46:07Yes.
- 46:07If you look at the table, you'll know some of the stuff's actually been somewhat documented
- 46:11as deprecated all the way back to Python 2.0 or 3, right?
- 46:15Like you also have to understand some of the stuff got documented as don't use anymore.
- 46:19A long time ago, we just didn't take the code out.
- 46:21And this is more of a push to actually finally remove the code and the documentation.
- 46:25I see.
- 46:26But yeah, so we have AIFC, which I believe is the audio format.
- 46:30Correct.
- 46:31We have async chat and async core, which were very early async server things in the standard
- 46:38library that you shouldn't use, obviously, because it's on this list.
- 46:41Yeah.
- 46:41An alternative is asyncio, which was added in 3.4.
- 46:45Yeah, it's actually asynchronous.
- 46:46I think the async check, async core were added for Zope back in the days.
- 46:51I know that the Zope server used to use async core async check a lot.
- 46:55I don't even remember what the hell audio app is.
- 46:57Audio app is low level, like conversion.
- 47:00And math operations used by IFC, WAVE, and some of the other sound models.
- 47:05So this just provides math primitives in C.
- 47:08CGI is literally what it sounds like.
- 47:10It's helpers to write CGI scripts.
- 47:12That sounded like one of the bigger, harder to work with ones.
- 47:16Like there's no maintainer.
- 47:18It was designed at a different time.
- 47:20Yeah.
- 47:20And the funny thing, though, is a lot of packages still use bits of it because there's weird
- 47:26little helpers in there.
- 47:27But if you also go look at what the helpers are doing, most of them are either a one liner
- 47:32or they delegate to something else somewhere else in the standard library at this point.
- 47:35And they have horrible APIs now because they very much expect it to be CGI.
- 47:40All right.
- 47:40So they're reading from like environment variables and files to get the things to process versus
- 47:45passing them as an argument.
- 47:46From STD in and STD out.
- 47:48So pretty much hot code STD in and STD out.
- 47:52Yeah.
- 47:52So there's actual pushback on CGI.
- 47:54But I think when we pointed out like this just delegates to here or this is literally a
- 47:58one liner that I can paste in when you're in the discussion of what it does, like just
- 48:02copy and paste this reject literally and or just whatever.
- 48:07Most people, I think, were OK with it.
- 48:09This is actually, I think, one of the first modules to get put up on PyPI like a couple
- 48:12of weeks ago.
- 48:13CGI TV is tracebacks, pretty tracebacks in your CGI code.
- 48:17I mean, once again, if you don't have CGI code, you don't need the tracebacks.
- 48:20One goes, the other comes with it.
- 48:21Yeah.
- 48:21Chunk, I think, is literally just chunking data.
- 48:23It's literally just breaking up into chunks.
- 48:25Not a little bit like editor tools.
- 48:27Yeah, I think so.
- 48:27If I remember correctly.
- 48:28Well, it's a format to distribute files used by mailboxes or so.
- 48:35If I remember correctly.
- 48:36Yeah.
- 48:37I will let Christian talk about crypt.
- 48:39Yeah.
- 48:39Crypt is a binding to the ellipsis.
- 48:42Crypt function is used to password hashing.
- 48:47No way around.
- 48:49The problem with that is that the only guaranteed algorithm that's available is horrible.
- 48:53And if you need some of the better ones, they're probably not available in your libc.
- 48:58So there's like optional algorithms for password hashing.
- 49:02And even there are problematic.
- 49:04So I've used one of these replacement ones.
- 49:06So they're much better.
- 49:08Like Bcrypt or passlib or anything else that's doing it right.
- 49:12Yeah.
- 49:12That's great.
- 49:12Yeah.
- 49:13And image shader is just a very limited approach to detect if you have a PNG, GIF, JPEG, whatever,
- 49:20based on the first couple of bytes of a file.
- 49:24Just the same with audio headers or sound headers.
- 49:27They just detect file formats.
- 49:29But they only support a very limited setup file formats.
- 49:32And there are better libraries that are more efficient and support much more different file formats.
- 49:38Yeah.
- 49:39So after image headers, MSI lib, which helps with Windows MSI installers.
- 49:44Okay.
- 49:44Why do we have this in the standard library kind of question?
- 49:47I think we used it originally to help write the installer for Windows.
- 49:50And I think we don't use it anymore.
- 49:52So it's no big deal.
- 49:53We already talked about NNTP lib.
- 49:56NIS.
- 49:57Who still uses NIS?
- 49:58It's on yellow pages.
- 50:00Yeah.
- 50:00Exactly.
- 50:01Do people even know what sun is anymore?
- 50:04Right.
- 50:04We're getting to that point in our lives.
- 50:06I think it's a synonym for Oracle.
- 50:08Yeah.
- 50:08Exactly.
- 50:09OSS audio dev is just a wrapper on an audio library.
- 50:12Once again, does that really belong in the standard library?
- 50:15Yeah.
- 50:16It was used by Linux before they had alt sub, before they had pulse audio and pipe wire.
- 50:21So this is like from the old 2000s.
- 50:25No.
- 50:25Pipes library more or less got replaced by subprocess.
- 50:28So it's literally just Unix pipes.
- 50:30SMTPD.
- 50:31I don't think we need to be able to run a server to send email in Python.
- 50:34Standard library.
- 50:35So that's why that's there.
- 50:36Yeah.
- 50:37And there's a IPI alternative.
- 50:39Yeah.
- 50:40Send header.
- 50:41Coach, you already talked about.
- 50:42SPWD.
- 50:43It's the binding to the Etsy shadow file.
- 50:47So that's the place where Linux actually keeps the passwords for users.
- 50:51But that's the wrong approach.
- 50:54So if you want to log in a user, you don't check the password.
- 50:57You ask the PAM stack if the user's allowed to log into a service set.
- 51:02Sun.
- 51:02Are you is another audio format from Sun?
- 51:06So Telnet lib.
- 51:08Yeah.
- 51:08Telnet.
- 51:09Server.
- 51:10This was specifically to be a server, not a client of Telnet.
- 51:13It's not a client library.
- 51:14Sorry.
- 51:15The client library.
- 51:16So I don't think you have a server.
- 51:17But actually, I would have to open the code and read the code.
- 51:20UU.
- 51:21That was used by UUCP.
- 51:23So Unix to Unix copy.
- 51:25It's a chunking format to transfer binary data.
- 51:29And XDR lab, another Sun library that is the binary format used by NFS.
- 51:37And remote procedure calls.
- 51:39If you have like Sun remote procedure calls for network fault servers.
- 51:44From 1992.
- 51:45Indeed.
- 51:46There's an interesting high frequency of Sun being mentioned here.
- 51:51Yeah.
- 51:51I mean, Python used to run cleanly on Solaris right out of the box.
- 51:54Yeah.
- 51:55And Sun developed lots of internet standards we still use these days.
- 51:59Sure.
- 51:59For sure.
- 52:00So hopefully all the listeners were shocked and had no clue any of these modules existed.
- 52:04And hence why we're getting rid of them.
- 52:05Where's the threatened list?
- 52:08It's down here somewhere.
- 52:09The modules to keep.
- 52:10Yes.
- 52:11So we got ColorSys, FileInput, GitOpt, OptPars, and Wave.
- 52:16Those are the ones that avoided being cut.
- 52:19Mm-hmm.
- 52:20ColorSys, to be frank, is just basic math.
- 52:25It's nothing special.
- 52:26But CoreDev said, I use it.
- 52:27I'll keep it around.
- 52:28I'll maintain it.
- 52:29Okay.
- 52:30Like parsing RGB color.
- 52:32Yeah.
- 52:32FileInput.
- 52:33I don't remember about FileInput.
- 52:35I think someone just said, I use it.
- 52:36GetOpt and OptParse.
- 52:38Where once again, is it worth getting rid of versus AugParse?
- 52:42And is it widely used enough?
- 52:44And it was just one of these.
- 52:46There's just too much code out there right now to warrant working it out.
- 52:50So we just said it's easier to keep.
- 52:51And Wave plays WAV sound files.
- 52:55And basically, it's used by education.
- 52:59It's a quick and cheap tool to show kids computers can do fancy stuff like make noise.
- 53:04Oh, yeah.
- 53:05That's actually really nice if you've got your turtle moving along.
- 53:08It could laugh when it gets to the end of its little thing or whatever, right?
- 53:11Yeah.
- 53:11But I mean, that's another good point, Michael.
- 53:13Like, oh, turtle.
- 53:14Well, that requires us shipping TK Enter, which requires us shipping Tickle TK.
- 53:19And it's just like, where do you draw the line?
- 53:21Yeah.
- 53:22But it's turtles all the way down.
- 53:23You know that.
- 53:24Hey, and as someone who learned turtle back on an Apple IIe with a good old green and black screen,
- 53:31like, I totally get it.
- 53:32But I mean, these are the questions we're starting to ask ourselves, right?
- 53:35Like, where's the line?
- 53:36Yeah, indeed.
- 53:37All right.
- 53:38Before we run out of time, let's have a broader philosophical conversation about this stuff.
- 53:43You said you have a big plan.
- 53:45You know, one of the things that I think is interesting about Python is where it runs in all these different
- 53:51places.
- 53:51I mean, you've got Mac, Windows, Linux, but you also got Raspberry Pis.
- 53:56You've got helicopters.
- 53:57You've got robots.
- 53:58And then you even have, you know, CircuitPython and MicroPython, where it's like really, really
- 54:04small.
- 54:04And I do think it would be interesting to say, here is a subset, a portion of Python and a
- 54:12portion of maybe even the language syntax that if you program to this, you're guaranteed
- 54:17to be able to run it everywhere, right?
- 54:19Is there a way to agree?
- 54:21Maybe that compiles to WebAssembly and runs in the front end on a browser.
- 54:24Who knows?
- 54:25So for any of you who read my blog, you'll know I've been doing a long running blog post
- 54:30series on the syntactic sugar of Python.
- 54:32And part of the reason I've been doing that is I've been trying to figure out what I've been doing
- 54:38and I've been doing that.
- 54:40I've been doing that.
- 54:41what I've been doing that.
- 54:41What I've been doing that.
- 54:42What I've been doing that.
- 54:43What is the core set of Python constructs that must exist to basically reconstitute all the other
- 54:51parts of Python and its syntax.
- 54:52And kind of if we were to start from scratch almost, what would that look like?
- 54:57Now that's interesting from a language level, but from a standard library level that comes
- 55:02into play only in terms of support, right?
- 55:04Like we dropped this feature, would that break things, right?
- 55:07Like name tuple.
- 55:08Right.
- 55:09Well, for example, does TK intern need to be in the WebAssembly front end version?
- 55:14Probably not, right?
- 55:15No idea.
- 55:16I guess not, but you know, maybe.
- 55:17Probably not.
- 55:18Yeah.
- 55:18I mean, that's the tricky question, right?
- 55:20It's always one of these things of who are you optimizing for?
- 55:23Who's the target audience?
- 55:25How do you define that?
- 55:26Right.
- 55:27Like other than stuff that we have to have just to make CPython run, nothing technically has
- 55:32to be in there.
- 55:33Right.
- 55:33Some have said, oh, we should have enough to at least bootstrap in pip.
- 55:37So if you can at least get pip or some installer in, you can then at least get yourself going
- 55:44and start installing dependencies.
- 55:46Yeah.
- 55:46But as you mentioned earlier, like it's nice to be able to also write that little automation
- 55:50script that helps maintain your system and not have to pull anything and have to create
- 55:53a virtual environment for every little script you ever write.
- 55:55But where's the line on that?
- 55:57Yeah.
- 55:57When I saw Python on Linux on just like a bare server, I can apt install Python three, but maybe
- 56:05that's not enough.
- 56:06Maybe I need to also install sometimes Python three dash VE and V or, you know, it's like
- 56:12broken up into bits, right?
- 56:14The Debian question is a very hot topic with Christian in the room.
- 56:17But I personally argue against Debian's policy on that and say VEMV would be considered a core
- 56:25part, right?
- 56:26I think it's core as well.
- 56:27And I wasn't so much picking on VEMV as just like there are environments where it comes
- 56:31with in pieces to some degree.
- 56:35Okay.
- 56:35I need to find the right words to not get into trouble again or to get into.
- 56:41Last time I burst a bit uncareful.
- 56:44Somebody accused me to wage a crusade against Debian.
- 56:49It's a philosophical disagreement.
- 56:50Yeah.
- 56:50So Debian has the policies to split packages in a smaller part so they can have a minimal
- 56:58installation.
- 56:59And they also don't like the way how we have like virtual AMP and short pip provided because
- 57:06it's actually duplicating code.
- 57:08We have like a zip file of binary wheels with compressed setup tools and pip, which contains
- 57:15vendor packages.
- 57:16Debian wants to use their distribution provided version of pip.
- 57:21So this is a conflict.
- 57:23Like we from the parts of the core developers, we think that the usability is more important
- 57:31here.
- 57:31So we want users to be able to use standard documentation instructions to use Python install
- 57:39extensions.
- 57:40This is more important for us.
- 57:41And this is a debate which had like multiple session between Debian engineers and the steering
- 57:49council.
- 57:49There was several heated discussions.
- 57:52And yeah, there are just different philosophical like interactions.
- 57:56Got it.
- 57:57So, I mean, the key point is, is there are a lot of questions about like, if you start to
- 58:03slice and dice the standard library into parts that you can install in groupings, for instance,
- 58:08is that truly part of the standard library?
- 58:10Or is that just an optional install on PyPI that the core dev team just happens to maintain,
- 58:14right?
- 58:14Because you can no longer rely on it.
- 58:16Yeah.
- 58:16I mean, if you went down that path, it would almost be a little bit like the anaconda story,
- 58:20right?
- 58:20Like here's the essence of what I got.
- 58:22But if I install what I normally install, I get more.
- 58:24There'd be like a minimum install and like a fuller install, which I think, I don't know
- 58:31how I feel about that.
- 58:32Well, if it gets me Python on the front end, I'd have to write JavaScript.
- 58:35I feel pretty good about it.
- 58:36I'm starting to think, I don't know.
- 58:38At least for some part, it makes kind of sense.
- 58:40So let's go back to Tickinter.
- 58:42So Tickinter depends on TK, Tickle TK, which depends on your graphical user interface.
- 58:49So X11.
- 58:50And if Python would always require Tickle TK, then you would have to install, I guess, like
- 58:57100 megabytes of libraries on every container image that has Python because the whole X11
- 59:03stack is very big.
- 59:05So you get your whole like graphical user interface libraries down to the actual graphical server
- 59:12that renders all the output.
- 59:15It makes sense that most distros split up to Tickinter and ship that optional package.
- 59:21But some distros go a bit further and split off packages that we consider to be core, core packages.
- 59:29So the inner core that should be always available and working.
- 59:34Like date, time and tuples and stuff like that.
- 59:37Yeah.
- 59:38Stuff that has no third party dependencies, basically.
- 59:40Yeah.
- 59:41Okay.
- 59:41Interesting.
- 59:42What about WebAssembly?
- 59:44You guys started actually building for WebAssembly, didn't you?
- 59:46Yes.
- 59:47Steve Dower pointed out that I don't remember the way to look it up.
- 59:51Super easy.
- 59:52But that there's sort of a proper core dev version of WebAssembly CPython now.
- 59:59It's REPL EASNHS.
- 1:00:02I just posted in the chat with the chip one day.
- 1:00:05Yeah.
- 1:00:06I mean, basically what happened was that the core dev sprints back in October,
- 1:00:10I started to look at seeing what it would take to compile CPython to WebAssembly.
- 1:00:14And I was lamenting in our build channel on our core dev discord server that, all right,
- 1:00:20the build setup was kind of old and creaky and I needed some help to figure out what to do.
- 1:00:27And then Christian working for Linux distribution knows how all this stuff works.
- 1:00:32And so he started to answer my questions and I did some initial cleanup.
- 1:00:36And then Christian really got into it and just totally really started to clean up our entire build process in terms of modules and such.
- 1:00:43Because there's a setup file in the repo where you can specify what modules you do or don't want built in to Python,
- 1:00:50both compiled it all into like a .so or DLL, compiled into statically into the binary or just completely left out.
- 1:00:58And Christian went through with some help with Erland, I think, actually, and cleaned up, you know,
- 1:01:04cleaned up a bunch of the whole structure so that we were using more of PKG config and just made it just a bit more modern.
- 1:01:11And while he was doing that, Christian would bring up stuff about like cross compilation,
- 1:01:15because that's another thing we do is you do a cross build, right?
- 1:01:18You can build, I mean, you can totally build on your Mac right now, Michael, 4x86 64 bit, even though you're running an M1.
- 1:01:25Oh, interesting.
- 1:01:26Right.
- 1:01:26So it's just flags.
- 1:01:27That's pretty wild.
- 1:01:28Yeah.
- 1:01:28But the way you get WebAssembly building that way is you just specify typically in script in the as a C compiler,
- 1:01:35which basically is clang and you just specify.
- 1:01:38And basically under the hood, it's more or less just specifying the right flags and everything to just make clang build for a different CPU target.
- 1:01:44And then Christian was starting to talk about like, oh, well, for cross builds, can we do this and that?
- 1:01:48And I kept saying, no, it won't work for WebAssembly because of this and won't work for WebAssembly because of that.
- 1:01:52And then Christian just looked into it and was like, oh, I'll use this as a motivator.
- 1:01:55And then Christian just ran with it.
- 1:01:56And Christian figured out all the problems and just got really into it.
- 1:01:59And it's been patching CPython's main over and over to the point that as of, I don't know, less than a month ago.
- 1:02:06So for two weeks now, we can run the entire test suite without any failures.
- 1:02:10Yeah.
- 1:02:11On WebAssembly.
- 1:02:11Yep.
- 1:02:12Cleanly.
- 1:02:12Inside Node.js.
- 1:02:15So you compile the, so these are a bit earlier.
- 1:02:20So when you build Python for WebAssembly, you have to not only tag WebAssembly, but also like the runtime.
- 1:02:28So these things are called triplets, so platform triplets.
- 1:02:32So you have like which CPU you target, which vendor and operating system and additional flags like GDBC.
- 1:02:42And default target is a WebM32 mScripten.
- 1:02:46So you do compile to WebAssembly with CPU instruction for 32 bits.
- 1:02:51And mScripten is the runtime platform.
- 1:02:54And mScripten can target multiple like different platforms.
- 1:02:59So this is mScripten for the browser, but you can also compile it that it uses Node.js backends and Node.js like file system access.
- 1:03:07So we can actually.
- 1:03:08Oh, you probably have more permissions and more capabilities.
- 1:03:11You can run threads, you can run sockets in a limited way.
- 1:03:14That's fantastic.
- 1:03:15And you can access the file system.
- 1:03:17And so it was a process of running the test suite, figuring out why it's crashing.
- 1:03:22So we had in the beginning like this completely like really crashing the runtime.
- 1:03:26Not just itself, but there's like a virtual kernel layer written in JavaScript that provides syscalls written in JavaScript to the WebAssembly model.
- 1:03:38It's a bit weird.
- 1:03:40So I was writing kernel-like code in JavaScript and the unit test code for that in C.
- 1:03:47So that's mScripten.
- 1:03:48Very cool.
- 1:03:49Yeah.
- 1:03:49So this REPL.EthanHS.me, which I'll put in the show notes, it's got my mScripten version of Python 3.11.
- 1:03:58And I can do fstring stuff and the thing that's right here in the browser.
- 1:04:03Hasn't been updated in a while.
- 1:04:04It's a bit old.
- 1:04:05Need to talk to Ethan.
- 1:04:06It's like six weeks old.
- 1:04:08That's old for the web, I guess.
- 1:04:09Well, I mean, we have a cron job running on Ethan's GitHub repo for this that runs nightly against Python.
- 1:04:17Cpython itself to make sure it continues to compile.
- 1:04:20We need to get a build bot going.
- 1:04:22I've got Microsoft's degree to fund one via Azure.
- 1:04:26And just we have to get it to, I haven't talked to Christian about it yet, but we'll figure out getting a build bot going.
- 1:04:32And then we're, I, part of one of Brett's crazy grand plans around Python WebAssembly is we're defining an official platform support for Cpython right now for in PEP 11.
- 1:04:44And my hope is we're going to get it so that Christian and I are listed as the maintainers of the WebAssembly support in Cpython.
- 1:04:52And we'll get it listed as an official tier two, what we're calling tier two supported platform, which basically means it's backed by two core devs, at least, and a build bot.
- 1:05:00But the idea of tier one is something the entire core team supports and is based on continuous integration.
- 1:05:06That's really exciting.
- 1:05:06Yeah, well, one of the actually nice things about WebAssembly is we could theoretically even get that to a tier one because WebAssembly is an abstracted assembly language, but it's not CPU dependent.
- 1:05:16So we could actually compile it on GitHub actions and test on that just as equally as Mac, Windows, or Linux and have it still be fully tested and work on CI.
- 1:05:25And I mean, you can take this idea really far, right?
- 1:05:28Like suddenly we could start having executable code examples in the documentation for Python because we've got a runtime now.
- 1:05:34We can literally make that work.
- 1:05:35Yeah, because yeah, you don't have to worry about security or compute costs because it's in your browser.
- 1:05:40You hack yourself and it's your compute.
- 1:05:43Right.
- 1:05:43Selfishly for me at work, when this works, I can start talking about shipping the node version of this with the Python extension for VS Code or as its own extension.
- 1:05:51So like you don't have Python installed?
- 1:05:52Install this other extension that's going to come with Python compiled to WebAssembly and you'll just have it.
- 1:05:57Or VS Code.dev browser version.
- 1:06:00We could potentially start shipping that with VS Code.dev and have the Python extension pull that in.
- 1:06:06And now you'll even have a runtime in the browser that ties into what I think is a nice editor.
- 1:06:11So there's a lot of possibilities here that we really want to get going with.
- 1:06:16And then when you start talking about WASI, right, then you start to get to edge compute.
- 1:06:20Christian just got that working like literally, I think, last week.
- 1:06:24I don't know where it stands yet.
- 1:06:25Working again.
- 1:06:26So the first version was like hacking and patching lots of things out.
- 1:06:31Oh, yeah.
- 1:06:32All the P thread work.
- 1:06:32Yeah.
- 1:06:33And the new version like a week ago was using a library from a company that's also working on Python support.
- 1:06:41They're like stubs and hacks.
- 1:06:43Single store labs, right?
- 1:06:44Yeah.
- 1:06:45Single store labs.
- 1:06:45Yeah.
- 1:06:46So WASI is even more restricted and limited compared to what was in MScript then.
- 1:06:51So you don't have any support like for threading, but you can't compile Python without at least the threading library headers.
- 1:06:58And they just had like book arounds for that too.
- 1:07:02So you can't spawn a spread.
- 1:07:03So if you try to start a thread who just failed, at least you have enough like of the CIPA available to compile Python for bits and bits.
- 1:07:12That's super exciting.
- 1:07:14Just to be clear on that, it's not a completely new effort.
- 1:07:17There's actually a productive version of Python for Rep Assembly in the browser called Pyodide.
- 1:07:23Yeah.
- 1:07:24And which is also now used by JupyterLite.
- 1:07:28So JupyterLite is Jupyter Notebooks on top of Pyodide.
- 1:07:33Yeah.
- 1:07:33JupyterLite's looking really interesting.
- 1:07:35Yeah.
- 1:07:35Yeah.
- 1:07:36And we actually met with the Pyodide team and more or less what we came to an agreement seems a little weird to phrase it this way.
- 1:07:44But basically an agreement where we will keep trying to make it so that the main branch in CPython can compile cleanly to WebAssembly.
- 1:07:51And that frees them to focus on JavaScript API to tie into it and on getting the scientific stack compiled over to WebAssembly because you have to do some hacky bits.
- 1:08:03Right.
- 1:08:03Because you got to compile like matplotlib and stuff because it's got C in it.
- 1:08:07So you got to compile it over there.
- 1:08:08Or I don't know.
- 1:08:08Some of those like NumPy definitely.
- 1:08:10Exactly.
- 1:08:10Because traditionally they had to do all the patches and all the work every Python release to get it working.
- 1:08:15And Christian and I are just in a better position to be able to keep that up and going.
- 1:08:18So we just said, let us handle that part.
- 1:08:20You don't have to worry about patching anymore.
- 1:08:22You can focus on the stuff that's more unique to WebAssembly and what you're able to be good at over there.
- 1:08:27So that's kind of where we're divvying up the workload here is we're just going to keep main working.
- 1:08:32And then they get to stop worrying about that once they start worrying about Python 3.11.
- 1:08:35So one of the first things that Ethan and I did just we took the patch that's that were developed by pilot developers and adjusted them and made them compatible.
- 1:08:45So we can actually merge them and have them in the upstream code.
- 1:08:48So a lot of their patches was just replacing things, but not in a way that would work if you would build the same source code for Standard Python.
- 1:08:56So they're just hacking around and getting things working, which is totally okay for their approach.
- 1:09:01But you couldn't just take their pull requests and their patches.
- 1:09:06So we had to make them in a way that this would work for Standard Python and WebAssembly Python.
- 1:09:12Yeah, fantastic.
- 1:09:13Well, two things spring to mind for me when I hear this.
- 1:09:16One is, does this mean I could write Electron apps and just have the slightest shim that then just lets me run like a backend in Python?
- 1:09:27You know, the sort of Node.js side of that in Python, which would be awesome.
- 1:09:32It should because Electron ships with Node.
- 1:09:35So as long as you have access to the Node runtime.
- 1:09:37Yeah, and you just get it on top of there.
- 1:09:38And then instead of writing all your sort of core logic of your app.
- 1:09:42You'll have to shim out back to JavaScript appropriately and have those APIs, which you might want Pyodide for potentially.
- 1:09:47But yeah, basically, yes, that door is open.
- 1:09:51Yeah, that's cool.
- 1:09:52I don't know Electron.js well enough to say, oh, I could totally just go do that.
- 1:09:56But I see that as a possibility that would be awesome.
- 1:09:58Yeah, so what we don't have probably won't add in the near future is any kind of bindings to JavaScript.
- 1:10:04So you can run like Python in your browser as like an isolated process or work web worker.
- 1:10:12But communication back and forth between like the outside world in the Node.js or browser world and Python, that's provided by Pyodide.
- 1:10:21But we don't have that.
- 1:10:22Right, right, right.
- 1:10:23So there's a very fun and great talk by Katie Bell.
- 1:10:27She also helped us to kickstart the port.
- 1:10:31She gave a talk at PyCon AU a couple months ago.
- 1:10:36It was like 10 minutes introduction.
- 1:10:39Two minutes compiling Python to WebAssembly and 28 minutes get STD in working.
- 1:10:47So just STD in, STD out working took like half an hour of her talk because that's surprisingly, surprisingly hard with WebAssembly.
- 1:10:56Yeah.
- 1:10:56We kind of made the decision that at least for now, we are not interested in trying to develop that FFI back and forth with JavaScript and having that opinionated API.
- 1:11:06And that's, as I said, kind of the agreement we've come up with Pyodide right now is they already have an API.
- 1:11:12We're going to lean on them to provide that for now at least and probably will continuously.
- 1:11:16I don't really necessarily see us changing this.
- 1:11:17And we'll just provide the lower level functionality of just the runtime.
- 1:11:21Right.
- 1:11:22Yeah.
- 1:11:22But if you all build that, it's a great foundation for other people to run with.
- 1:11:25Exactly.
- 1:11:26Yeah.
- 1:11:26And then the other one, but first of all, is this the talk that you're talking about?
- 1:11:31Yes.
- 1:11:31That's the one.
- 1:11:32That's Katie.
- 1:11:32Okay.
- 1:11:33I'll put, yeah, that's Katie's talk.
- 1:11:34Great.
- 1:11:35I'll put that in the show notes.
- 1:11:36The other one is, is that the right URL?
- 1:11:39Danger.
- 1:11:40Yes.
- 1:11:41Is this a Blazor project from the C# .NET team?
- 1:11:44Yep.
- 1:11:45This is .NET, the .NET runtime as a front end framework running in the browser, which is pretty awesome.
- 1:11:52And it seems like there's just so many parallels that could be brought to the Python world that like you don't have to do Angular.
- 1:12:00You can just do PyBlazor.
- 1:12:02I mean, that's not the name, but you know what I'm saying?
- 1:12:04Like it's closer to possible.
- 1:12:07And I think this is actually something that would be really neat.
- 1:12:10Yes.
- 1:12:10The trick here, and I think Blazor does the same thing right now as well, is from my understanding, Blazor has a WebAssembly compiled .NET runtime that gets loaded into the client.
- 1:12:21Yeah.
- 1:12:21And then that's how it does the execution.
- 1:12:23If I understand how Blazor works correctly.
- 1:12:25And so you could do a theoretical same thing with Python.
- 1:12:29Now, obviously there is size issues to consider here, right?
- 1:12:33Like this is not something you necessarily on a really slow connection somewhere would want to actually pull down.
- 1:12:38Because I think the one time, is it 5 megs now, Christian?
- 1:12:41Or is it 3?
- 1:12:42So the uncompressed Wasm is like 6 megabytes.
- 1:12:46It gets down to like 4.
- 1:12:48And then you have the big bundle of the data file that contains the Python compiled files.
- 1:12:54It's another 5 or 6 MB.
- 1:12:56It's big.
- 1:12:58But actually it's smaller.
- 1:12:59Okay.
- 1:12:593 MB.
- 1:13:00Can you scroll up a bit?
- 1:13:03The .data file.
- 1:13:04It's the standard library.
- 1:13:05Did I?
- 1:13:07Did I care a lot?
- 1:13:08Yeah.
- 1:13:08Yeah.
- 1:13:08Group tab.
- 1:13:08Python data and Python web.
- 1:13:10Yeah.
- 1:13:10So it's 3 megs for the standard library, 212 kilobytes for the wrapper.
- 1:13:16And you've already cached the Wasm.
- 1:13:18So it's probably 6 MB.
- 1:13:20But so we can probably make it a bit smaller.
- 1:13:22So currently that comes like with elementary and decimal model and all the hashing libraries
- 1:13:30compiled in.
- 1:13:31So we currently create one gigantic binary.
- 1:13:34There are ways to have side models like shared libraries with Wasm.
- 1:13:39It's a bit more complicated to get that right.
- 1:13:41And also it increases the size of the main binary, the main model a bit.
- 1:13:47I didn't go into that yet.
- 1:13:49It's something I look into maybe in the future.
- 1:13:53But as you were talking about earlier, Michael, about like slicing and dicing the standard library,
- 1:13:57if you're shipping the runtime, you can also shrink that down by just dropping all the parts
- 1:14:01of the standard library you don't need.
- 1:14:02Right?
- 1:14:03So if you run like module finder or some other script that's going to go through the standard
- 1:14:06library to figure out what you do and don't need, you could actually just compile your
- 1:14:10own version of Python, CPython for WebAssembly only with the standard library that you want.
- 1:14:14Interesting.
- 1:14:15You get it really small, right?
- 1:14:16So which of these three, Python.js, Python data, and Python.wasm is the, has cEval.c in it?
- 1:14:22The Wasm file.
- 1:14:23The Wasm one.
- 1:14:24Okay.
- 1:14:24So that's two megs and then plus the standard library bits, right?
- 1:14:27Yeah.
- 1:14:27So it's a little over five megs in total for everything, which isn't huge.
- 1:14:31Like an internet project that you might need?
- 1:14:36Totally fine for Electron apps, as you said.
- 1:14:37It would be totally fine for a single page app.
- 1:14:40It'd be fine for Gmail.
- 1:14:41Yeah.
- 1:14:42It's something you're going to leave up and running constantly and not change.
- 1:14:44Yeah.
- 1:14:44It's within the realm of probably what Facebook's already downloading onto your machine right
- 1:14:49now anyway.
- 1:14:50Yeah.
- 1:14:50Yeah.
- 1:14:50Just run an ad blocker and it'll do less.
- 1:14:52All right.
- 1:14:54I think we are well over time, but you guys, it's, it's always great to talk to you.
- 1:14:59Yeah.
- 1:15:00Good work.
- 1:15:00I dream of Pi Blazer happening.
- 1:15:03And I also saw a nice, interesting comment that triggered a thought.
- 1:15:07It's progressive web apps are not really a thing we can do in Python very well because
- 1:15:11for a progressive web app, it's really got to be all offline in some meaningful way.
- 1:15:16But, but if you could bring Python.wasm down, maybe use local DB, there might be some really
- 1:15:22interesting ways that progressive web apps become way more interesting to us as Python
- 1:15:27web developers.
- 1:15:28Okay.
- 1:15:28Now I have to confess, I have no clue what the progressive web app is.
- 1:15:31I don't know anything about lecture web development.
- 1:15:34I got Python working on the browser, but I don't know how browsers work.
- 1:15:38Awesome.
- 1:15:38I will give one last tease though, Michael.
- 1:15:40I had two motivations for getting into this whole WebAssembly thing.
- 1:15:43Browser, mobile.
- 1:15:45Because every phone has a WebAssembly runtime.
- 1:15:49Thanks to all of them shipping out the browser.
- 1:15:50Yeah.
- 1:15:51Yeah.
- 1:15:51Yeah.
- 1:15:51Yeah.
- 1:15:51Yeah.
- 1:15:52Okay.
- 1:15:52Now I'm also very interested.
- 1:15:54I would rather have a mobile option than a offline than a front end web option.
- 1:15:59So there we have it.
- 1:16:00Although these may well go together, honestly.
- 1:16:02Yeah.
- 1:16:03All right.
- 1:16:03Well, thank you both for your hard work on this PEP.
- 1:16:06And then it's super interesting to see how it kind of ties back into this, like more focused
- 1:16:11runtime than more places.
- 1:16:12Yeah.
- 1:16:13All right.
- 1:16:13Before you get out of here really quick, last question I'm going to ask you.
- 1:16:16Just keep to one since I kind of know the answers for the other.
- 1:16:19I'm pretty sure.
- 1:16:19Anyway, notable PyPI package you want to give a shout out to before we dip.
- 1:16:23Oh, man.
- 1:16:24There's one that runs WebAssembly, like something you can have, like Python that'll basically
- 1:16:30interoperate with any WebAssembly one.
- 1:16:32I can't remember quite what that was called, though.
- 1:16:34I think WasmTime has one.
- 1:16:36Yeah.
- 1:16:36Yeah.
- 1:16:37There's a couple.
- 1:16:37There's a couple of people who've posted stuff to PyPI that let you load a WebAssembly
- 1:16:41code and actually run them.
- 1:16:42And I think WasmTime might be one of them.
- 1:16:45WasmTime is a WebAssembly runtime run by the Bycode Alliance.
- 1:16:49And it's usually the most cutting edge of all of them.
- 1:16:52So if anyone wants to play with this and looking for a runtime, WasmTime is probably a good one.
- 1:16:56Python embedding of WasmTime.
- 1:16:58Python plugin.
- 1:16:58Perfect.
- 1:16:58And you can ask Christian what his favorite editor is.
- 1:17:01Yeah.
- 1:17:01The right one.
- 1:17:02The good one.
- 1:17:03I use a couple.
- 1:17:04So I use PyCharm.
- 1:17:06I use VS Code.
- 1:17:07I use Vim.
- 1:17:07So depending on my needs.
- 1:17:09You use them all?
- 1:17:09Yeah.
- 1:17:10You've got a whole survey, the whole spectrum.
- 1:17:12Yeah.
- 1:17:12That's awesome.
- 1:17:12Cool.
- 1:17:13And then a notable package you want to give a quick shout out to before we get out here?
- 1:17:17It's very late.
- 1:17:17I don't know.
- 1:17:18The Python standard library.
- 1:17:19Yeah.
- 1:17:20The lack of certain things in the standard library.
- 1:17:23It's like an anti-module.
- 1:17:25The fact that you guys are taking it out.
- 1:17:27Oh, the anti-gravity model is also fun.
- 1:17:28Oh, yeah.
- 1:17:29Sure.
- 1:17:29All right.
- 1:17:29Anti-gravity.
- 1:17:30PIP install anti-gravity.
- 1:17:31Now.
- 1:17:32Maybe it's in the standard library.
- 1:17:33I'm going to give you all up here on the WebAssembly one.
- 1:17:37That would not work.
- 1:17:38I removed that.
- 1:17:40Oh.
- 1:17:40Because that requires the browser model, which requires the sub-process.
- 1:17:44I'm in a browser.
- 1:17:44So you can't run any processes.
- 1:17:46So it's.
- 1:17:47Yeah.
- 1:17:48I know.
- 1:17:48I'm just kidding.
- 1:17:48I tried.
- 1:17:50For people to see.
- 1:17:50I tried to import anti-gravity inside the WASM REPL.
- 1:17:53It didn't do it.
- 1:17:54Not yet.
- 1:17:55Not yet.
- 1:17:55I wonder if I can do it.
- 1:17:56Yeah.
- 1:17:56I don't know.
- 1:17:57It may be.
- 1:17:57Maybe it can.
- 1:17:58It should.
- 1:17:58They all should.
- 1:17:59All right, you guys.
- 1:18:00Thank you so much for being here.
- 1:18:01I'm excited to see this progressing.
- 1:18:03I see it leading to good places.
- 1:18:05Thanks for having us, Michael.
- 1:18:05Bye.
- 1:18:06Bye-bye.
- 1:18:06See ya.
- 1:18:08This has been another episode of Talk Python To Me.
- 1:18:10Thank you to our sponsors.
- 1:18:12Be sure to check out what they're offering.
- 1:18:14It really helps support the show.
- 1:18:15Starting a business is hard.
- 1:18:17Microsoft for Startups, Founders Hub, provides all founders at any stage with free resources
- 1:18:23and connections to solve startup challenges.
- 1:18:26Apply for free today at talkpython.fm/founders hub.
- 1:18:31Fusion auth is your authentication and authorization platform built for devs.
- 1:18:36If you have a side project that needs custom login and registration, multi-factor authentication, social logins, or user management,
- 1:18:43then download Fusion Auth Community Edition for free.
- 1:18:47Check them out at talkpython.fm/fusion auth.
- 1:18:51Want to level up your Python?
- 1:18:53We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:18:57Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:19:02And best of all, there's not a subscription in sight.
- 1:19:05Check it out for yourself at training.talkpython.fm.
- 1:19:08Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
- 1:19:12We should be right at the top.
- 1:19:14You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:19:19and the direct RSS feed at /rss on talkpython.fm.
- 1:19:23We're live streaming most of our recordings these days.
- 1:19:26If you want to be part of the show and have your comments featured on the air,
- 1:19:30be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:19:34This is your host, Michael Kennedy.
- 1:19:36Thanks so much for listening.
- 1:19:37I really appreciate it.
- 1:19:38Now get out there and write some Python code.
- 1:19:40I'll see you next time.
- 1:20:01Thank you.