Python Bytes - #393 Dare enter the Bash dungeon?
Episode Date: July 23, 2024Topics covered in this episode: Marimo: “Future of Notebooks” pytest 8.3.0 & 8.3.1 are out Python Language Summit 2024 bash-dungeon Extras Joke See the full show notes for this episode o...n the website at pythonbytes.fm/393
Transcript
Discussion (0)
Hello and welcome to Python Bytes where we deliver Python news and headlines directly
to your earbuds. This is episode 393 recorded July 23rd and I am Brian Ocken.
And I'm Michael Kennedy.
If you'd like to watch the show live you can catch us you can go to pythonbytes.fm
slash live and you can watch it live. We'd love to have you on board usually at specific time
Tuesdays at 10 a. Sometimes it changes.
And if you'd like to connect with us or offer if you've got a topic that you'd like to have us
cover, you can find out how to contact us on pythonbytes.fm. Or you can follow all of us on
Mastodon and Fastodon. So check out those links in the show notes. Yeah, should we jump in?
Let's jump.
I think the first thing I want to talk about comes to us from Matt Wilkie. And so Matt Wilkie suggested this cool project called Marimo. Have you heard of it? No. Think Jupiter,
as in Jupiter notebooks. I feel like I'm on a vibe lately. Last time I talked about Saturn,
the Mac desktop application
that was like a minimalist Jupyter notebook.
This is not that.
This is what's called a reactive notebook.
And this actually solves one of the big pet peeves of mine
about notebooks.
And notebooks are basically human-selected go-to statements,
which is a little bit sus in the end. I mean,
it's great, but I can go and say, I can go and run cell one, two, three, four, go back and edit
cell two, but not run it, edit cell three, and then run cell three. And then you look at it
and you have cell one, which ran cell two, which has data and it never ran. And then old three, four, five, and then new three.
How do you visually know about that?
I mean, I guess there's a little number on the side that says one, two, three,
four, five, right.
As you go back up.
But the, the ones that are not the latest numbers, those are not
knowable effectively to you.
Right.
And so this concept of a reactive notebook is it understands the relationships of
the cells and the pieces of data in the cells. And so probably the best way here is to look at
an example. Okay. If you go and look, let's see this one, I'm going to see, come on, show me
somewhere. So for example, if I go, I don't know where I would find a good example for you. Anyway,
if I go and say in that cell three there,
yeah, here we go.
They've got a cool example on their page.
If you go in there and you make some kind of change to a data cell, for example,
if you say the number of items is 100
and then you print out that number of items says,
oh, sorry, a thousand,
then it'll say, well, it's a thousand.
But if you go and edit, say cell three,
which then cell four is using some of the outputs from
and you make changes
to it, it knows that and it automatically re-renders and re-executes that Python code
that is in there.
And then you even have UI widgets, which you can put in and, you know, slide them around
and every cell that depends upon that slider bound to that piece of data runs.
Oh, that's cool.
That's how I want it to work anyway.
Yeah.
Exactly.
Yeah.
Another big change here, there's some other things that are worth talking about here,
is it's also Git-friendly in the sense that the notebook format,
so the notebook format for Jupyter, just keep contrasting it, right,
is a JSON file that has the cell definition and then the cell output embedded in the JSON file.
And specifically because of the cell output, it can get pretty ugly in Git if you're not
careful about clearing out the cell output every time, right?
Because if it just uses something like call an API and get the current data and that data
changes, the output changes, and then you get weird merge conflicts like this graph
conflicted with the old graph.
You're like, that's just the output.
What is going on here, right?
Yeah.
So this is a pure Python.
The notebook itself is stored as a pure Python thing
that when you put into GitHub or any form of Git, honestly,
it diffs like Python, right?
So, yeah, Python first assign, reproducible by default
because they're always executed in a deterministic order
without hidden state.
The editor comes with GitHub Copilot autocomplete.
Remember, get JupyterLab and Jupyter Notebooks.
In order to get the autocomplete to render, you've got to hit like a cord of keys.
It's not just typing that'll make it come up.
So, very cool.
This one's for you, Brian.
Vim key bindings.
Yay.
Yeah, yeah, NFVS code extension.
So anyway, I think this is pretty neat.
And it is open source under the Apache 2 license.
It has 5.5 thousand stars.
I don't mean to sound super negative on notebooks.
I think they've been transformative for data science but i do think some of the drawbacks like i laid out at the beginning of basically like human selected
go-to statements is really tricky and i definitely like the idea of a little bit more cohesion
between the pieces yeah and also just uh different different takes on stuff that people build on each
other i'm sure that this yeah um if some of these ideas take off, maybe
Jupyter will pick them up. Sure. And Christopher out there does have a valid point. Wonder how it
handles computationally heavy stuff. Sometimes you don't want a cell to rerun quite yet, right?
You know, if it takes 10 seconds for something to re-render, re-update, and you're just trying
to edit that code, you know, but I don't believe it re-renders until you render the cell that affects it but i mean it
still might be valid there's there might be times for for both behaviors i i can imagine like a time
when though when like if you're doing a demo where having it redo it automatically would be awesome
so yeah yeah yeah anyway take it or leave it but there it is marimo cool reactive notebook for python
um i want to talk about change a little bit um mostly a change log so uh wait that wasn't really
a good transition but uh um yeah whatever pi test has a new update yay um so what i'm so pytest updates uh fairly regularly anyway but i'm really excited
about 8.3 that that came out um just the other day because um there was a flag that i worked on
so there was in in in 8.0 there was in the 8.0 release and i don't even remember when that was
uh there was a change that i helped put in place that was to turn on tracebacks for X fails. So this is sort of inside baseball stuff. But if you expect a test
to fail, it normally didn't produce a traceback. But I added or I and a few other people worked on
a feature to turn on tracebacks if you had the dash rx uh flag on which means extra reporting for x fails
i thought that made sense but it turned out that broke a whole bunch of people sorry um but it's
fixed now again it's back to the normal behavior by default however now there's a new flag called
x fail dash tb that will um turn those on so it turns on independent of the dash RX flag, those are separate now. So I like the way this is here.
The other thing that I want to talk about so that that's so
that's one of the features. There's a bunch of new stuff.
Also, there's a change to keywords and markers. And this
is a little hard to quite get your head around except for if
you'd look at an example.
So the idea is that you used to be able to do a marker,
run a marker test or a marked test,
but you couldn't, sometimes markers have parameters to them and you couldn't, but the, now basically just,
the gist is now if there's a parameterized marker,
you can specify that.
And there's a few, not all types, but a bunch of types are supported.
So I think we've got ints, strings, bulls, and none.
So cool.
Yeah, very cool.
That's a cool feature.
And then the no-fold skipped.
So apparently this was something that I didn't think I needed,
but now that I see it, I really am happy about it.
The idea was when you used to skip a test,
it would tell you the file and line number.
I guess I didn't realize that,
but it wouldn't in the reporting,
but short summary,
but wouldn't tell you the name of the test.
And now you can turn on a no-fold
and it'll show you, I guess, more information and a bunch of other features.
I'm thinking a lot of this stuff came out of the – there was a recent PyTest sprint that happened in Austria,
and I'm thinking maybe a lot of these features came out of there.
So cool.
Cool progress on PyTest.
That's some big news.
Very big news.
Love to see it moving along.
Yeah. Would you see it moving along.
Yeah.
Would you say it's the de facto testing framework for Python,
or are you still all about unit tests?
I'm all about PyTest.
I don't hear much.
There are some other fun ones coming up that I've looked at a little bit,
but PyTest is the big behemoth now.
Yeah, for sure. It's not a big piece of
code it's just most people are using it as far as i can tell so yes indeed awesome all right first
of all bit of real-time follow-up chris answering his own questions ah looking at the docs there's
a way to mark sales as stale if they're too expensive oh cool nice yeah excellent now let's
move on to pittsburgh austria where we can talk about the Python Language Summit 2024. This happened at PyCon 2024 in the US. And this happens every year. It occurs just before PyCon US happens because this is the biggest gathering of core devs and other core dev influencers, if you will. People who have projects that influence Python significantly
like Pydantic or FastAPI have, I believe, in the past.
So there were 45 people in attendance,
which is a lot, right?
Yeah.
I think of the core devs, that's quite a few.
So what was covered?
So this year, you previously talked about
the calendar version.
So they discussed whether, whether or not, uh, they should adopt
calendar version name for Python.
And it actually had a more pushback than maybe you would imagine basically around
like, Hey, there's a lot of systems that read the version and make meaning out of
it already and they got, might get freaked out, I think is one of the takeaways.
But my, my only push
back would be come on use the whole use the whole uh year the 2024 not just 24 anyway but i don't
it doesn't affect me too much one way or the other i'll be happy with whatever it goes it's we're
already incrementing by year on you know 3 13 3, 15. If we just skip a few and they keep incrementing by year,
I don't know, it's a huge difference.
Then we have Python's security model
after the XZ-utils backdoor.
That was one of the, wow, we dodged a huge bullet.
That was a multi-year campaign to get into the XZ backdoor,
into the XZ utility for Linux.
I don't know if you'll remember hearing us talk about that,
but basically they berated the beleaguered maintainer
of this really important tool
until they let them become a core contributor.
And that core contributor turned out to be a malicious actor.
So pretty insane.
Yeah, it's crazy.
Yeah, so Pablo Galindo Salgado
gave a talk about Python security model after that.
Like, what are we going to do about these kinds of things?
There's also a talk on native interface and limited C APIs.
We had free-threaded ecosystems on how to talk about that and how to consider this.
Remember, the free-threaded Python is coming in 3.13 as a custom build output, not by default.
And we'll see how that goes.
Basically it's, it's got a big asterisk by the accepted on the pep saying, uh, we
reserve the right to unaccept this space.
Another one that is super exciting for me is Python on mobile by Malcolm Smith.
And talked about how Python is, is basically the foundations of it being built for Mac OS
and Android ARM 64 and x86 64, almost there.
They've got BuildBot coming along and how they're making this work.
But in Python, they've got tier three support accepted for making sure that CPython works on iOS and Android.
And now it's up to, well, what are we going to do about it?
Which I think would be awesome to be able to write mobile apps in Python, right?
Yeah.
So the foundations are coming along.
Yeah, this is all based on the Beware project, right?
So Beware, Toga, those types of things.
And I'll let it begin.
Come on, that would be really, really great to be able to have some kind of cool UI framework
that lets us publish native
or any form of apps written in Python
that publish as something other than a webpage to mobile.
Keeping with the awesome,
but also controversial a little bit is Pyreple.
Pyreple is the, when you type Python,
the REPL that you get from PyPy, P-Y-P-Y. And
it's, we've talked about this before. There's a new REPL for Python, regular Python, and they're
borrowing that one, which is a lot nicer, has a better editing of things like blocks of code,
instead of just want to go back one line at a time for, you know, an embedded if statement or
an indented if statement
something weird like that a lot nicer the the uncertainty was at the time at least it didn't
work on windows so a lot of people are like what it's going to be really weird to ship this and
tell people to use it but then if they're on windows they can't use it so one of the big
efforts is to get it working on the new windows terminal not the old cmd.exe crummy thing
but the new windows terminal people should be using anyway but it's still going to cause probably
some some uh confusion i guess should we make pdb better honestly i don't know limiting yield and
async generators also an interesting talk annotations as transforms and some lightning talks by some folks, for example, unsupported build warnings, rust
in Python, uh, formalizing the PEP prototype by Emily Morehouse, Python on iOS.
Finally.
Now this sounds like what I talked about with the beware and mobile.
I don't believe it is.
I think this is more of, um, how do we get basically the Python REPL running on iOS and
Android? more of how do we get basically the Python REPL running on iOS and Android, if I understand it correctly.
There's things like Pythonista and others that let you run
basically limited run of Python.
But I might be misunderstanding what I was about.
Making a search more meaningful and efficient data sharing
between subinterpreters, which is actually what is I think most exciting,
right? Sub interpreters open up possibility of even without free threaded Python, basically
multi threaded Python computationally and but then if you can't share any data, then it gets a little
bit funky. So this talks about things like well, what if you had the ability of immutable data
shared across things like that, right? So anyway, very cool. People can check all of that out. All of
these are written up with details and I believe it was Seth Michael. Yeah. Seth Larson wrote all
these articles. So thank you, Seth, as well. Yeah. Great. Good, good length. I mean, enough
detail to really understand what's going on, but not so much that it's overwhelming. You can really
catch up really quickly on some of these topics.
That's pretty cool.
Yeah, indeed.
Over to you.
It's not like just getting into a dungeon, which would be bad.
No, that would be very bad.
How would you get out of the dungeon?
Well, you might want to check out Bash Dungeon if you wanted to get out of it. If it was like a Linux dungeon?
A Linux dungeon, yeah. wanted to get out of if it was like a linux dungeon linux dungeon yeah so um uh i can't
remember where i saw this but um i came across a project called bash dungeon um uh it's on github
we got a link to it and the apparently it's built off a couple other ones there was a dungeons and
directories and a bash crawl um but i'm i'm looking at this it's a work in progress the idea is it's a game
that's intended um to teach new years new users how to use their shell in a fun and interactive
way and um there's a there's some various like how to play it you can get there's like a get
pod account or docker that's weird that the way i recommend is you can just
you can just clone the thing so and it has instructions on that too just clone the repo
and see if you can play it as docker um or through docker yeah so um so i'm just gonna cheat and look
at the repo here so uh you when you so the instructions are to CD into bash
dungeon and then do an LS, then CD into enter, and then LS and
then cat for parchment, cat the parchment, so you're reading the
parchment. So yeah, let's follow it a little bit. So I'm going to
go in to go into enter, and there's a parchment. And then
when you do a cat, you cat is how to like read a text file or just
print the whole thing on your screen so it has this little parchment with like oh here's what
you should do you could use ls and and it recommends doing ls-f uh to try to teach you
about that um and then when you uh you you look look around right away and the only thing you've
got is a corridor so if if you CD into the corridor,
then there's a couple more parchments that you can read.
There's a spell you can cast that the spell is...
The spell.
A hint that says, hey, you can use head dash end one
to look at a file, see at the top.
And if it happens to be a script, it might be runnable
with a warning that in this this repository,
you can trust it, but you should not just run random scripts that you find good warning.
But then if you cast this, if the there's a chest that has a cast, and then it always it
talk teaches a bunch of different things. One of the cool things I like it was that is the file,
file spell, which will tell you what kind of what type it, is the file spell,
which will tell you what type of file it is.
Actually, I totally forgot about file.
So that's why I think this is fun.
If you've ever done dungeon crawler type games,
this is kind of a neat way to brush up on your bash skills
or learn them anew if you're new to bash and it's kind of
it's kind of a fun way to to present this information so it's actually super fun and
since i've been doing a lot with docker i just literally copy and paste and within about like
15 seconds of seeing it could run in docker i was already like corridor insane so fun there's some
some cool stuff like the chest,
for instance.
So in this first chamber,
there's nothing there or the,
the corridor,
there's nothing until you,
um,
open the chest and it tell the LP.
It says,
find an amulet of color and it,
uh,
to use it,
attach it to your torch with dash dash color equals always.
So basically it's telling you to do color with your LS and teaches about aliases.
Yeah, yeah, yeah.
And then hidden, so that's what's printing out.
But hidden, there's a spoiler alert, it's going to move a hidden directory to non-hidden.
So a first chamber was dot and it moves it to.
Yeah.
I love it.
I love it.
Mark out in the audience wonders if at the end they will give
you tree as a map spell i love it oh i bet mark has played some muds it's a multi-user dungeon
i used to play i used to play some spend a lot of time over there and this reminds me of that
a little bit and it's making me smile yeah shadow's edge i've never done multi-user dungeons but i totally was doing lots of dungeons
back in my um trs 80 days so yeah i remember the dial up you'd be like oh yeah you'd hear
maybe like a 30 32k 36k connection oh this would be a good day remember that 9600 business i won't
be able to read the text that's coming down. Yeah, I love that stuff. Yeah, anyway.
Yeah, this is actually really, really cool.
Really cute.
All right, those are our items.
I want to remind everybody that we are sponsored this week by ourselves.
So please, if you enjoyed the show, check out...
Start with this PyTest stuff.
No, check out Michael's TalkPython training.
If you go to pythontest.com,
there's PyTest trainings as well.
And you can have links to my PyTest book.
A new shorter PyTest training coming up soon.
But all sorts of, there's always exciting new courses
on TalkPython training.
So check that out.
Yeah, indeed.
Thanks. Yeah, check them all out. Do you have any extra stuff? So check that out. Yeah, indeed. Thanks.
Yeah, check them all out.
Do you have any extra stuff?
Links to that stuff.
I do.
And links to all those things you mentioned
are at the top of the show notes.
Yeah.
Yes.
So how about some drama?
Don't we always love some drama, Brian?
Yeah.
So David, the data script author over on Fostedon,
Mastodon, happens to be on Fostedon,
sent us a post, mentioned, said, hey, thoughts.
And the thoughts are on a discuss over on python.org
that says PySimple GUI now requires a paid license.
Opinions.
So there's this project called PySimple GUI,
and I actually invited them to be on TalkPython,
but they never got back to me.
So I guess I'm feeling better about that.
Anyway, the post says a rather popular GUI package.
It's like a real simple way to specify like a quick way to specify
a simple GUI in Python.
Yeah.
Yeah.
Recently changed this policy now requires a paid license to go forward.
You're doing the hobby stuff you you can do it for free,
but if it's commercial, you got to pay for it.
I don't know a whole lot of the details about it,
but went so far as to go back and remove the older commits that had the older codes.
You can't even roll back the repository to the code.
Anyway, it's interesting.
And I think it's just,
if you're thinking about an open source project,
you're thinking about maybe charging for it. I'm certainly not against that. Like you put in a lot of effort, it's your project. If that's what you want to do to try to make a living from it from other people and then it got switched to switch
to commercial out of the blue with all those old commits getting blown away and stuff so anyway uh
people have thoughts they can check out this conversation that's interesting yeah yeah uh
also just two other really quick things here is the the code in a castle in tususcany thing still has some spots available.
So people can check that out if they want to learn Python, FastAPI,
basically build a high-performance web app in Python,
using some database stuff and PyTantik and all sorts of fun things,
do load testing, but do that in the first half of the day.
In the second half of the day, go to vineyards and other excursions in Tuscany with me and a bunch of other, I thought, enthusiasts.
Check that out. And I just realized
as we were talking, as I was talking about that
Marimo thing, it's real similar to Shiny
for Python as well, which is also one of
these reactive web dashboards.
So we have a 100%
free, no strings attached, reactive
web dashboards with Shiny.
Of course, you can check out over at TalkPython.
So people can check that out in the show notes.
And yeah, like I said, it's free.
So if it sounds interesting, give it a try.
How about you?
A few extras.
Last week, we mentioned Python 3.13 Beta 3.
Now Python 3.13 Beta 4 is out,
came out a couple of days after we talked about 3.
But this is, the Beta four is the final beta,
last chance for bug fixes.
So please, if you have a package
that should be tested against new Pythons,
which means if you have an open source package,
Python package, you should go test it.
Test it against 3.13.
Make sure that it works.
So there's that.
Also, when I was there,
there was a pop-up that I closed
talking about new guidelines.
So there's, I think these are new,
but there's, if you want to hang out
on discuss.python.org,
please check out the community guidelines.
These are some pretty easy to read,
pretty standard stuff.
And if you're thinking,
why do we need new community guidelines?
Or why are we emphasizing this?
There was some drama in the Python world a little bit a couple weeks ago.
And there's an article called Inclusive Communications Expectations in Python Spaces put out by the steering council.
I think that's who put that. in Python spaces put out by the steering council.
I think that's who put that. Yeah, the steering council does not endorse
bad behavior, essentially.
So decent read.
So if you want to talk about,
look about how to be a good citizen in Python,
check this out.
Last thing I wanted to bring up is
we've talked about security in web browsers and stuff before and uh there was
some news i noticed on forbes the other day google confirms bad news for three billion chrome users
what's the bad news um they had they were trying to do do i like for four years or something like
that talking about killing um tracking cookies but they're not
gonna kill those anymore um that that effort has stopped um a quick summary maybe maybe there's
more details here sure but um yeah it's a it's just i don't think i don't think it's going
anywhere chrome likes to make i love it so actually i think the title is is you know 180 degrees wrong I think this is
good news for Chrome users and for people on the internet all right because the alternative was
our web browsers will have baked in fracking that is part of the execution of your environment that
it tracks you and has an ad engine that lets it think about you and then apply these for, and with, with
third-party cookies, we have tools that are not in control of Google or Chrome that will
basically neutralize the vast majority of them, right?
Next DNS, iHole, ad blockers, Vivaldi, or others, you know, other things that are more
private-focused browsers.
And yeah, to me i i think we've
talked about this before brian we even talked about it before we hit record i think there's a
fundamentally wrong assumption or an axiom of what google believes the internet should be i think
google believes the internet should be it must be that you can track people on the internet let's do
that in a nice way like no i know neither of us
think that the the first assumption should be of course you have to track people how can we do that
nicely like wait why do we have to of course you have to be able to track people no you don't you
have ads based on the content of the site for example you know or the content of the article
it doesn't have to be michael viewed this thing then that thing then that thing and so now now we're going to sell him shoes while he's trying to find
hardware supplies or who knows whatever right yeah i mean we already have like even without
i've done a little bit of work on i know you have too about how do you do like could you do
targeted ads without tracking um and of course you can um there's there based on i don't know how it does it
but based on the ip address or whatever um that's that's a little creepy but basically even regions
you can you can find out essentially um like based on the content but also based on like you know
what country is the person in that's i'm okay with people knowing what country i live in or
you know which part of the country even.
So that, you know, maybe there's a festival in Oregon that I might want to see.
Throw me an ad for that.
That's fine.
But like, you don't need to track my personal stuff.
No.
Anyway.
Yep.
Indeed, indeed.
Real quick, real time follow up.
Mark also says, Ari, I said, well, GUI, it wasn't exactly open source.
It was more
source open before this change it the project had a warning that it does not accept user submitted
code nor user submitted documentation so it's more source open anyway and with that don't
yeah exactly i want to help yeah no um all right uh i want to go over to something funny. I sure do.
Okay.
I got a few things.
Anyway, so let's go to, there was a, I got this from, who did I get this from?
VM Bresser posted this on Mastodon, so I saw it. So this is a SMBC Saturday Saturday morning breakfast cereal cartoon
there's a lot of textures so you know bear with me a woman looking at looks like a like a I don't
know desk with a microphone maybe she's being anyway looks almost like a court situation kinda
and she says ladies and gentlemen of congress oh she's speaking to
congress ladies and gentlemen of congress i have bad economic news historically it has been very
hard to measure whether or not our economy offers many good investment opportunities however new
methods have been discovered economists can now determine how many good opportunities exist by seeing how much money we can raise
for transparently idiotic startups this is actually a decent idea um and uh one of the
congresspersons says how bad is it she says well as of this morning i myself secured 40 million
dollars in series a funding for this balloon which I have written AI with it on it with
a Sharpie.
Amazing.
Wow.
Wow.
Amazing.
When is the series B and may God have mercy on us all.
I think that's a positive indicator, although it could be the sign of an impending crash,
but I'm there's so many businesses that are basically rappers around chat gpt and they're
like we're revolutionizing the world if not you're just until the api changes yeah or the cost changes
or it's 1999 all over again yeah cue cue the prince and uh will smith songs um the uh last
thing i wanted to bring up was um pie jokes pie jokes uh has uh we've we've used jokes
from pie jokes before uh last release was in 2019 but there was just a new release this month
go back install pie jokes yeah so um so pie jokes you can just pip install it uh and you can run pie
jokes uh i i pulled out a few that i liked if at at first you don't succeed, call it version 1.0.
Actually, probably 0.5.
Anyway.
Okay, I'll skip one.
Oh, that's pretty good though.
A product manager walks into a bar, asks for a drink.
The bartender says no, but he'll consider adding it later.
Okay, the last one.
Triumphantly, Beth removed Python 2.7
from her server in the year 2030.
Finally, she said with glee,
only to see the announcement for Python 4.4.1.
No.
No.
Although, yeah, so 2030, if we went to Calver,
that would just be Python 3.30.
See, Calver's nice.
Yes, it is nice.
Yeah.
You would, you could understand.
Yeah.
I do think it's good that it links more, more clearly back to the year.
Like how long ago that was that?
That's right.
Yeah.
But like what, what will we be at in three 20, 30 now we'd have to do what?
Six plus whatever it is.
Yeah.
It's it's difficult now.
So anyway, so well, uh, one more, um, Python
bytes in the bag. Thanks Michael for a wonderful time. Yeah. Thanks as always. Lots of fun.
All right. And thank you to everyone for listening. See y'all later. Bye.