Python Bytes - #255 Closember eve, the cure for Hacktoberfest?
Episode Date: October 20, 2021Topics covered in this episode: Wrapping C++ with Cython tbump : bump software releases Closember by Matthias Bussonnier scikit learn goes 1.0 Using devpi as an offline PyPI cache PyPi command line... Extras Joke See the full show notes for this episode on the website at pythonbytes.fm/255
Transcript
Discussion (0)
Hey there, thanks for listening.
Before we jump into this episode,
I just want to remind you that this episode
is brought to you by us over at TalkPython Training
and Brian through his PyTest book.
So if you want to get hands-on
and learn something with Python,
be sure to consider our courses over at TalkPython Training.
Visit them via pythonbytes.fm slash courses.
And if you're looking to do testing
and get better with PyTest,
check out Brian's book at pythonbytes.fm slash PyTest. Enjoy the episode. Hello and welcome to Python Bytes, where we
deliver Python news and headlines directly to your earbuds. It's episode 255, recorded October 20th,
2021. I'm Brian Ocken. I'm Michael Kennedy. And I'm Will McGugan. Welcome, Will. Thank you.
Good to be here.
I'm sure people know who you are through all you do with Textual and Rich.
Could you do a quick intro?
Sure, yeah.
I'm a software developer from Edinburgh, Scotland.
Last couple of years, I've been working quite heavily in open source. I built Rich and I started work on Textual,
which is application framework using Rich.
And I'm currently working exclusively on that.
So I've taken a year off,
probably more than that,
to work on open source projects.
I'm very excited about that.
We're excited about it too.
Yeah, that's fantastic, Will.
I think we've talked about this offline
as well the the success you're having with rich and textual and your this opportunity you have
to really just double down on this project you created and i know there must be thousands of
maintainers of projects out there like if i could just put all my energy into this and
you're currently lucky enough to be in that situation right that's fantastic yeah i'm i'm very fortunate actually i mean i'm i put some money aside i planned uh for this year
um but things are really um looking up and i've been blown away by the the level of interest
from it i mean um it gradually ramped up with rich um people people like that i think there
was a there was a missing niche or something which
which did that um but then with the textual um people are really excited about it i mean i'm
i put a disclaimer on on the readme that said it's not quite ready for prime time yet um it might
break and it's in like active development but um doesn't seem to discourage anyone
very busy uh building things with it.
So I'm excited.
I want to take it to the next level.
And to be honest, if I was doing it part-time like I was doing Rich,
it would just take too long.
If it was evening and weekends, it would be two years before it was like 1.0.
Yeah, and we're ready to use it now.
Yeah. Most people want to use it now. Yeah.
Most people want to use it yesterday.
Congrats again on that.
That's cool.
It's great stuff.
You know, we talked about it over on TalkPython and people want to dive in.
We've certainly covered it many times over here as well.
So we're happy to spread the word on it.
Well, Michael, let's kick off the topics.
I do want to kick it off.
All right.
How about we start with some awesome Python topic like C++?
I like both of them.
This is right in your wheelhouse, Brian.
A lot of C++.
So I want to talk about this tutorial article series, however you want to think about it, of wrapping C++ code with Cython.
So the interoperability story with C and Python being C Python as the
runtime is pretty straightforward, right? But C++ is a little more interesting with classes and
this pointers and all those kinds of things. So the basic idea is Cython is this thing that
allows us to write very nearly Python code and sometimes actually just Python code, sometimes like in a
little extended language of Python that then compiles down to C. And if that's the case,
well, it's probably pretty easy to get that Cython code to work with C code. And then Cython
naturally is exposed as Python objects and variables and whatnot. So that should be a good bridge between
C++ and Python, right? And it turns out it is. So this person, Anton Zaydan Pushkin, wrote an
article or is working on a series of articles called Wrapping C++ with Cython. And so there's
this library called Yarkerl, yet another audio recognition library.. It's kind of like Shazam. You give it a small fragment of audio and it'll say,
oh, that's Pearl Jam Black, you know, Black by Pearl Jam
or something like that, right?
Pretty cool.
And if you look at it, it's got some neat C++ features.
You know, Brian, feel free to jump in on this,
but see that right there?
Namespace, so cool.
I love how they're writing like well-structured C++ code
here. But basically there's a couple of structures like a wave file and an MP3 file and then classes
which have like a fingerprint and public methods and storage and so on. And so the idea is how
could we take this and potentially make this a Python library, right? Basically create a Python
wrapper with Cython for it. So I'm going to come
down here and says, all right, well, what we're going to do is we're going to write some Cython
code and Cython doesn't immediately know how to take a C++ header file, which is where stuff is
defined in C++ and turn that into things that Python understands. So you've got to write
basically a little file, a PXD file that declares what the interface looks like. So you've got to write basically a little file, a PXD file that declares
what the interface looks like. So you write code like this. Have you done this stuff before, Brian?
No, but this looks pretty straightforward.
Yeah, it's pretty straightforward. How about you, Will?
I've never wrapped a library, but I've used Cython quite successfully. So it's a really good system.
Yeah, yeah, I agree. I've done it, but not to wrap C++ code.
No.
So basically you do things like cdef extern
from this header, create a namespace,
and then you have cdef, keyword cpp class,
and then you get, what's interesting about this
is you get to give it two names.
You get to say, here's the name,
I want to talk about it in Python,
so cpp wave file,
and then here's its name in C,
which is your control colon colon wave file. And the value of this is they want to have a thing
called wave file in Python, but not the C++ one, a friendly Python one, but it needs to use the
wave file from the C library. So if you directly import it, then there's like this name clash,
which I suppose you could fix with namespaces and all. But I think it's cool that you can give it this name, this kind of this internal name,
and off it goes, right? So then you def out its methods, basically, like, just here are the
functions of the class, same thing for the fingerprint and the storage, and off it goes.
And so all of this stuff is pretty neat. And yeah this this thing i'm talking about is called aliasing aliasing
which is pretty awesome like it lets you reserve the name wave file and storage and fingerprint
and stuff like that for your python library without even though that's what the c names are
as well so yeah pretty straightforward what was the next thing i really want to highlight there's
kind of this long article here so um the next thing they talk about is this thing called extension types. So an extension
is just a C structure, or C++ library, and you create some, some class that is kind of a proxy
to it. So here we say cdef Python class called storage, and then internal it has uh in cython language you have to say cdef it has a
c++ class called this and then from then on you just go and write standard python code and anytime
you need to talk to the c library you just work with the this like inner pointer thing that you've
created which is pretty awesome you just new one up in the constructor and the c++ thing and then
like it goes off to Python's memory management.
So you don't have to worry about deleting it, stuff like that.
I guess you do have to sort of deallocate here,
but that's, you know, once you write that code,
then Python will just take it from there, right?
So pretty neat way to do this.
And the library goes on to talk about how you use it and so on.
So there's a couple of interesting things about like dereferencing the pointer,
like basically modeling reference types in Python.
But if you've got a C++ library
that you want to integrate here,
I think this is a pretty cool hands-on way
to do a Cython.
Yeah, I think this looks fun.
I'd like to give it a try.
Yeah, definitely.
Another one is Pybind11.
That might also be another option to look at.
So I saw Henry out in the live stream there.
So here's another way to operate seamlessly
between C++ 11 and Python.
So another option in this realm.
Maybe I'll throw that link into the show notes as well.
But yeah, a lot of cool stuff
for taking these libraries written in C++
and turning them into Python-friendly,
feeling Python-native libraries. Well, you know, that's really how a lot of Python's taken off,
right? Is because we've been able to take these super powerful C++ libraries and wrap a Python
interface into it and have them stay up to date. When you make updates to the C and C++ code,
you can get updates to the Python. You sometimes hear Python described as a glue language. I think many years ago,
that's probably what it was. I think Python is growing. It's more than just a glue language,
but it's very good at connecting other languages together.
It's still good as a glue language.
Yeah. It's not just a glue language. It's a language of its own, I guess.
Yeah.
I was talking to somebody over on TalkPython,
and I'm super sorry if I forgot which conversation this was,
but they described Python as a glue language for web development.
I thought, okay, that's kind of a weird way to think of it.
But Ariad said, well, no, no, look,
here's what you do with your web framework.
You glue things together.
You glue your database over to your network response you glue an api call into that i'm like actually that
kind of is what a web site is it talks to databases it talks to external apis it talks to the network
in terms of like html responses and and that's the entire web framework but yeah you can kind of even
think of those things and those terms there.
It's like a party where no one's talking to each other and you need someone to start conversations.
It's what Python does.
Yeah, yeah.
And I think also that that's why Python is so fast
for web frameworks.
Even though computationally it's not super fast,
it's mostly spending a little time in its own code,
but a lot of time it's like,
oh, I'm waiting on the database. I'm waiting on the network. I'm waiting on an API. And
that's where web apps spend their time anyway. So it doesn't matter. All right,
Brian, you want to grab the next one? Yeah, sure. Bump it on to topic two.
Bump it on. So I've got, I just have a few packages that I support on PyPI and then a
whole bunch of internal packages that I work on.
And one of the things that is a checklist that I've got
is what do I do when I bump the version?
And I know that there have been some automated tools before,
but they've kind of, I don't know,
they make too many assumptions, I think,
about how you structure your code.
So I was really happy to see T-Bump come by.
This was suggested by Sefi Berry.
So T-Bump is an open source package that was developed.
Looks like it was developed in-house by somebody,
but then their employer said, hey, go for it, open source it.
So that's cool.
And the idea really is it's just B's just bump versions and that's it.
But it does a whole bunch of cool stuff.
It does, so let's say I've got to initialize it.
So you initialize it as a little toml file that stores the information in the configuration.
But if you don't want yet another toml file or another configuration,
it can also append that to the by project.
That was a nice nice addition you can
combine them or keep it separate up to you um and so for instance i tried it on one of my projects
and i kept it separate because i didn't want to muck up my my project.toml file um but uh
once you initialize it all you have to do when you want to add and bump a new version is just
say uh tbump and then give it the new version
uh it doesn't automatically count up i mean you could probably write a wrapper that counts up but
looking at your own version and deciding what the new one is is reasonable that's a reasonable way
to do it uh and then it goes out and um it uh so it patches any versions you've got and then
in your code in your code base or your files or config
files or wherever um and then uh and then it it commits those changes it adds a version tag pushes
your code pushes the version tag and then also you could have these optional run things places
where like before you commit you can run some stuff like for instance check to make sure that
you've added that version to your change log or your, if you want to check your documentation. So that's, um, and then also,
you can have post actions if you want it to, I was thinking a post action would be cool. You
could just automatically tweet out, Hey, a new version is here. That's somehow hook that up.
That'd be fun. Yeah. Grab the first line out of the release notes and just tweet that.
Yeah. And then there's, there's a hard, the hard part really is how does,
how does it know where to change the version?
And that's where part of the configuration,
I think it's really pretty cool.
It just has this,
is this file configuration setting,
if I can find it on here,
that you list the source and then you you can also list the configuration of it.
Let me grab one.
So the source, and then how to look for it.
So it's a search string or something of what line to look for,
and then where to replace the version.
And that's pretty straight.
I mean, you kind of have to do some hand tweaking to get this to work.
But for instance, it's just a couple lines. It makes it pretty straight. I mean, you kind of have to do some hand tweaking to get this to work. But for instance, it's just a couple lines.
It makes it pretty nice.
At first I thought, well, it's not that much work anyway, but it's way less work now.
And then, frankly, I usually forget.
I'll remember to push the version, but I'll forget to make sure that the version's in the changelog.
I'll forget to push the tags to GitHub because i don't really use the tags the
version tags in github but i know other people do uh so yeah it's nice you know will what do you
think as someone who ships libraries frequently that matter i think it's useful i think for my
libraries i've got the version in um two places two files um so for me it's like um edit two files and i'm done um probably wouldn't be like massive
time saver but i like the other things you can do with it the the actions you can attach to it like
i'm creating a a tag in in github because i do often quite often forget that especially for like
minor releases um i sometimes sometimes forget that so that's quite useful yeah it's the extra stuff it's not just changing the files but like brian described like push
creating a branch creating a tag pushing all that stuff over making sure they're in sync that's
pretty cool yeah yeah good find this does more than i expected when i saw the title what we got
next well yeah okay it's often your first one uh this is is Close Ember, which is, what's the last one?
Portmanteau is when you put two words together,
November and close.
The idea is to help open source maintainers
close issues and close PRs.
So is this like to recover from the hangover of Hacktober?
Hacktober, I think so.
I didn't do Hacktober this year i didn't
either no no last year i mean um i got a lot of prs uh coming in um some of them were of
dubious quality um some of them just um some of them are very good actually i did actually benefit
a lot um but but it does actually generate um extra work uh if you manage
it it's really great um but but this is it generates more work for you even though it's um
it's in your benefit but close ember is purely to take uh work away from you work and work away from
maintainers um you know if there's lots of issues i mean i'm i've been very busy lately and not kept
an eye on the rich issues and they've just held up um some of them can be closed with a little bit of effort um so i think
that's what this project is more of a movement than a project it's designed to do it's designed
to um take away some of that burden uh from maintainers and uh it's a very nice website here and there's a leaderboard and all different issues and it
describes um what you should do to to close issues and prs and the author uh his name is
matthias buson near i've probably mispronounced that um he he's um he started this and I think he's going to turn into a movement
possibly it's too soon to really get big this year but I'm hoping that
next year it'll be a big thing it'll be after October you can relax a bit
because someone will get lots of people coming in to like fix your
issues and clear some PRs and things like that.
I mean, sometimes it's maintenance.
It's just tidying up, closing PRs, which have been merged,
and closing issues, which have been fixed, that kind of thing.
So I think it's a great thing.
I guess I don't quite get what it is.
Is it a call out to people to help maintainers?
Yeah.
Yeah, it's like a month long thing
and it's like a almost like a competition that they've um yeah they got like a leaderboard right
yeah yeah yeah matthias is uh core developer of um jupiter and ipython so he's definitely working
on some of the main projects there yeah he probably understands the burden of open source maintainer.
Even if you love something,
it can be
hard work.
Too much of a good thing, right?
But no t-shirt for this. At least not this year.
I don't think they offer t-shirts.
No, maybe next year.
I wonder if you can add your project to this.
I think you can tag
your project with Close ember i think
that's how it works um and then other people can search for it and decide which one they want to
to help with all right that's pretty cool so another brian brian skin sent over thank you
brian but sending a ton of stuff our way lately and we really appreciate it yeah keep it coming
so this one is the announcement is that scikit-learn goes 1.0 and
if you look at the version history it's been zero for zero ver for a long time with being you know
0.20 0.21 0.22 0. so this release is really a realization that the library has been super
stable for a long time but here's a signal to everyone consuming scikit-learn
that in fact, we intended,
they intended to be stable, right?
So there's certain groups and organizations
that just perceive zero-reverse stuff as not finished,
especially in the enterprise space,
in the places that are not typically working
in open source as
much, but are bringing these libraries in.
You can see managers like, we can't use scikit-learn.
It's not even done.
It's 0.24.
Come on.
Right.
So this sort of closes that gap as well as signals that the API is pretty stable.
Will, Textual is not quite ready for this, is it yet?
No, it's still on zero because I'm kind of advertising
that I might change a signature next version
and break your code.
Never do that lightly,
but it's always a possibility.
So if you use a zero point version bit of anything,
you should probably pin that
and just make sure that if there's an update
that you check your code.
As a consumer of rich or a consumer of Blast
or a consumer of whatever, if you're using Azure Verge,
you're recommending you pin that in your application
or library that uses it, right?
Yeah, exactly.
I mean, you might want to pin anyway
just to lots of bits of software working together.
There could be problems with one update here
that breaks this bit of software here.
But when you've got 1.0, that's the library developer that's telling you,
I'm not going to break anything backwards compatibility without
bumping that major version number. If they're using SemVerb, but because there's lots of other
versioning schemes that have the pros and cons.
Yeah, like calendar-based
versioning and stuff like that, right?
I think that makes more sense
in an application than it does
in a library. Calendar
versioning.
How much calendar versioning
makes sense for libraries? Maybe it does. I don't know.
I think some projects
that have shifted to Calvary have
recognized that they really are
almost never changing
backwards compatibility.
So they're never
going to go to a higher
number. Yeah, it's strange. There's no
one perfect system.
I quite like Samver.
By and large, it does what I need
of it, but there is no perfect
system, really.
Yeah, I like it as well.
Just the whole zero verb being for like something is on zero version,
zero dot something for 15 years. Like that doesn't make sense. Yeah.
All right. So this is,
we're talking about the one data release of scikit-learn.
Let me give a quick shout out to some of the new features or some of the
features they're highlighting.
So it exposes many functions and methods,
which take lots of parameters like hist gradient
boosting regressor.
Use that all the time.
No, not really.
But it takes, I don't know, is that 15 parameters?
Like 20, zero, 255, none, none, false.
What?
What are these, right?
And so a lot of these are moving to require you to explicitly say min sample leaf is 20 l2 regularization is zero max bins is
255 like keyword arguments to make it more readable and clear i like to make virtually all
my arguments keyword only i might have one or two positional arguments uh but the rest
keyword only i think um it makes code uh descriptive. You can look at that code and then you know
at a glance what this
argument does. Yeah, absolutely.
Yeah, it drives me nuts when there's like
I want all the defaults except for
like something special at the last
one. And so I've got to like fill
in all of them just to hit that. And also
I would love to throw out that this is
way better than star star kwargs.
Way better, right?
If you've got 10 optional parameters that have maybe defaults or don't need to have
a specified value, make them keyword arguments means that the tooling like PyCharm and VS
Code will show you autocomplete for these.
I mean, if it's truly open-ended and you don't know what could be passed, star star KW args.
But if you do know what could be passed, star, star, KW args. But if you do know what could be passed,
something like this is way better as well.
That often means you have to type more.
If you've got like a signature
which takes the same parameter as something else,
you just have to type it all over again.
It can be a bit tedious.
But it's very beneficial, I think,
for the tooling, like you said.
Indeed.
Also for typing, right?
You can say that this keyword argument thing
is an integer and that one's a string, right?
And if it's star, star, KWR,
you're just any, any, great.
Okay.
Or string any.
Okay, so we also have new spline transformers.
So you can create spline Bezier curves,
which is cool.
Quintile regressor is updated.
Featured name support.
When you're doing an estimator past your pandas data frame during a fit, Quintile regressor is updated, featured name support.
When you're doing an estimator past your pandas data frame during a fit,
it will, estimator will set up feature names in attribute containing the feature
names, right?
So that's pretty cool.
Some examples of that.
A more flexible plotting API, online one class SVM for all sorts of cool graphs.
Histogram based gradient boosting models are stable and new documentation.
And of course, you can launch it in a binder
and play with it, which is pretty sweet.
Congrats to the Scikit-learn folks.
That's very nice.
And also kind of interesting to get your take
on API changes and versioning and stuff, Will.
Oh, before we move on, Brian,
I saw a quick question that maybe makes sense
to throw over to Will from Andre.
Oh, God.
Everybody keeps asking this. So've uh ordered a windows the question is when will there be windows support for textual yeah um i've ordered a windows laptop um i've been working on a vm but
it's a pain uh to work on the vm i've ordered a windows laptop and that's going to arrive
uh end this month uh and I don't know exactly when,
but I'll definitely need that to get started.
And in theory, it should only be a week or two of work.
So how about I say this year?
After the month of configuring your laptop.
That's true.
I haven't used Windows in I don't know how long apart from a VM.
I'm going to test it with a new Windows terminal,
which is actually really, really good.
Yeah, the Windows terminal is good.
Yeah, I think it can be like a first-class textual platform.
The Mac works great.
Linux works great.
Windows has always been like a bit of a black sheep,
but the new Windows terminal is
a godsend because the old terminal was
frankly terrible. It hadn't been updated
in decades. Yeah,
the old school one is no good, but the new Windows
terminal is really good. Also, just a quick
shout out for some support here.
Nice comment, Tushar.
Windows support will be provided when you click the
pink button on Will's GitHub profile,
aka the sponsor button.
It's not a ransom, I promise.
I do intend to do it.
All right.
How about some server stuff?
I can't remember.
I think several times talked about how to develop packages while you're offline.
Let's say you're on an airplane or at the beach or something with no Wi-Fi.
I mean, maybe there's Wi-Fi at the beach,
but not at the beaches I go to.
That's because you live in Oregon
and some of the most rural parts are the beach.
If this was California, you'd have 5G.
Yeah, well, I mean, I could tether my phone to it or something.
Anyway, so Jason Coombs sent over an article um using dev
pi as an offline pi pi cache and i i gotta tell you to be honest that i don't know if it's just
the documentation for dev pi or the other tutorials it just like threw out a few commands
and and they're like that's you're good that's'll work. And I just never got it.
I've tried, and it just didn't work for me.
But this did.
So this tutorial is just a straightforward,
okay, we're just going to walk you through
exactly everything you do.
It's really not that much.
For instance, he suggests using PipX
to install a DevPi server, which is nice.
The Tbump package as well suggested installing itself with
PipX. PipX is gaining a lot
of momentum. Well, especially things like
Tbump
or
DevPy. I don't know if I'd do it with
Tbump because I want other package maintainers
to be able to use it too. But anyway,
this is definitely something you're just using on your own
machine, so why not let it
sit there. And then, so why not let it sit there?
And then, so you install it, you init it,
and it creates some stuff. I don't know what it does when you init it.
But then hidden in here is you run dev by server also then.
So it really is just a few commands, and you get a server running.
But there's nothing in it.
There's no cache in it yet. then you have to you have to go somewhere else um and then uh prime it so you've
got a local host and you that it it reports so you can export that as your pip index and then
just create a virtual environment start installing stuff that's all you got to do and now now it's
all primed and then what you do is you turn off.
Next time when you don't have any Wi-Fi,
you turn off.
You can run the DevPi server as, where is it?
DevPi offline mode.
And then there you have it.
You've got a cache of everything you need.
So I tried this out just uh just on like you know
installing pytest from my plugins and then uh set it in offline mode and then uh tried in the all
the installing the normal stuff that i just did worked fine into a new new virtual environment
but then when i tried to do something like uh install requests that i didn't have yet or
something else it just said oh that's not it's not of it though i can't have yet or something else. It just said, oh, that's not, it's not of it.
I can't find it or something.
It's a happy failure.
So anyway, this instruction worked great.
I know DevPy can do a whole bunch of other stuff,
but I don't need it to do a whole bunch of stuff myself.
I just need it to be a PyPI cache.
Yeah, this is really neat.
The init looks like it creates a database schema
as well as allows you to set up a user.
Okay.
I guess you could set it up with some authentication
that no one can mess with it and stuff like that.
Apparently, this works just fine for Teams.
So you can set up a server on just like a computer
in your network that just runs as as a cache and then you can point
everybody can point to the same one so i mean that that that would work as a really quick and dirty
and not too dirty just a fairly quick way for a local team to to have a caching server um i'd
probably even think about doing this for testing uh even on one machine so that you can have multi
like you know completely clean out your environments and still run
a test machine and
not hit the network so much if you're
pulling a lot of different stuff.
Henry Schreiner out in the live stream says,
can we also mention that Jason, the article
we're just talking about, also maintains
148 libraries, including
setup tools on PyPI.
That's awesome.
So, may know something about interacting with PyPI.
That's phenomenal.
I don't know how he finds the time, to be honest.
148 packages.
He needs close Ember.
Yeah, he needs a lot of close Ember.
Awesome.
All right, Will, what's this last one you got for us here?
Sure.
So, I found this project on Reddit reddit um it's called pi pi command
line and i noticed it in particular because it used rich but it is a pretty cool project um
it's notable because the the author is 14 years old like that's blown me away um to be that young
he's done a very good job of it uh so it's an interface to PyPy from the command line.
You can do things like get the top 10 packages.
You can search for packages.
You can see here, I think that's a search.
PyPy search rich, and that's given all the packages that have got rich in the name.
It's got a
description everything and then the date and here you can uh pi pi info django that gives you some
nice information about the django package which it pulls from pi pi like the github stars the
download traffic what it depends upon uh it meta information like its license and who owns it this
is really cool yeah it's, it's really nice.
Here we have the description,
and that renders the markdown right in the terminal.
I wonder how it does that.
I couldn't hazard a guess.
It's got to use rich, right?
I think it might, yeah.
Yeah, so it makes good use of rich.
That's how I noticed it. but it is a very cool project
in its own right it also uses um questionnaire uh so that's like a terminal thing for for
selecting stuff from the menu um so it does a bit dynamically and also has like a command line
uh to do it more from the terminal.
I think that's about it.
Let's check it out.
I think I want to check it out just for an example
of using this sort of a workflow,
not necessarily with PyPI,
but with just sort of copying the codes.
Yeah, it's a really nice looking terminal user interface
type thing.
I think it could be really interesting for you and me, Brian,
to just do info
on the various things we're talking about, right?
That might be fun to pull up as well.
Yeah, and there's actually tons of times
where I don't really want to pull up
a web browser just to put up, but I do want
more information, just the help it gives me.
I love the web, but sometimes
you have to do a context switch if you're in the terminal.
You're writing commands, and then you've got
to switch windows and find the title, barn and type everything in and um it's just a
little bit of effort but it can kind of like interrupt your your flow when you are working
yeah i mean especially when you got like the whole i've got like a big monitor and i've got
them all everything a place exactly where i want it and there's no web browser so if i want to look
something up i gotta like you know interrupt that yeah or the browser you want it, and there's no web browser. So if I want to look something up, I've got to interrupt that.
Yeah.
Or the browser you want is there, but it's behind a dozen other Windows,
a dozen other web browsers, typically.
Exactly.
Yeah, that's a good find.
And well done to this guy who wrote it at such a young age.
Very cool.
I was just going to ask you if you have an extras thing.
Do I have any extras? Ta-da! Here's my little banner extras. I was just going to ask you if you have an extras thing. So, yep. Do I have any extras?
Ta-da.
Here's my little banner extras.
I do have some actually,
Brian,
a quick shout out.
Madison sent over a notice to let us know that high cascades,
2022,
their call for proposals is out.
So if people want to sign up for that,
it closes October 24th.
So,
you know, make haste. You've got four days got four days but yeah still he closes in four days yeah so if you're thinking of preparing something you got three
days talks are 25 minutes long it was a lot of fun you know we both attended this conference a
few times it in the before times it was in portland seattle and vancouver uh this i'm not sure what
the story is with this one if it it's going to be in person.
I think it's remote, right?
Yeah.
I think so.
At least I hope I'm not wrong.
Yeah, I think you're right.
Then have you got your MacBook, your M1 Max?
Have you ordered that yet?
I want one, but no.
The $3,000.
I would love one, but I have no idea what I'd do with it.
I just work in the terminal most of the time.
Hey, you know, it has that new Pro, was it ProRes?
Something display where it has 120 adaptive display,
Hertz display.
So, you know, maybe.
I think my monitor only does 60,
so I don't know if I could use it.
But I have actually got texture running at 120 frames per second,
which is pretty crazy.
Yeah, that's pretty crazy.
I did end up ordering one
and on my Apple account
I have this really cool message.
It says,
your order will be available soon.
MacBook Pro available to ship null.
So we'll see where that goes.
See where that goes.
Did you put null as your address?
I should have. think how many people's
orders i would be getting i would get just like a stack of boxes outside do that amazon or something
yeah uh and then i think also i want to give a quick shout out to this thing this um code weavers
crossover which allows you to run windows apps natively on mac os without a virtual machine
it's like a it's like an intermediate layer so i think that
that kind of stuff is going to get real popular especially since the new m1s have like a super
crappy story for windows as a virtual machine because windows has a crappy arm story and you
could only do arm vms over there so i think that things like this are going to become really popular
there's a bunch of cool stuff people haven't checked out this crossover stuff i haven't
really done much in it but it looks super promising i've like been on the verge of like
i almost need this but i just run into via that's that anyway those are my extras okay well i've got
a couple um we've we've brought up starship once i just i've broke down and i'm using starship now
it looks working nice and one of the things that installed when I grew installed Starship,
it also installed PyEnv.
I'm not sure why.
So I started using PyEnv also.
And PyEnv works great.
I like it on my Mac,
but I still don't think it belongs in Python tutorials.
Anyway, the verdict's still out on me
whether or not it's any better
than just downloading off of org.
You're going to get tweets, Brian.
You're going to get tweets. But. You're going to get tweets.
But I agree with you.
I support you on this endeavor.
One of the things that was announced today is VS Code.dev is a thing.
So I thought it was already there, but apparently this is new.
If you go to VS Code.dev, it is just VS Code in the browser.
Oh, interesting. I think it's the same
as like the the uh the github you press dot yeah okay got it um so it can use the local file system
though which i think is the difference um github had this thing where you hit dot and it brought up
a vs code which worked with the files in your repo but i think with this um it can actually I think it's a difference. GitHub had this thing where you hit dot and it brought up a VS Code
which worked with the files in your repo.
But I think with this,
it can actually use your local file system.
Wow.
Yeah, which makes it more interesting.
It's great if you work on another computer
and you just pop it open,
you've got all your settings there.
Yeah, exactly.
And boom, you're ready to go.
That actually is quite a bit different then.
That's pretty cool.
Yeah, two use cases for me that I think I would use this
that seem really nice.
One is I'm working, say, on my daughter's computer.
She's like, Dad, help me with this file.
Help me with something.
And I've got to open some file in a way that has some form of structure.
And she doesn't have VS Code set up on her computer.
She's in middle school.
She doesn't care.
But I could just fire this up and look at some file in a non-terrible way.
That would be great.
The other is on my iPad.
Oh, yeah.
Right?
There's not a super good story for that.
But this kind of VS Code in the browser, other things in the browser, they seem really nice.
Or if I was on a Chromebook or something like that, right?
If I was trying to help somebody with code on a Chromebook, that'd be good.
How about you, Will?
Do you have any extras for us?
Here we go.
Python multithreading without the GIL.
GIL stands for Global Interpreter Lock,
and it's something which prevents Python threads
from truly running in parallel.
People have been talking about this for years,
and I've got a bit kind of dismissive
because every time it comes up,
it never seems to happen because there's quite a lot of trade-offs generally.
If you get rid of the gill, you hurt single-threaded performance,
and most things are single-threaded.
But this looks like the author, Sam Gross,
has come up with a way of removing the gill without hurting
single-threaded performance.
I think they've got this to do with reference counting.
They've got two reference counts,
one for the thread which owns the object
and one for all the other threads.
And apparently, it works quite well.
And the great thing about this is
MARK MANDELMANN, That's super creative to basically think of,
like, well, let's treat the ref count
as a thread local storage.
And probably when that hits zero, you're like,
okay, well, let's go look at the other threads
and see if they're also zero, right?
Yeah, yeah.
And if this goes ahead,
and it's got quite a lot of support, I think,
in the core dev community.
I don't keep a really strong eye on that,
but from what I hear, it's got a lot of support.
And if that lands,
then we can get fantastic performance
out of multi-threaded code.
You know, if you've got 20 threads,
you could get almost 20 times performance.
So that could be huge.
I've no doubt there'll be a lot of technical hurdles
from C libraries and things, but I'm
really excited about that.
I think performance improvements are single-threaded.
They come in little fits and starts.
We get 5% here, 10% here, and it's all very welcome.
But if this lands, then we can get 20 times for certain types of computing tasks.
So I'm really excited.
I hope this one lands.
I mean, you're talking about this,
oh, here, let's get this multi-thread stuff.
You know, you were just saying,
what are we going to do with these new M1 Pros and M1 Macs?
I mean, 10-core machines, 32-core GPUs.
There's a lot of stuff that's significantly difficult
to take advantage of with Python,
unless something like this comes into existence, right?
Exactly.
If you have 10 cores, chances are you'll just use one of them.
I'm wondering if this goes in, whether it'll change.
We'll need some other ways of taking advantage of that
because I think at the moment, for most tasks,
you'd have to explicitly create and launch threads.
I wonder if there'll be advances
where uh python could just launch threads and things which could be easily parallelized um
maybe i'm hoping for for too much but i've no doubt there'll be some kind of like software
solution to help you just um launch threads and like use all those cores and your shiny new
new macs there's a lot of interesting stuff
that you can do with async and await.
And there's also some cool thread scheduler type things.
But I think much like Python 3
when type annotations came along,
there was a whole bunch of stuff that blossomed
that took advantage of it,
like Pydantic and FastAPI and stuff.
I feel like that blossoming hasn't happened
because you're really limited by the gill
of the CPU level, then you go multi-processing
and you have data exchange
and compatibility issues. But if this
were to go through, all of a sudden people are like,
now how do we create these libraries
that we've wanted all along?
Yeah. I think that's
it. I think once we've got
over that technical hurdle,
all the library authors will be looking
for creative ways of using this for speeding code up
and for just doing more with your Python.
Yeah, with every programming language,
the jump from single-threaded to multi-process
is a huge overhead.
So you don't do it lightly. But you could do it lightly with multi-process is a huge overhead. So you don't do it lightly,
but you could do it lightly with multi-threads.
You don't have such a huge overhead burden.
It's very exciting.
I was also super excited about this.
So I'm glad you gave it a shout out.
We'll probably come back
and spend some more time on it at some point.
Yeah, and where is it?
Somebody said one of the exciting things about it
is Guido didn't say no immediately.
That's a very good sign.
Yeah, which has not been the case
with some of these other ones
because they were willing to sacrifice
single-threaded performance
to get better multi-course performance.
They're like, you know,
this is not a common enough use case
that we're willing to do that.
I think actually the solution the author came up with,
it did reduce single-threaded performance,
but he also added some unrelated optimizations,
which speeded it back up again.
Exactly.
I'm sorry, I fixed it, but yeah.
Interesting.
One more thought on this really quick.
David pushing out in the live stream says,
the galectomy is like nuclear fusion.
It's always 10 years away.
Yeah.
Hopefully it's not 10 years away yeah i hope opal is hopefully
it's not 10 it's possible but i think this is the biggest possibility since then to do interesting
things maybe already taking account that you know looked at and didn't say no immediately
to this is a project from this is a project sam's working on but it's supported by facebook where he
works so there's like a lot of time and energy.
It's not just a side project.
Third, Larry Hastings, the guy who was doing the colectomy, commented on this thread saying,
you've made way more progress than I did.
Well done, Sam.
So these are all good signs.
That's fantastic.
Yeah.
Yeah.
All right.
Well, Ryan, are you ready for our joke?
Yeah.
A laugh?
Definitely.
See, this is optimistic because they're not always that funny.
But I'm going to give it a try.
This one is for the web developers out there, for those folks that work on APIs and probably
have been working for a long time on them.
So the first one I got for us, I just found another one I'm going to throw in from Inspired
by the Livestream.
But this one is entitled The Torture Never Stops.
All right?
Okay. So it's a,
every one of these, it's four different pictures in this cartoon. There's a, there's a different developers up at the board describing some new way to talk to web servers from your app.
So way back in 2000, it says soap, simple abject object access protocol. Soap makes programming easier. And the developer in the audience is like,
WTF is soap?
Oh, come on.
What is this?
Crazy namespaces in XML.
Skip ahead 10 years.
Now there's a developer up here saying,
REST, representational state transfer.
REST is better than soap.
The developer now asks,
WTF was wrong with soap?
2015, GraphQL. GraphQL is more versatile than REST. WTF, I was just. 2015, GraphQL.
GraphQL is more versatile than REST.
WTF, I was just getting the hang of REST.
2018, gRPC.
gRPC is faster than GraphQL.
WTF, I thought you knew by now
that torture never stops.
Says like the guy next to the other developer
that's been complaining for 20 years.
I think that hits a bit too
close to home but if you're a javascript developer that gets compressed into like the last six months
i think that's right you've lived it really hard and really intensely nick says let's just start
over with so yeah pretty good pretty good all right and then we were talking about vscode.dev
and how you just press dot in your browser in GitHub or how you go to that URL
and so on, how cool it was. And somebody said, oh, it doesn't work in Safari.
So I want to come back to this joke that used to be applied to IE.
But now I think should be applied to Safari. Like genuinely, I think it should be.
Is it's the browser wars as a cartoon.
So there's Chrome and Firefox.
It's a little dated because Firefox is not as popular as it used to be, sadly.
But it's like Chrome and Firefox are fiercely fighting
and like IE is in the corner eating glue.
I just feel like that needs a little Safari icon and we'd be good.
We'd be all up to date in 2021.
How do you know it's IE?
It has a little E on it has a window symbol well the e of course is backwards because the shirt's probably on backwards or something
also it's eating glue so
yeah true uh funny so um thanks will for joining us today this is really fun show
thanks everybody in the chat for all the great comments.
Thanks Brian.
Thanks Will.
See you all later.
Thanks guys.
Bye bye.
Thanks for listening to Python Bytes.
Follow the show on Twitter via at Python Bytes.
That's Python Bytes as in B-Y-T-E-S.
Get the full show notes over at PythonBytes.fm.
If you have a news item we should cover,
just visit PythonBytes.fm and click Submit in the nav bar.
We're always on the lookout for sharing something cool.
If you want to join us for the live recording,
just visit the website and click Livestream
to get notified of when our next episode goes live.
That's usually happening at noon Pacific on Wednesdays over at YouTube.
On behalf of myself and Brian Ocken, this is Michael Kennedy.
Thank you for listening and sharing this podcast
with your friends and colleagues.