Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 293, recorded July 11th, 2022.
And I am Brian Okken.
Hey, I'm Michael Kennedy.
And I'm Ashley Anderson.
Well, welcome, Ashley.
Before we jump in, tell us a little bit about who you are.
Yeah, I'm a software developer.
I work for a relatively small but sometimes growing startup out here.
We make a portable MRI machine.
So I'm one of these software developers that came from an academic background.
I studied biomedical engineering and medical physics.
And then this is kind of my first full-time software gig.
But I think in research, like everyone's doing software these days.
So a lot of people are kind of making that jump.
And this was a perfect opportunity for it.
A portable MRI.
That's got to be fascinating.
Cool.
Very cool.
How do you find the transition from this more researchy side over to this maybe more formal dev role?
Yeah, it's like just such a better fit for me.
I think.
Like in my research labs and stuff, I was often like way more interested in helping build tools and stuff to help accelerate other people's work.
Rather than, you know, diving into the research myself, I often found that to be very frustrating.
And maybe I wasn't the best at it or something like that.
So this has just been a much better fit for me.
Yeah.
Cool.
Well, let's jump into your first topic.
What do you got for us?
Sure.
Yeah.
The first thing I wanted to talk about was, I think this is kind of the big news since Friday.
The PSF and the PyPI announced that they're giving away 4,000 of these two-factor hardware keys.
That's maybe kind of gotten washed out in this, but it's kind of a cool effort.
I saw this from Dustin Ingram's Twitter.
And I know he's been involved in a lot of the, or been interested in kind of outlining a lot of the security concerns about supply chain vulnerabilities and stuff in the past.
I thought this was a really interesting idea for helping with supply chain vulnerabilities, or at least kind of taking a step in that direction.
And I think it's just the PyPI, you know, sort of first step in this direction.
They announced some other stuff in the past about maybe having private packages or organizations on there and namespace packages and stuff.
But this was a pretty cool thing to do.
It looks like they're going to roll out two-factor as a requirement, probably eventually for everybody.
The way they're starting it now is kind of for some of the most popular packages.
And for people who have those popular packages, I'm not one of them.
They're offering codes to get some of these hardware keys to help that.
Interesting.
Yeah.
There's been a bit of a backlash to this, actually, which on two levels.
Some people just expressing a little bit of frustration and others more so.
See item two coming up.
One thing I think is interesting about this, this whole side of things is like the original thing that you brought up, Ashley, is people, I think, are focusing on their hardware keys.
And while that's a cool idea, I think the bigger story is just 2FA.
Forget hardware keys.
Like hardware keys are one way to do 2FA.
Right.
But if you look at the actual giveaway, I think it's limited to certain locations.
Right.
Like I can't remember what all the locations were.
I feel like it's kind of North America, Europe and Australia or something in that general realm.
And you could entirely have a popular, what is now known as a critical Python package and not live in those locations.
Right.
Yeah, for sure.
I mean, I suspect a lot of them, a lot of the maintainers of those packages are not in some of those locations.
I think those are probably dictated by like export rules on certain cryptography.
But I hadn't thought about that.
I thought it was just a shipping thing, but you're probably right about that, actually.
Yeah.
Oh, yeah.
So there's a little bit of a pushback and like, hey, I'm doing this for free.
Why are you making me do this extra work setting up these keys?
And that's kind of why I said I feel like it's kind of the headline has missed the point here because to say, oh, I've got to get this hardware key and set it up is not technically true.
You just have to use 2FA of some form.
Right.
It could be with like the standard 2FA you have with your phone or maybe even SMS would work.
Although SMS is a sketchy but better than nothing form of 2FA.
Like if I'm going to go and get a bank account.
Some people suggest.
If I'm going to.
Some people.
Yeah, go ahead.
Sorry.
Some people say that SMS really is like a pretty insecure version of 2FA.
So I think having.
They do.
Some type of keys.
And they say like.
Yeah.
It would be better.
But like at the same time, if you don't have any 2FA, there's still another step.
They've got to hack your SMS somehow to get through the SMS stuff, which is better than just like they just guess your password.
Or do they get it from a password breach?
So it's even for all the criticisms of SMS as a 2FA, it's still not a negative.
It's just not nearly as good as the other option.
I'm just chuckling because I just got an email last week about from.
Was it on the 8th of July?
Saying, hey, you're a critical.
You're a maintainer of a critical project.
And they want me to set up 2FA.
And I just haven't read it yet.
So I like.
This is news to me.
And it's what it's a pie test plugin I've got that supposedly is a critical project.
Go figure.
Oh, that's awesome.
The definition.
People are wondering.
I saw Will McGugan asking on Twitter, like, does anybody know what this means?
Where did I got this to?
The definition from what I understand is you are in the top 1% of downloads for a moving
six month window.
So in the last six months, your project is in the top 1% of most used, most downloaded.
Wow.
So congratulations.
That's awesome.
That's awesome, Brian.
Cool.
I guess I'll read the email more closely now.
Yeah, perhaps.
Get this set up.
Ashley, do you know what happens if you just are like Brian?
Like, I don't.
Spam.
Doesn't matter to me.
Just ignore it.
That's a good question.
I guess eventually they'll probably not let you upload if you don't enable it.
Like, next time you go to log in or upload a package, it'll just say, hey, you have to
turn on 2FA.
Because like you said, you don't have to have the key.
You just have to have 2FA on.
So I clicked on the manage and it says, I've got a little big banner up.
I'll just pop to it right now.
Oh, where's it on here?
We'll go ahead and show this.
I get, this project is included in the two-factor mandate for critical projects.
In the future, you will be unable to perform this action without enabling two-factor.
So I think you're right.
I think it's just going to kick me out of being able to do anything with the project.
if I don't enable this.
Yeah.
Interesting.
This is cool, Brian.
One, I think Teddy's right out there.
Like, congrats.
Brian's on fire.
High test check, by the way.
People listening is the plugin.
But it's cool to see it live, to see what's happening.
So this apparently is what maintainers get.
And I'm with you, Ashna.
I think what's going to happen is you just, you won't be able to upload with Twine anymore.
You won't be able to log in.
You won't be able to make changes.
It'll just force you down a 2FA path.
Yeah, I read that you still can upload because, like, people want to do, I know there were some people initially concerned about, like, how do I do automatic uploads from my CI system or whatever?
And you can do it if you get a token.
But you have to, like, you know, generate one of those tokens with your 2FA-enabled account to do that.
Right.
That happens with all the 2FA accounts, right?
You can no longer use your GitHub password for, like, on the CLI.
Like, once you set up GitHub 2FA, then all of a sudden you've got to go create an app, give it a name, and get, like, an API token for it and stuff like that, right?
Mm-hmm.
I think that's okay.
Yeah.
So, Brian, let's ask you, like, how do you feel about that?
Does this seem like a big burden to you?
Are you okay with this?
Or?
You know, I was, I'm okay with it because I think it's securing the supply chain.
I mean, I've already enabled the two-factor authentication on GitHub, and I've got, you know, a bunch of banking stuff that I have on, you know, multi-factor authentication and stuff.
So, I'm waiting for 12-factor authentication, but that might be a bit extreme.
All right.
Now, you put your small pinky toe onto the key reader over there, and then you hold down this key with your other finger, and then you put your face up.
Yeah.
An optic scan, a blood scan, you got to, you know, deposit a urine scan, and all sorts of stuff you got to do.
Good night.
No.
I'm drawing the line there.
I'm not doing it.
So, no, but I'm fine with it.
I don't know the details yet, though.
If I got to get a hardware key, though, I'm going to be a little upset.
I think, I don't know.
Well, there might be one for free, but yeah, even getting one for free, I feel like I'd be like, if I'm not a hardware key guy, I don't know.
Yeah.
Well, what if I lose it?
So.
Yes.
First of all, let me preface this statement with, please don't email me.
It's, it's, if we disagree on this, it's fine.
Just don't email me.
We can just agree to disagree.
But I am personally not a fan of 2FA hardware keys because what if you lose it?
It's really bad.
If you, I now, all of a sudden, if I'm, what if I'm traveling and like the website is down and I've got to log into the, the ISP, the cloud system to make a change.
Did I, what if I forgot to bring the key or what if I do bring it?
Then I lose it.
Like just the, the act of having a physical key that has to always be with you.
Like, do you take it with you when you go swimming?
I mean, I mean, that's a little extreme, but like, if you're going to go to the beach and you might need it, what are you going to do?
And then if I only have my phone, I can't plug the key into the phone.
I don't know.
It just, it seems like I certainly know why you would have it at like, if I worked at a bank and I needed to get on the VPN and I needed to have that permanently stuck in my computer.
Fine.
But as a broad based solution, I feel like things like Authy, Google, Google authenticator, the Microsoft, whatever it's called, all those things.
I think they still provide a pretty strong level of security while being able to travel with you and being able to synchronize across devices that you might not always have them with you.
So yeah.
When people say it's always such a hassle to get these keys, like you could just set up Authy.
You know what I mean?
Yeah.
I use Authy too.
I'm also, I'm a little freaked out by the hardware keys.
I did find it interesting in the giveaway.
Actually, I think they give you a coupon to get two so that like you could get two in case you lose one.
But that to me just is exactly why I don't want one.
Exactly.
Well, okay.
So I've got one plugged into my computer and I put what one into the closet.
If the house burns down, what am I going to do?
I mean, I'll probably, I'll grab my phone and run maybe if I can get to it, but I'm not going to go rooting around for a hardware key.
I'm just going to get out.
You know what I mean?
There's, there's just all these like sort of weird edge cases that to me, I'm just like, I don't really want to hand on one of these hardware keys.
Yeah.
Brian's going to have to go to the bank and his safe deposit box just to upload a new pie test check.
Yeah, exactly.
All right.
I turned both keys to the right on three, two, one.
Chink.
Okay.
V1, two, 1.2 is out.
Yeah.
Okay.
But I would just point out the article here from Armin.
Yeah.
Please do.
Which was super interesting, I think.
And it was, this kind of gets into, it'll probably lead us into the next topic here of why there was a little bit of controversy around this.
And I think it wasn't so much that people are resistant to two factor.
It's more this designation of packages as critical.
And I don't know if that's just because like critical is a bit of a loaded term or it ended up feeling a little bit like a popularity contest.
But yeah, I think it's pretty clear to me that PyPI wants to, you know, which is an open source project itself, right, wants to eventually probably roll this out to everybody and maybe doesn't have the capacity for that right now or something.
Yeah, I totally agree.
And Armin Peik is quite interesting.
And he comes down a little bit, you know, on the middle.
Like I see the value, but also I see why people are a little bit frustrated with this.
He does talk about this thing that the Rust community has, you know, hat tip towards topic four as well, called CargoVet, which is the idea of vetted packages and unvetted packages.
So if you, when you pip install something, you could say something like, do I only want to allow like the higher vetted packages?
PyPI doesn't have this at the moment, but other package indexes do.
To me, again, coming back to the hardware thing, I feel like people saw this and they thought, I've got to go to this hardware key.
Like this seems like, I can't believe you're forcing this on me.
If you're a software developer in 2022 and you don't have any form of 2FA setup, that's, I feel like those are the people who got really frustrated.
But at the same time, like, what are you doing on the internet in 2022 without at least a few things on 2FA?
My Authy account has something like 46 different 2FAs in there.
My 1Password has like a thousand accounts.
I don't know.
It doesn't seem like a huge burden to hold up your phone, scan a QR code and carry on.
But if you're not in the 2FA space, and especially if you perceive that to mean I got to get into the hardware 2FA space, I can see why people would see this as frustrating.
And with that, maybe it's time to just move to the next topic, number two, which is IPI move to require 2FA for critical projects, which is this here.
But what's really interesting is there's sort of talking about the challenges.
And one of the things that happened is there's this project called Atomic Writes, which was designated as critical.
Atomics Writes, what it actually does is pretty straightforward.
Let's use a context manager to write to files atomically.
So you can write to the file, write to the file.
If there's some kind of crash or mistake or bug or something, it won't actually change the file.
So normally you would just do like while true, start writing.
And if something crashes, like you'll have a half written file.
So this is kind of cool.
It says what you're going to do is use a context manager, open a file.
We're going to write to a temp file.
And then when you exit the context manager successfully, we're going to apply all those changes by doing an overwrite move type of operation at the OS level.
I don't know how truly atomic it is, but it sure is better than writing line by line.
And certainly it has the data safety aspect, which is pretty cool.
Anyway, apparently people use this as in 127,839 packages.
Maybe that number was higher not long ago.
Packages, projects on GitHub use this.
I guess not packages, but projects, many of which were packages themselves.
So this guy, Markus Unterwalitze said, you know what?
This is really frustrating to me.
I don't want to set up 2FA.
So I'm just going to unpublish this, take it down.
And so don't know exactly what the chain of events was.
I think something happened to the GitHub repository getting deleted, which then triggered, maybe also somehow triggered a delete of all of the historical IPI packages.
Whatever the steps were, it erased all the historical IPI packages.
So imagine your project has a dependency on atomic writes and your requirements.txt or pyproject.toml or whatever says equal, equal.
What version are we on?
We'll get some releases here.
There's no releases anymore, so I can't tell you.
But if you had like some concrete number there, it would say, pip would say, can't find that.
Sorry.
And so all sorts of started breaking.
Continuous deployment, continuous integration, a bunch of PyPI, pytest packages, tests and automation and stuff.
Brian, maybe you saw some people going, what's going on with this thing?
I didn't really notice it.
Well, you'd only notice if you depended upon this, had set up automation, right?
Like basically check out your code, install the dependencies, run pytest.
But people are like, these tests used to pass.
Why are they no longer passing?
And it's because pip couldn't install this project that Marcus got a little frustrated with and deleted out of PyPI.
So that's interesting, right?
Like, should he have done that?
I don't know.
Here's his sort of comment saying, here's what you got.
And it says, PyPI just told me to enable 2FA to keep uploading this package because I thought it was annoying and entitled to guarantee the software compliance for a handful of companies.
Basically, his take was, you're making me secure the supply chain so that large banks and other companies that care about it will feel better.
And you're making me do extra work.
Again, that I think the confusion about hardware, moving to hardware 2FA versus just scanning a QR code with your phone.
Anyway, you're making me do extra work.
And so I deleted the packages.
Apparently, I deleted all the old versions.
Sorry.
Those have been restored by directly working with, I believe, Dustin Ingram from PyPI.
So if you go down here somewhere, it says, no, sorry, Donald Stuff is the one who.
But yeah, it shows you, I guess, unintended consequences.
Hey, we're going to make atomic rights a little safer.
Maintainer of atomic rights doesn't like that.
Deletes it, makes everything break.
Ashley, what's your take on this?
You've been tracking it.
Yeah.
I mean, I find it really interesting.
Like, it gets to the whole, you know, what is the sustainability of this giant open source ecosystem that we have?
I know, I think in the show notes, you refer to this as Python's left pad incident or something like that, which is sort of a throwback to a very similar thing that happened in NPM recently.
And I think there was another one recently, like the start of the Ukraine war, basically, where someone, I think, pulled their package and put in something that was like protest wear or something like that.
It tried to delete all the data off the hard drives if it detected you were in certain countries or something, which is a pretty, pretty rough hammer to use.
Yeah, pretty extreme measure.
Right.
What if you were working to collect data about trying to help Ukraine, but you happen to be in this other country?
I mean, it's just, yeah, it's just overstepping, I think, a little bit on intended consequences.
Yeah.
But this is like, I mean, we're working in industry and having to pin our packages and stuff.
This is something that, you know, we kind of already protect for by mirroring.
You know, I think most people with, I'm going to use critical, not in the way that's being used here.
But like when you have a project and you're using all these dependencies, it's kind of also on you to know that like, well, the supply chain, I mean, PyPI doesn't have a permanent retention policy.
Maybe it should, but that is going to lead to, you know, potentially much even even bigger hosting costs and everything for what's already a really expensive project.
We run into the same thing with like packages from Ubuntu and stuff like that as well.
Not that they get pulled in this way, but they'll bump versions on us that, you know, and especially in a regulated industry, we can't just update dependencies whenever they come out.
So, you know, it wouldn't surprise me to see IPI become immutable once it goes up there.
Like you can't change it.
Yeah.
Or more so.
Right.
Yeah.
I would expect it to be more of a request thing.
You put it in a request and say, hey, I want to, this is mine.
I want to take it down.
And some review happens or something because people depend on it.
And I, I get, I get, I kind of get both sides of it.
I get that it's my thing.
I should have complete control over it.
But I also don't have, I don't have complete control over GitHub.
I don't have complete control over PyPI or the PSF.
And I use those services.
They can like the, the PSF, for instance, I got it.
They like purge all of your accounts, like once a year or something like that.
And you have to re, you have to re log in or recreate your account.
And, and, you know, get projects and services change their policies every once in a while.
And, and this is a change in policy that for some projects we're going to require 2FA.
They can do that.
And if I want to continue to use it, I have to.
Now, if I don't want to continue to use it, that that's a, I get, I guess that's where
we're getting the question in is what ramifications are there?
Can somebody take their, take their stuff off of PyPI or not?
Don't know.
Yeah.
So.
Yep.
I think that if you read a lot of the conversations here, maybe we'll just close up this whole
section on that.
It comes down to two different beliefs.
One, I should, it's my code.
I wrote it.
I can do whatever I want.
I own it.
If I don't like it, I can just delete it.
If I want to stop, I can stop.
The other one says, once you put it out there on GitHub and you've put it out to the world
as here's a library that you can use and depend upon, and you publish it to the index with a
clear intention of sharing it, you have a minuscule responsibility not to keep working on it, but
to not destroy it for other people who are building on what you previously did.
Yeah.
I think there's a difference there too, between like writing and publishing the code and publishing
a package or distributing a package that's intended to be, you know, conveniently downloaded
in CI and stuff like that, where you're kind of making a little bit more of a promise there.
But also, I mean, going back to Marcus's post here, it sounds like he, his intention wasn't
to break, you know, people's existing workflows and stuff like that.
It was really, he just didn't want to be the maintainer of a critical package.
Exactly.
He's like, I deleted it.
That fixed it.
Yeah.
And then became, I think this, you know, the sort of poster of this controversy.
So yeah.
Yeah.
If you read Marcus's Twitter, you can go back and sort of, you kind of get a sense that he's
the kind of person that would not want to take that kind of stuff being put upon him or
whatever.
Let's wrap it up with Teddy's comment out in the audience.
Feels, feels like a small step to enable 2FA.
I wonder why it creates so much debate.
Feels a bit political, especially today where 2FA is required almost everywhere.
Yeah.
I'm, I agree.
I think, again, I think people saw the, here's your hard work key.
Like, I don't want a hard work key.
There's so much work.
Let's, let's move on, Brian.
That was a, that was a good one, but let's fast.
Let's get out of there.
Yeah.
Fast, a harsh transition.
Yeah.
Let's just talk about fast, FastAPI, you know?
Anyway, don't transition from that.
So that's good.
FastAPI filter came up.
It was suggested by Arthur Root, Arthur Rio, who is also the creator of it.
And it looks pretty cool.
So it's, he, he said in a tweet, I love using, I loved using Django filter with Django rest
framework.
And I wanted an equivalent for FastAPI.
So what this is, is this is a package you add to a project that uses FastAPI.
And with it, you get like, when you're going through the, the cool debug user interface stuff,
you can filter stuff.
So you can, you know, it'll look at your, your schema and then you can, you know, filter different
items and only, only see part of it.
And it's just pretty neat.
He also, it also has things like the filters support operators, like greater than greater
than equal, less than not in and things like that.
So it's kind of a fun way to just filter when you're looking at your data to filter it.
And in his read me, he mentions that he's got a video and you kind of need a big screen
for this, but, but he does have a video to, to, to show it in action, which is kind of cool.
He shows filtering some of the data and then seeing the different data output.
Anyway, just, just kind of a neat, nice debugging tool.
If you're using FastAPI.
That's really awesome.
Actually, do you do anything with FastAPI?
Unfortunately, no, this just makes me more jealous.
I think of the people who get to use FastAPI, because it's got all these cool, I mean, you
know, as a developer, I've played around with it, but like, it's got all these cool sort
of debug admin interfaces.
And then you see even more stuff like this kind of built on top of that.
It's really awesome.
Yeah, absolutely.
Yeah.
And, I'm, I'm planning on learning more about FastAPI on Michael's upcoming course.
So, yeah.
Are you going to be able to make it, Brian?
I'm going to make sure I make it.
Yeah.
Awesome.
I'm looking forward to that.
So, yeah, that's the, the live in-person FastAPI course.
I'm doing it out a month from now.
So it should be fun.
Before we move on, I do want to talk about our sponsor for this week, Microsoft for startups
founders hub.
They're doing super cool stuff as someone who has started his own small business.
It is a lot of work.
There's a lot of uncertainty and knowing how to get help and having support of people who
have experience is really, really valuable.
Starting business is hard.
They say that by some estimates, 90% of all the startups will go out of business in the
first year, which is tough, but that's how it is.
With that in mind, Microsoft for startups set out to understand what startups need to be successful
and create a digital platform to help overcome those challenges.
And that's where they got their founders hub.
So Microsoft for startups founders hubs provides all founders at any stage with free resources
to help them solve startup challenges.
You get technology benefits, access to expert guidance and skilled resources, mentorship,
networking connections, and so much more.
So, and unlike a lot of other similar programs in the industry, it doesn't require startups to be
investor backed or third party validated to participate.
Founders hub is just open to everyone.
So what do you get?
You get, you can speed up your development with free access to GitHub and Microsoft cloud
resources that have a bunch of credits that unlock over time.
So you can grow without worrying about paying for stuff.
They also help startups innovate.
They're partnering with companies like open AI, AI research and deployment company to get extra
benefits through their partners as well.
Um, it's so with the founders hub, it's not really about who, you know, you have this access
to this mentorship network.
So you get access to a pool of hundreds of mentors across a range of disciplines, areas
like idea validation, fundraising, management, and coaching sales and marketing, and specific
technical stress points.
I think that might be the most valuable, honestly, is, Hey, I need to talk to this person or somebody.
Is this a good idea?
Is this how I should be doing?
And so on.
So you can book a one-on-one meeting with mentors, any of whom are founders themselves.
Make your idea a reality today with critical support that you'll get from Microsoft for startups
founders hub during the program, visit pythonbytes.fm/founders hub to click the link in your
show notes and yeah.
Thanks Microsoft for supporting the show.
Nice.
Indeed.
So what do you got for us next, Michael?
Uh, Ashley's next.
I'm letting him go next.
Oh, right.
Okay.
Yeah.
We'll scroll down to mine then.
Um, yeah.
So I guess I think kind of the reason I'm here, I emailed you guys after there was some
discussion on the podcast a few weeks ago about, you know, Hey, we're seeing a lot
more stuff built in rust.
And you, you had some good points about like why we're seeing that.
Um, but I thought super relevant to this, podcast is, this project.
And in fact, this whole organization, py03 on GitHub, has a number of projects in here
that are, you know, super relevant to Python developers, obviously.
So the main one I think is py03, which is, is rust bindings.
Um, and basically what I emailed you guys was that my hypothesis is the tooling around building
extensions for Python in rust or calling Python from rust, is getting so good and so easy
that like, for me, I find this preferable to writing C extensions, for example.
Now, not even necessarily because of rust, although rust is a really great language I've
been getting into over the last year.
Um, but just like that, that tooling aspect of it, is really great.
Great.
So that the experience is, is pretty awesome based on, you know, these separate projects.
So there's py03, which is the, the bindings.
Uh, and this allows you to basically use, these type of things that it's almost like a
function decorator.
These are called, procedural macros.
They're kind of tricky to write, but they're really easy to use.
So you just put this on there, and then use this one to create a module, add your function
to the module.
And then if you build this file, you can import it in Python, and run this function.
So, the combination of, you know, the ease of writing this, and then there's another project
in here, called maturing.
Before you move on real quick, maybe, for, for people listening, if you go back just
real quick to that, that section you had there.
Yeah.
So the idea is what you do is you, you write some rust code and then you put, you call it
a decorator or an attribute or what do you call that hash?
It's called a macro.
Yeah.
A procedural macro, but you can just call it a macro.
Yeah.
So you put the macro onto functions.
There's one function that defines the module.
And then in there, you just say, here are basically all the things I'm exporting from rust over to
Python.
And those are just the ones you've wrapped with the macro, right?
Mm-hmm.
Yep.
Yeah.
Assuming that writing rust for you is straightforward, this is a really simple addition.
Yeah.
And I think, you know, once, once you have this kind of, you know, there's a little bit of
boilerplate in here, but these macros reduce the boilerplate so much that once you're in
the function, in fact, I think this is like a really cool way to get started with rust because
some of the really steep learning curve in rust is when you're building larger projects and
you have to deal with, you know, strict typing and lifetimes and all these scary things that,
you know, rust can do.
But like you're, you're limited to just a function scope because that's what you're calling from,
from Python.
I think it's a kind of a cool way to get started and just get familiar with the syntax.
Interesting.
Yeah.
And yeah, I think part of the reason these tools are so great is like the whole rust community
puts a lot of value on tooling.
It's like a relatively young language.
So from the start, I think it had this sort of, you know, attitude of, of building good
ergonomics for developers, having good, you know, a single command line tool kind of that
can do all these different things.
And so this group that, that maintains PIO3 has also created this tool called Maturin,
which feels to me a lot like Flit with, you know, like the super lightweight wheel builder.
And so you see here, you just run Maturin develop with this, this project structure in here.
It also has like a Maturin init, I think, which will create a new project for you.
And then you see here, this develop will actually, you know, give you some output, whatever,
because it builds a wheel and then installs it in your virtual environment.
So then you can see here, you just call into that code and then this is, you know, calling
rust code for you already.
Oh, cool.
That's really nice.
So have you built things that you've released or are backed by rust?
Not released, but like I've, I've done, you know, some hobbyist things and then also some
stuff for, for work as well.
Some small pieces of mostly like, you know, I work in, in, I came from a scientific background
and I now work for this, you know, like I said, a portable MRI startup.
So our whole thing is like Python from, from top to bottom, which is really cool.
But for those performance critical numerical computing things, we use a ton of NumPy and
TensorFlow.
But then also, you know, some C extensions.
And I've been just kind of playing around with converting those to rust.
And this rust NumPy is another one of their projects here that makes it really easy to,
you know, write a function that'll take a NumPy array basically and do some calculations on it.
Oh, fantastic.
Rust NumPy.
So is it like an interoperability layer between rust and NumPy?
Yeah.
It pretty much just lets you like take NumPy arrays from Python into your rust functions that
you're creating with PyO3.
And then also, you know, create NumPy arrays and return them from those functions.
And it depends heavily on ND array, which is a pure rust project here for, for, for n dimensional
arrays and computation.
So which probably more analogous to what actually NumPy itself is, but in the rust ecosystem.
Okay.
Very cool.
That's pretty cool.
So why rust over C?
I mean, I think it's, I was mentioning to you before, like, you know, the rust community
is, is really excited about rust.
Like everyone who tries it likes it.
I think it's, you know, topping the charts and, and all these, you know, most loved programming
language surveys and stuff like that from Stack Overflow and everything.
It guarantees, you know, it provides some more stronger guarantees around memory safety,
and while still maintaining high performance.
So that comes at a cost of a little bit of like complexity and learning curve.
Uh, it also happens to, with those memory safety things like come with what they call
fearless concurrency, where the typing system can prevent you from creating race conditions
and actually warn you about them or, you know, fail to compile at compile time.
Uh, and so I find like the trade-offs between, memory safety and performance and ease
of use to be really interesting between rust and Python.
They, they make completely different choices, but like both sort of with similar things in
mind, like Python sacrifices some performance for ease of development, but still wants to
be memory safe, right?
Like if you're getting a seg fault in Python, you're, you're calling into something and doing
something wrong, or it's hard to do that with pure Python code.
Right.
And same is true of rust.
It's like if you're not writing what they call unsafe code, where you have to kind of
wrap it in a block that's actually called unsafe, you shouldn't end up with those
type of problems.
Um, so it's, it's kind of cool to see those two things.
And then when you really do need performance, you can drop into this sort of, you know,
lower level language.
Maybe it's a little bit steeper learning curve, but you'll get the performance and you don't
have to sacrifice that memory safety to get it.
Yeah.
Fantastic.
Brian, you do more C stuff than I do these days.
What do you think?
Um, there's, there's some bottleneck stuff that things that I use Python for that
we do have, like, large amounts of data passing back and forth.
And, and I don't, I mean, normally Python isn't the bottleneck, but sometimes it is.
And, there are cases where I'm, I was just Googling some stuff right now, trying to
figure out if I can apply rust to some of these things.
Cause I actually, I think that's a, what, what, Ashley pointed out is, is fascinating
is this might be a really great way to learn rust is to try to solve one of your bottleneck
problems in Python with, with, with rust.
And, I mean, I'm comfortable with C as well, but there's, even though I've been doing,
using it for decades that I'd rather, if I can use something else, I would like to try.
Something a little more modern.
I totally agree.
And yeah, you're right that, oh, I need to implement these three functions in rust and
then plug them into Python.
That's different than I need to completely learn rust so I can just do this whole project in
rust.
Yeah.
It's a narrow scope, kind of a cool way to, to try to learn something.
So yeah.
And these, these projects have like a ton of great examples.
A few of them have, user guides and stuff like that.
So plenty of material there to get you started.
Nice.
Cool.
Yeah.
Very, very good one.
Thanks, Ashley.
All right.
Have you ever heard that regular expressions are easy?
Yeah.
Not me, but Brian, let me, let me type something.
I'm going to type this.
I'm going to say, okay, I want a, a, a dot plus.
And then I want, I'm going to write the word fun.
I'm going to write, is it backslash D plus?
I don't even know if that's a proper regular expression, but what does it, what does it do?
So I want to introduce you to this site called auto regex.
And this comes to us from Jason, Jason Washburn.
Thank you, Jason, for sending this over.
And the idea is I can put a regex in here and hit go.
Wait.
Oh, hold on.
Let me just do this one.
Do a simple one for a second.
What am I missing here?
I think you have that.
It's backwards.
You're going English.
It's backwards.
Yeah.
So why was it doing that?
That was, yeah.
So first of all, yeah.
Okay.
So let's start with that direction.
That's the default direction it pulls up.
So what I can do is say, I want a regex that, starts with fun, then any number,
write that.
Okay.
And so then it says, oh, you know what?
What you want is carrot fun dot star regex.
Mm-hmm.
Mm.
Is that right?
It's not quite right.
Well, this, this is starts, starts with.
But dot star, I think is any character, right?
Yeah.
Oh, then how about, yeah, it's not perfect.
Then the same numbers.
There you go.
Oh, there you go.
Yeah.
You gotta, it's not perfect.
You gotta understand the English, but I wrote an English sentence to it and it came up with
a regular expression.
It says, disclaimer, all outputs are generated by open AI's GDP three.
Sometimes it makes sense.
Sometimes it doesn't.
But you could also do the reverse.
Yeah.
Let's do the reverse.
All right.
I'm going to make, I'll try to go back to my other one.
So I'll say carrot, then dot plus, and then fun, then backslash.
Let's try that.
And do it in reverse.
So I'm going to run it again.
And you wait for a second.
It says, the regular expression means the string must start with any character.
Then there must be one or more characters before the substring fun.
And then there may be any number of digits after the substring fun.
What do you think about that?
It's not quite right.
I think it only matches one number.
Yeah, maybe it only matches one.
Yeah, yeah.
But still.
The trick for me, too, is that regular expressions are different depending on your platform.
That's what always tricks me up.
I'm like, which ones?
Exactly.
So this is a really cool tool to almost understand regular expressions.
Yeah.
So here's how I would perceive this.
I would say, I wouldn't use this and just go writing all my regular expressions.
But if I'm like, I really don't know how to get a regular expression to do that.
Yeah.
You could go write the English sentence and it might come up with either the right answer
or something close enough that it's like, you know, okay, I see where it's going now.
It's not quite matching, but let me.
I would call this more of a guide or like a signpost along the way, not the tool to build it.
I could see it being super useful with like, I think there's a site, regexer or something
like that, where you can basically write a bunch of test cases and then your regex and
have it run against them all in your browser and see it right there.
And that's like, when I have to write regular expressions, that's how I do it.
Like write a bunch of tests in here and get it to work.
I maybe should be writing the tests in my own code and actually putting them in as tests,
but I do it in this.
But yeah, if you kind of integrate those two tools together, I could see this being
useful.
Okay.
Yeah, for sure.
We take the example one over here and we could put it into this there and see what it says.
So the regex is create a group that is a word.
And then you got a piece, at least some white space there.
What do we get if we run that?
The regular expression matches any word that begins with an uppercase letter.
That's pretty cool.
It does.
Yeah.
Anyway, fun.
People can check it out.
More regex fun.
Thanks Jason for sending that in.
And then Ashley, you also pointed out that Simon Wilson wrote an article on this.
I don't know anything about this.
I just saw this in the notes.
Yeah, he was actually, so it's sort of related because it's GPT-3 and code.
And I mean, even this first one has some regular expression stuff in it, but I guess there's
a mode with GPT-3.
I haven't really played with this, but you can like paste in code and then start asking it
questions about it, like in a sort of conversational manner.
And his blog post, I thought was really cool.
One thing I did see pointed out was similar to what we were just talking about is apparently
the AI model, like the chatbot can be very scarily confident in its answers.
And sometimes it's very confidently wrong.
Like, so you have to not be lulled into the false sense of security there.
Yeah, for sure.
Cool.
You definitely do have to take it with a grain of salt.
All right, Brian, close this out here.
Okay, so Philippe sent us this next topic, and he's working for Python Anywhere.
So anyway, he's one of the insiders.
Anaconda acquires Python Anywhere to expand the Python team collaboration in the cloud.
So not expand the team, expand Python team collaboration.
So this is an interesting, we're linking to an article from Anaconda press release just saying,
yeah, we bought Python Anywhere or, you know, acquired him.
So it's interesting.
I think I'm going to jump to another thing before I guess give my feedback.
One of the things here, it says from the announcement, the acquisition comes on the heels of Anaconda's
release of PyScript, an open source framework for running Python applications with HTML.
We've covered that.
The Python Anywhere acquisition and the development of PyScript are central to Anaconda's focus on
democratizing Python and data science.
So I'm going to be optimistic and not pessimistic on this.
I think hopefully it's a good thing.
And then on the Python Anywhere site blog, there's a FAQ about the acquisition.
And it kind of goes through, like, from the customer standpoint, you know, will this affect
my account?
Will the billing change?
Basically, they're going to keep everything the same, at least for now.
And but hopefully it will expand its services and stuff and make things better.
My personal take on it.
So is that I'm hoping Python Anywhere is a cool idea, but I haven't seen much from them lately.
So I'm hoping this will breathe some life into Python Anywhere.
Yeah, I'm not saying it's dead, but I just it'd be cool to see it grow.
So fun fact.
Talk Python itself started out on Python Anywhere for a month or so because I'm like, I want to
get this up.
And it's kind of complicated to figure out all the Linux and its next stuff.
And it seems real easy to just fire it up over here.
And it worked great for a while.
But eventually moved off as like, you know, started doing 15 terabytes of traffic a month.
Yeah.
So anyway, I'd love to see that coming along.
That seems great.
Let me share also one more other thing.
So on the screen, I have python.org and it shows you a code sample.
Has anyone clicked this little thing up here on the right?
This little shell looking thing?
Yeah, I have before, but I don't remember what it does.
What?
Oh, nice.
So it opens up a Python REPL.
That Python REPL is running on Python Anywhere.
Yeah, and one of the cool things about Python Anywhere is this ability, this ability to just
like run it from any device.
So you can run this from a tablet or a Chromebook or something without installing anything.
And that's neat.
I'd like to see that expand.
Cool idea.
Yeah, it sure is.
And I can see how this pairs with PyScript.
So this is in my browser.
I can just run Python and get a view into a REPL.
But with PyScript, I maybe just move the execution to the front end as well.
So they're kind of related in that regard.
Yeah, there's actually a few things I'd really love to see Python Anywhere change with this
is the currently Python Anywhere doesn't support Python 310.
Hopefully we can get that updated.
And it doesn't it or you can run whiskey apps, but you cannot run ASCII right now.
So no FastAPI on there.
So that's hopefully that will be fixed.
But and then also the free plan doesn't allow you to do Jupyter Notebooks.
And with I'm guessing with Anaconda in there, that might be.
It probably will.
I would suspect it would.
All right.
How about extras?
Got just a couple minutes left for those.
I've got nothing.
Ashley?
Nothing?
I had a couple in here.
Not a whole lot to say about them, but that's, I guess, why they're extras.
Pep691.
There's a new JSON based simple API for PyPI.
So more PyPI news there.
This is like for tools like pip, I guess, that are sort of, you know, indexing packages
and stuff like that or going on a search for packages.
Like, we'll now be able to parse JSON instead of, I guess, up until now they've been parsing
HTML, which was a surprise to me.
You can go to somewhere.
Yeah.
You go somewhere on pypi.org slash something, something simple.
And you just get a wall of links and you get like 350,000 links, which is not an ideal
way to like, it doesn't seem like the best.
Yeah.
It's cool because I guess it can be like, it can serve those as static files, right?
So that's why like, instead of having, you know, dynamic web app that you have to worry
about loading all this stuff, it's just like an Nginx server pointed at a huge directory.
But this allows those same servers, I guess, to serve JSON instead of HTML.
It's neat.
Yeah, great.
And then rich codecs is a tool for like automatically creating these terminal screenshots from stuff
in your documentation.
Mostly I thought we can't have a Python bytes episode without something related to rich,
right?
So.
That's right.
Check this out.
If you've got, if you're using rich or, and want to, you know, make some screenshots that
stay up to date with your code.
Yeah.
Some color coded code blocks in your, your markdown.
Yeah, for sure.
Very nice.
Yeah.
All right.
I just have a quick one for an extra here.
There's an article on DevJobs Scanner, the top eight most in demand programming languages.
So we've got JavaScript, TypeScript, that's number one, but Python number two.
I bring this up because I was doing a live stream on Talk Python and somebody came along
and said, hey, should I still be learning Python?
I heard that it's really hard to get a job and there's not a lot of interest in that.
So yeah.
Well, anyway, I'm not sure what else you choose.
And again, this JavaScript stuff, it's like, it's like being a CSS, full stack CSS developer.
You might have to have JavaScript skills to do Python stuff or to do ASP.NET or to do
whatever else, right?
Like there's a, JavaScript is unique in the sense that a lot of times it's paired with other
things, whereas those other things are often more standalone.
You know what I mean?
So maybe the fact that JavaScript is up there because like every other language below it also
needs JavaScript plus, I'm not exactly sure what the metric is here.
If this is like how you, how you pull that out.
But anyway, take it with a bit of grain of salt, but I think this is pretty good.
All right.
Are you all ready for a joke?
Because Brian, you have started something.
I have.
Okay.
You have.
So remember we had the, I don't remember what the exact topic was, but we talked about,
we talked about this, this, oh, this was, what is the junior dev see themselves
in five years and what is the senior dev?
So this woman, Neda, she has just an amazing set of jokes.
And so you're going to be hearing more than one of these, but let's, let's, let's look at
this one.
They're so good.
I'm obviously linking to the show notes.
So here's an example of people.
I think what the story is here is these two women, they live in this apartment complex and
they, they're in an elevator with some of their neighbors.
And there's this, this older woman says, so what do you girls do for a living?
One of the women says, ah, I'm an architect.
Oh, and Neda, she's a programmer.
And you just see the crap emoji.
Like, oh no.
Later on, Neda receives the knock at the door.
And this old woman is like, there's a problem with my phone.
And then there's like another, another guy with a beard that shows up with just showing
the laptop to her.
And then there's like a whole line of people with like printers and all kinds of stuff.
Just basically, oh, you're our tech support now.
I, I, I so have lived this.
Yeah.
I have to actually, oh, go ahead.
Sorry.
Yeah.
No, Ashley.
Do you get this?
Uh, not so much anymore, I guess.
But I, this was definitely like my experience in the dorms.
I remember.
Um, well, I mean, like now you could say I work on an MRI machines and nobody will ask you
that.
They don't want you to fix it.
They don't have one.
So no, they'll, they'll start, start telling you their medical problems and stuff like that.
Yeah.
So my first job out of college was with HP.
Uh, I was working with satellite test systems.
Um, but, everybody just heard HP and wanted me to figure out how to configure their computer
or their printer.
Uh, can you get my printer on my network?
Brian.
And it's really gotten slow lately.
I get a lot of pop-ups.
Like, no, I don't, I don't know how to fix that.
On purpose.
I don't know how to fix that.
Awesome.
Well, that's all I got, Brian.
Okay.
Well, thanks.
Thanks for the joke.
I love that one.
Um, we could have more of these.
Yeah.
And, thanks Ashley for joining us.
And, and I really appreciate you talking about, the, the rust, rust Python stuff.
That's, that's, we've been curious about that.
Oh, yeah.
Really happy to be here.
Thanks for having me on.
All right.
Well, bye everybody.