Python Bytes - #340 Snorkel not included
Episode Date: June 13, 2023Topics covered in this episode: PythonGUIS JupyterLab 4.0 is Here Proposing a struct syntax for Python Python 3.13 Removes 20 Stdlib Modules Extras Joke See the full show notes for this episode ...on the website at pythonbytes.fm/340
Transcript
Discussion (0)
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly
to your earbuds. This is episode 340, recorded June 13th, 2023. I'm Michael Kennedy.
And I'm Brian Ocken.
And this episode is brought to you by InfluxDB from InfluxData. Awesome real-time DB,
so time series database. So we're excited to tell you about that later. If you want to connect with
us, you can find us all on fostodon.org, at mkennedy, at Brian Ocken, and at Python Bytes. Join us for
the live show at pythonbytes.fm slash live. If you want to be part of the live stream and be in
the audience, all the older video versions are there as well. And Brian, before we jump into
your first topic, I've got some ideas, a request from the audience. Okay. Okay.
So we are going to do an ask me anything episode. And really that should be ask us anything, but the
is not typically how people announce it. It's the AMA. So following convention standard acronyms there,
ask us anything.
I put together a Google form.
It is super short.
It says, what is your name?
What is your question?
And if you want, there's a few other fields for like second question, you know,
and things like that, but they're optional.
So if you're listening and you've ever wondered,
like, I wonder if Brian has a thought on an opinion on this.
Does he have an opinion on PyTest plugins?
I don't know.
Maybe.
Does Michael have a thought on PyCast or whatever?
You know, please take the time and put that in there.
And, you know, we'll give you credit on the show as well.
If you don't want to have your name in there, just put anonymous or something.
So everyone check that out.
It is at, I created a short URL for it. Let's see. Pythonbytes.fm
slash AMA 2023. So people can just go over there and check it out. So that's going to be a lot of
fun, Brian. I don't know when we're scheduling it. I'm probably pretty much when we get enough
questions. And that link will be in the show notes, right? Absolutely. Let's talk GUIs. We
haven't been on a GUI rant for a while yeah i don't know
if we've ever we've ever talked about guis i think maybe you have perhaps it's been a while um yes
so uh i i ran across this website called python guis and it's like a whole website dedicated to
python guis and it's it's from a fellow named Martin Fitzpatrick.
He does consulting and some other stuff.
And this is pretty kind of cool.
This is fairly comprehensive.
He has tutorials and references to books and everything like that.
But it's kind of a neat walkthrough, just the website itself.
Like, for instance, where do I begin? His recommendation is doing PyQt 6 to start with,
if you don't have a preference. However, there's, so let's like walk through a couple. So if you
just kind of walk through and he talks about what you should look about, learn what tutorials are
available. And then it says continue. So if you continue on with the PI Qt six, you just sort
of walk through a tutorial around how to get Qt designer up and everything. But there's, there's a
lot more than just Qt here. He's got, he's got tutorials on PI Qt six, Qt5, PySide, Tkender. There's even a tutorial,
most recent tutorial I saw
was getting started with Kivy
for GUI development.
And it's a pretty lengthy
getting started with Kivy thing.
And it covers Mac, Windows, Linux.
So it's pretty comprehensive.
It's kind of nice.
Yeah, this looks really nice.
I think choosing,
I always feel like
there's this paradox of choice and when i'm thinking about python guis and there's like
well there's no real clear answer and they're all kind of got their own oddities into them or their
own restrictions uh but this is really cool to see them put all side by side and different tutorials
helping you get started yeah um and um yeah i kind of like it i think a lot of people start with like tk
enter it's not tk and there is a pipe you know whatever tinker i forget what they call it with
python um but it's a it's not i don't think that's a great place to start if you want something to
look really nice if you're if you're um uh gonna support it i. I think I kind of agree with them. Maybe starting with QT, or Qt, sorry.
I grew up using QT without knowing how to pronounce it.
People do pronounce it cute, but yeah, anyway.
So if you want to learn about Python GUIs,
maybe check out pythongoos.com.
So what do you got for us?
Oh, you're muted.
Before we move on, Brian,
I do want to also just sort of second that,
that I think, Qt, those look like native applications that belong on your platform, right?
When you're not like, oh, what?
Clearly some funky cross-platform API
is what we're working with here right now.
This stuff looks pretty solid, right?
Yeah. But it is TKinter. Why do we call it TKinter? Or TKinter? I don't know. Because it's not TK.
Oh, because it's from the TK toolkit. Got it. Ah, makes sense. Got it. All right. I have some
bleed for all the data scientists out there. How about that? Okay. JupyterLab, which is the
more capable, the more IDE
like experience for Jupyter
notebooks, 4.0 is here and it
looks like a pretty mega release.
So they say, they
being Jason Weil, say
the next major release of
the full feature development environment
for Jupyter is here.
It is available for install
right off pi pi in conda forge so if you have it all you got to do is pip install dash dash upgrade
jupyter lab or conda install dash c conda forge jupyter lab and it'll just upgrade in place for
you so that's pretty excellent that's low maintenance low effort upgrade i suspect
there's a lot of stuff happening when you run those commands. One of the big deals is JupyterLab is now faster. There's a bunch of different ways in
which they made that happen, where that's happening. Notebook windowing is one of them,
where for a long notebook, instead of trying to process and load the whole thing, it'll just show
the web browser viewport in terms of rendering, which will make some of the rendering thing. It'll just show the web browser viewport in terms of rendering, which will make
some of the rendering faster. Got CSS rule optimizations, CodeMirror. CodeMirror is the
editor, text editor of the cell. So CodeMirror 6 is out and MathJax 2 as well. So if you're working
with large notebooks, it should be much more efficient than JupyterLab 3, they say.
Awesome.
That's encouraging, right?
Yeah.
Yeah.
Yeah.
So cool.
Let's see what else.
There's additional performance improvements,
but you have to turn these on.
So you can get faster tab switching
on Chromium-based browsers,
which is unfortunately almost all of them,
but that's the world we live in.
So you can do do but you got to
go settings and jupyter lab shell switch hidden mode to content visibility and for even more
better performance with long notebooks you gotta go settings notebooks switch on a windy windowing
mode to full okay so those are all options i told you there's a new CodeMirror. That's the text editor for cells
and file editors. And it's upgraded to CodeMirror 6, which has a bunch of accessibility and
performance improvements. So people can check that out. Let's change there. Also, JupyterLab,
I'm not sure I knew this, comes with a real-time collaboration, aka Google Docs style of
collaboration. Okay. I didn't know that they do that.
I did not either.
I knew there were some notebook platforms that did,
but I didn't realize JupyterLab did.
So they moved this RTC, real-time collaboration,
to a separate package, Jupyter Collaboration,
and that's available in its own sort of thing. Includes support for multiple cursors and selections,
new shared types, and yeah.
There's also a new extension manager
for JupyterLab extensions,
improved document search, UI enhancements,
like more hotkeys and other styles,
accessibility improvements, dev tool updates,
you know, like how they build JupyterLab.
So TypeScript v5 and React v18.
Most people won't care about that,
but if you work on or try to customize the JupyterLab itself,
then you create an extension or something, you probably care.
And finally, finally, finally, more than 100 bugs have been addressed and resolved,
making it more stable and faster.
So that sounds like a pretty big deal, doesn't it?
Yeah.
Yes.
I think addressed means fixed and not just said hello to.
Exactly. Hello, bug. How shall I address you? You shall call me a CVE remote code executioner. Oh, hey, nice to meet you. Probably not like that, right?
Yeah. So that's cool. Yeah. getting some thumbs up from the audience as well. Now, before we move on, I want to just talk about
our sponsor real quick, InfluxDB. So thanks to Influx for supporting the show. So this episode
of Python Bytes is brought to you by Influx Data, the makers of InfluxDB. InfluxDB is the database
purpose built for handling time series data at a massive scale for real-time
analytics. And developers can ingest, store, and analyze all types of time series data, metrics,
events, traces in a single platform. So how would boundless cardinality and lightning-fast SQL
queries impact the way you develop real-time applications? Check out Influx. Influx DB
processes large time series data sets and provides low latency SQL queries, making it the go-to choice for developers building real-time apps and seeking crucial insights.
For developer efficiency, Influx DB helps you create IoT analytics and cloud applications using timestamp data rapidly and at scale.
It's designed to ingest billions of data points in real time with unlimited cardinality.
InfluxDB streamlines building wants
and deploying across the various platforms
and environments from the edge,
on-premises, and to the cloud.
So try them for free at pythonbytes.fm
slash influxdb.
The link is in your podcast player show notes.
Thank you to InfluxData for supporting the show.
Yeah, thank you. Mm-hmm. I would like to influx data for supporting the show yeah thank you i would like
to talk about data but not databases but uh data types so um this is kind of early to talk about
but hey uh brett cannon can write about it on his blog i think it's fair game to talk about. So Brett Cannon had a proposal for a new kind of
data type in Python called a struct. Structs are new things. We've lived with them in C for a long
time. And other languages have other types. I want to take a slight detour before I talk about the struct proposal from Brett.
And by proposal, I don't mean it's a PEP.
I don't think it's a PEP yet.
I think it's just an idea that he had.
But I think it's a cool idea.
But one of the things he talked about was algebraic data types.
And I got to admit, I haven't run across that term, algebraic data types types before like a week ago or so and then
I've read two articles referring to it.
I'm used to ADTs being abstract data types, which are data, you know, user defined data
types in I don't know what the abstract means.
But anyway, algebraic ones are things that you can compose.
They're like abstract data types, but they're things the things that you can compose. They're like abstract data types,
but they're the things that you can compose,
like a list is a nil, plus I don't know what that means.
But anyway, or a tree is either composed of empty or leaf
or a node or something.
I'm still not quite sure how this makes anything to do with it,
side diversion. Anyway, so what does this look like? I'm still not quite sure how this makes anything to do with it.
Side diversion anyway.
So So what what this is look like, and it's kind of a neat idea.
So jumping down to example, with a struct, you could just say a point is a struct that
takes x and y and they're both integers, say, and they have to be named or either positional or
named but they cannot be unnamed only i don't know why but uh and then it'd be kind of like
named classes or named tuples um to access it so you just access the stuff so you you just declare
this a point it takes x and y and then you can get at it with like say p.x or p.y and that's it really
um so what is what is this why would we need this and i think it'd be really pretty cool to have
something that simple um and these structs would be uh they'd not allow inheritance they would
have no methods currently um no methods no inheritance, and they're not mutable. So you
can't change the thing in it. Why is that important? Well, you then you can, you can use
these things for keys and dictionaries and things like that. And I just think this would be kind of
cool because I use, I still with data types, even with data types and, and all the other goodies
and adders and other goodies we have within Python,
I still use name tuple a lot,
and I would totally use this for a lot of stuff and make it, especially if it was super fast.
So that's the idea.
Got any ideas?
It looks interesting.
And the defining syntax is kind of a one-liner,
a little bit, as you pointed out, like a named tuple,
but it actually, it defines class-like thing with these optim as you pointed out, like a named tuple, but it actually,
it defines class-like thing with these optimizations,
for example, dunder slots,
and kind of a data classes type thing with dunder equal and dunder hash.
So for people listening, you just say,
all in one line, struct, point, a capital P for the type,
parenthesis, X, comma, Y, that's the whole thing, right?
Tony out in the audience does wonder if it actually requires type annotations or if those are optional.
I would guess they're optional, but I like them, so I don't know.
No, Brett says in his article he would propose that they would be optional if you just had two elements in something.
I mean, it's...
Yeah, it seems consistent with Python that it would be optional right yeah and tony also says oh boy i just started writing some rust code at work so
i'm interested in this for python yeah and that like the example that brett gave of this this
point he then showed the example of what what would what under the hood that would give you that you don't have to write and this example of like being able to to convert it to a dictionary and replace parameters and
using slots and i mean it there's a lot of code here that you don't need to write and yes we do
kind of have uh data type data classes that sort of do this, but data classes are not optimized for having lots and lots of them.
So this would be like an optimization to have just like huge,
huge data structure full of these things and have it still be fast.
So I think it'd be cool.
And having it be part of the language,
maybe they could do optimizations around it for Python 3.14 or whatever,
you know, the faster CPython story.
Like, for example, if you know it's immutable,
could you make it allocate on just the stack
and not actually go to the heap or things like this?
It'd be interesting.
Maybe that's a bridge too far.
I'm also interested in how this maps to hardware
because dealing with registers and hardware interfaces,
using C, we often have structs that we overlay
over the top of shared memory systems.
And this might be a great use for something like that.
A few more thoughts out there.
Grant says,
this is in line with what Mojo expresses.
We recently spoke about them.
Would love, love to have a struct in Python.
And Blaze points out,
waiting for Hennick's opinion.
Maybe something like this will get into adders.
Yeah, we'll see.
Yeah.
So, you know, sometimes, Brian,
it's about putting new stuff,
new things into Python.
Sometimes, however, it's about ripping it stuff, new things into Python. Sometimes, however, it's about ripping it out.
Yes.
So my next item is the realization of PEP594.
So PEP594, for those of you who don't know, I interviewed Shin Himes and Brett Cannon.
Speaking of Brett Cannon, I think it's a back-to-back mention here
about removing Python's dead batteries and this PEP 594. And the idea is there's stuff in Python
that makes no sense to be in Python. It made sense when we had a world without the internet,
when there was no concept of pip install, and you really needed to kind of have Python come with a lot of its capabilities.
But now you go over to PyPI.org. What is the current number? We have 460,000 packages.
They're revolving like a larger definition of what Python is really, really fast, right?
Yeah.
Joe, for example, do you think it would make sense potentially to have an implementation
of an async chat client built into the standard library of Python?
Maybe no.
I didn't know we had that.
Well, apparently we did until 3.12.
So that's not actually out yet, but it's gone.
Or like an SMTP daemon built into Python, right?
Who should be running their own mail
client as part of Python itself? You know, not even a separate package, but more importantly,
as was discussed over on the podcast, like this is overhead for all the core devs.
Do we want them working on things like the struct or do we want them still managing CIFC. Yeah. I like audio parsing for expired.
Nobody uses any more audio formats or CGI or telnet libraries or,
you know,
like chat clients.
So,
yeah,
this basically is the announcement by Victor Stenner.
I believe saying we just removed 19 modules from Python
3.13 standard library. These are the ones that have already been deprecated in 3.11 by PEP594.
So yeah, it's a big long list of them. Like I said, like you pointed out some CGI image header,
you know, mail stuff. Also talks a little bit about the 312 and 311 ones which are
gone and then finally it does say like if this affects you here's what you can do do nothing
just stay on 311 it says in my opinion it is a dangerous long-term choice however you can do
nothing um you could create a group of volunteers to give life to this module, right? The module is open source in the sense that Python's standard library is open source.
So you go in there, you copy the files out, you make a PyPI package for it, and you find people who want to keep it going.
Or you vendor it.
You could copy the removed module just into your code itself, right?
Often it's just a dot P Y files.
You just vendor it in.
If you have to honestly,
that,
that kind of seems like a pretty decent idea.
If you're like going low key and you don't want to take on an open
source project to remain,
to maintain CGI,
you just like,
I just need this to run.
So you can copy that over.
And then there's a whole discussion on stuff around this,
right?
If you want.
So anyway,
20 standard lib modules, they're out.
Yeah, I think it's a good thing.
Just like, yeah, changing your batteries,
kind of like your smoke detectors.
Yeah, exactly.
One more audience comment on this before we move on.
Grant says, happy for the Python core devs to kill all these modules.
Nothing makes senior engineers happier
than calling bodies of code that aren't worth their weight.
I totally agree.
I would be happy, honestly,
to see even a thinner, smaller Python standard library
and then have more of these as pip installed.
But then when you install Python,
it could kind of come pre-installed
with 20 or 30 packages
that if you want to upgrade them separately,
I don't know.
So for things like if I want to run this on MicroPython,
I wouldn't run it on WebAssembly under PyScript.
Like those situations are like you don't,
the whole huge standard library is a problem.
So I don't know.
I feel like there's interesting stuff happening here,
but this is a good start.
Yeah, definitely.
I think it is.
It is.
Is that all of our items?
I believe it is, isn't it?
It is.
And so some of these decisions are made by some of the core Python people, maybe on the Python board, have something to do with some of this.
Perhaps. So one of our extras, I'd like to mention that the PSF announced that you need if you are if you care about elections, you kind of need to affirm your PSF membership voting status before the 15th.
So the cutoff is only a couple of days from now.
So and I'm glad somebody that somebody mentioned this.
I can't remember where I saw it because it sort of went in my email inbox and I forgot to look.
So I just affirmed my voting status this morning.
Excellent.
Well, I definitely affirmed mine a couple days ago.
So it's all good.
But yeah, thanks for pointing it out here.
This is great.
Okay.
Do you have any extras?
I do.
I just released a video collab with Julian Square and Bob Belderbos from the PyBytes guys.
About five tips for budding Python developers,
five career tips for budding Python developers as a 25-minute YouTube video.
So people can check that out.
That link is in your show notes if that sounds interesting to you.
It looks like julian and iron
man are looking at the same thing julian has an iron man um painting in the background behind
him and they've got the same basic expression pretty awesome so people can check that out
also uh pi con us 2023 remember that brian it was a while ago yeah all the videos are in the videos are out
yay yay so there are some that are unavailable that are hidden i'm wondering if that's intentional
or if that's like they were uploaded hidden and they're just forgot to be set to public so
uh whoever's in charge of this might want to look why there's hidden videos published to this
playlist but uh i don't know how many there are there's 142 videos possibly some others
as well that are hidden on this playlist so people can check it out this is basically all of pycon
including the tutorials if you want to go and kind of be part of that side of python which is
excellent nice so some are white and some are kind of this gray color. Do you know what the difference is? No. No idea. I think it's just
the font, just the opening slide they use for their presentation. I don't know if there's
more to read into it than that. I would like to maybe, I don't know if the people who are
organizing next year's PyCon are listening. I would like to propose just some kind of
suggestion that might make this a little
easier for them, because this seems to be like a huge challenge from what I can tell, right?
PyCon was in April. It's the middle of June, and now the videos have come out. So somebody has
spent, you know, like a month and a half working on these videos, and the community has been waiting
a month and a half to get them, right? Brian, how quickly is our video for Python bytes out when we're done with it?
Like right when it's right when we're done. I mean, like literally, you could seek around in
it before as you like part of the stream, right? We're just live streaming this using something
like StreamYard. And I know that there's a pay to attend virtually. So maybe you don't want to have
a public stream that people can use.
Maybe there's, but there's kind of just live streaming
it to YouTube, even if that's an unlisted URL
that you then, when the conference is over,
flip to public.
Cause I know that kind of you went to them,
you don't necessarily don't want that to be going,
have that whole live experience.
If you're not part of the, like I signed up
for the virtual pass, which is great, it's fine.
But I think we could
get these videos in a lot quicker and help with people a lot if you did something like you just
like kind of live streamed it um i know people might worry about the connectivity and it cutting
out the quality but with like for example stream yard it records local video it's like maximum
quality right so there's if you if they had a stream deck where they could switch to the views
and they had this going and recording locally like these videos would be out as quick as you could
click from unlisted to public on youtube i do want to i guess disagree with you on that um okay um
so pike so pike cascades uh for one did the uh the i don't know if it was available right away
but it was available soon after the entire day recordings.
So you had the day recordings.
So if you if you wanted to find yours or something or find somebody's, you could kind of scroll through and find it.
It was a little it was a little it was just sort of going.
There was there wasn't any editing.
So there was it was kind of hard to deal with.
I don't know how many people really watch those.
But the the PyCon US videos videos i didn't realize this at first
somebody corrected me they were available to people that either attended live or attended
uh virtually and but didn't get to go to all this all the videos you're um the online experience
included being able to go in and watch videos, the other videos that you missed.
So those were available right away.
Um, I didn't know about it, so maybe advertising it more.
And also it was a little hard to get to, uh, I gotta say it wasn't, it wasn't easy.
I, I kind of would like to have, um, like the schedule that you go into if you're logged
in, uh, and you can see the schedule.
Um, why not have that be able to
just link to the video that you missed or something like that i don't know there's there's better ways
to make it a little bit easier it was a little hard to deal with but it was available um and i
also think like for instance um uh going back to pike cascades i did a talk the the the recording
the the the full day one had like glitches and had
me up there at the beginning trying to get the audio ready and you know there's this getting
started stuff whereas having somebody be able to clean that up a bit uh would be good it's just
i do also but i don't think that this is a long time from from when pikecon really was to now
that's that's what month.
That's too long. So last year, 2022 was three, three months, I believe.
I mean, it's a long time.
And I know it's a lot of work, but maybe, maybe we could do something either either having rough cut ones out there
initially, or maybe have some of us volunteer. I mean,
I think we could have some volunteers to help clean them,
clean them clean
them up for like good enough for now or sort of things i don't know something yeah yeah i agree
we should have made this a whole item i suppose if we're talking about the final thought is like
with stream yard i don't know about the other ones you can literally go in before you hit publish you
can just say trim this and go to click click okay put it on youtube now and then like that would be
yeah you know not very much i agree that you don't want all the setup
in that chunk. You want to be like, welcome, I'm
Brian, I'm talking about extensions,
etc. Straight away.
And I can't get the slides to work.
I know, you want to skip all that crap.
Okay, but
good news, the videos are out, and people
can check them out. Okay, next.
Next, next, next.
A couple version updates for python python 3114
310 12 39 17 38 17 37 17 and importantly 312 beta 2 are all out and you might be interested to know
that both the 311 and 310 i I suppose the others include security fixes. So
nice to meet you, Mr. CVE. For example, some problems that were solved in OpenSSL are now
included. There's one, two, three, four, five, six, seven, eight, maybe seven or eight CVEs that
were addressed on OpenSSL and some URL parsing and UUDecode
and things that might look like you want to get fixed.
So check that out and upgrade if you can.
Python Bytes is already running 3.11.4.
So hooray for that, Python Bytes.fm.
I had a friend say they were working on upgrading to 3.10
and I'm like, I don't even remember 3.10.
I've been like on a 3.11 for so long.
Yeah, absolutely.
Absolutely.
All right.
And then final, final call.
Just remember the Python Bytes AMA form.
Please get out there and submit that one more time.
Links in the show notes.
Yes.
Yes.
Right at the top.
Yes.
Ready for a joke?
I am.
This one comes to us from Ken Van Wick.
And it's a follow on from the Apple.com.
Where's their, there it is, their Vision Pro.
Right?
Yeah.
Now this thing is super expensive.
It looks really amazing.
I just, I don't, I've not got faith that it's going to take off.
But the ability to say like, I want to sit sit i want to stand on the sideline right at the goal
line at the super bowl and be able to look around and watch that as if i was there like that would
be epic is that worth a three thousand five hundred dollar device now brian it's expensive but did you
know just like the um the mac pro which was also recently announced the mac pro super expensive
seven thousand dollars minimum but it doesn't come with the wheels. If you buy it
with the wheels, the wheels are $400
separate, right? You have to get the wheel for
your case. So this is kind of like that.
Here's your, this comes to you
from Kim Benwick, and he says, actually, this is
Paul Mason's thing.
So you got
your $3,499
Vision Pro,
and it comes with the Apple-branded $899 snorkel.
What do you think of that?
I think that's cool.
I love it.
No, I think, yeah.
If this would actually work underwater so that you could go back out in your swimming pool,
and you could look like you're actually on a coral reef that'd be cool
that would be awesome imagine you were in here playing something like subnautica one of those
types of games uh which is just amazing like a game where you're underwater and exploring
yeah but in vr with your with your apple snorkel on think how real that would be
yeah but actually underwater like but they're probably yes
exactly yeah that'd be cool oh boy well that's what i got for you all 899 apple snorkel not
included yeah cool all right nice well yeah very fun thank you everyone for the active chat in the
live stream thank you for everyone who listened no matter how you listen and brian thanks as always
thank you bye