- Podcasts
- Python Bytes
- #315 Some Stickers!
About this episodeTopics covered in this episode: Jupyter Server 2.0 is released! Converting to pyproject.toml aws-lambda-powertools-python How to create a…
- Jupyter Server 2.0 is released!
- Converting to pyproject.toml
- aws-lambda-powertools-python
- How to create a self updating GitHub Readme
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#315 Some Stickers!
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 315, recorded December 20, 2022, almost the end of the year. I am Brian Okken. I'm Michael Kennedy. It is almost the end of the year. Are you guys, are you ready for Christmas and everything?
Yeah, starting to think about Christmas, maybe try to do some skiing. You know, it's getting cold and it's snowing in the mountains around here, so getting there. Why don't you kick us off with our first story? Let's go. Let's talk some Jupyter Server. So this is an announcement by Zach Saylor, and it says Jupyter Server 2.0 is released.
Now we know what Jupyter is. We know what Jupyter Notebooks are. We know what Jupyter Lab is. Well, Jupyter Server is the core web server that powers those things, right? So when you pull up a Jupyter Lab or Jupyter Notebook, you're talking to a server. Oftentimes that's a localhost little thing running, but other times it's a centralized server that's set up for like students or a research group, where it's set up on a supercomputer near a bunch of data that, you know, you log into it.
So one of them is a new identity API. One of the farther looking out features of Jupyter Server that they're hoping to bring is like a Google Docs-like experience. So real-time collaboration experiences. There are some making them better. And around this, having multiple people working on a single notebook, you need to have a good way to work with identity.
Oh, neat. Yeah. Related to that, you have authorization. So once you know who you are, what can you do? Enabling collaboration on a notebook shouldn't just mean you have access to everything on the server or nothing on the server, but you maybe have access to these notebooks, but not those notebooks.
Or maybe you can read that notebook and not write to it. So there's this new authorization API that allows you to share certain notebooks with certain people, even if they have access to the server. So that's pretty cool. Again, with the collaboration stuff, there's a new event system API coming along, and they created this package called Jupyter Events that allows for JSON-based event-driven system over here.
In Jupyter Lab, you can open up a terminal. Now, this terminal service is a server extension, and it can be optionally disabled because it's an extension, which is cool. And Brian, the last one for you. They say, as we work to increase our test coverage to 80%, major thank you to Steve Sylvester, We built a handy set of pytest fixtures that can benefit Jupyter developers and extension authors.
Time flies. We were talking about automatically converting stuff, like having other programs convert your Python code, modify your code, and all the different ways you can do that. And one of the things I said was, it'd be cool if we had some ways to convert from setup.py to setup.cfg, or from setup systems to pyproject.toml.
And so, of course, lots of people reached out to me and said, there's already some ways that you should take a look at. So thank you, Christian Klaus and Brian Skin and others for reaching out and letting me know. First one, actually, the main thing I wanted to talk about was a thing called any to tommel.
So this is a project that takes... It converts... It attempts to convert any files or CFG files to tommel. They say it's experimental. So what is... I thought I was looking at setup.py files. Well, actually, a lot of large projects are not just setup.py. They've moved a lot of the settings from setup.py to setup.cfg.
There's a couple versions of it. One of the versions is light, and it's got light, L-I-T-E, and full. And the light version has less calories. No. The light version creates a tommel file, but the full version will try to get your comments over, too. So convert your comments into tommel-compliant comments.
That's pretty neat. So I'd definitely try that. What did I? I didn't... I don't think I tried this. I didn't try this, but it looks pretty fun. So a way to automatically change that. So it'd be fun to grab that. And I've heard from people that they have used this to convert their project, at least the initial batch.
at least Christian mentioned that they needed to clean it up a bit afterwards. So one of the tools they used was a thing called PyProject-Format. And what this does is... And I did try this. It's pretty neat. It takes like your... If you've got any PyProject.tommel file, and it converts it to a known way to set it up.
Because one of the things it did, which I didn't expect it to, was it replaced... It took the name of my project and replaced dashes with underscores. And I know that like a library, you can't have a dash in the thing you're importing. But the name of the project that is where it shows up on PyPI and everywhere else, it can have a dash in it.
Something happened on my computer. Anyway, it just validates to make sure everything's fine. And I ran it on a couple of projects and nothing happened. I'm like, oh, it must be good. So I inserted some errors just to see what would happen. And it's pretty terse. It pretty much just says like, there's an error on this line at this column or something.
So it'll still helpful. You can go count and figure out where the project might be. But kind of a neat validator. But for validation, and I'm not sure what I was checking, but it says it's JSON schema definition defined driven. So you could probably check it out. Interesting. It probably converts it to JSON and then runs through JSON schema or something like that.
Oh, you think so? Maybe. Yeah, probably. Might. One of the things that I wanted to bring up when validating TOML files and projects is don't forget talks. Using talks to go ahead and what the default of talks, you can use it for lots of stuff. But the default works great for me for this, which is to take your project, build it, put it in a virtual environment and install it there.
I'm starting to do more with pyproject.toml. It's nice. And it's good. Hatch and HatchLeen and pyproject.toml. Oh, yeah. Hatch is fun. So Hatch and HatchLeen. It sure is. All right. Well, quick word from our sponsor before we move on, do you think? Yeah, it sounds great. So this episode of Python Bytes is brought to you by Microsoft for Startups.
Unlike others in the industry, Microsoft for Startups Founders Hub doesn't require startups to be investor backed or third party validated to participate. Founders Hub is truly open to all. So what do you get? You get to speed up development with free access to GitHub and Microsoft Cloud with the ability to unlock credits over time.
You'll have access to their mentorship network, giving you access to a pool of hundreds of mentors across a range of disciplines, across areas like idea validation, fundraising, management, coaching, sales, marketing, as well as specific technical stress points. You'll be able to book a one-on-one meeting with the mentors, many of whom are former founders themselves.
Make your ideas a reality today with the critical support you'll get from Microsoft for Startup Founders Hub. To join the program, visit pythonbytes.fm/foundershub 2022. Or, of course, go to your show notes for this episode and click the link there. Indeed. Thanks to Microsoft for supporting our show.
Very cool program. All right. Let's talk about the cloud. We're going to round this whole episode out with a little bit of talk about the cloud as well. Specifically, though, serverless and functions. Brian, have you done anything with functions like AWS Lambda or DigitalOcean or any of those Azure functions?
But something that requires interaction from many, many different geographical locations. And one thing that's really cool about Lambda and serverless, these functions, is you only pay while they're running. And so if you want to say, I want to have 20 different locations in which I can, like geolocations throughout the world, I could do certain things, but I'm not going to do them very often.
So I present to you AWS Lambda Power Tools Python, a suite of utilities for AWS Lambda functions that makes distributed tracing, structured logging, custom metrics, and idempotency, and many leading best practices easier. And it is all based on Python. So you can just write your Python code and start working with this API.
This one came to us from, let me make sure I got this right, via Mark Pender. So thanks, Mark, for sending this in. It also happens to be available in Java, TypeScript, and .NET. But if you come down and look at the features, there's all sorts of different bits of Python code and classes or modules that you can use that do things like distributed tracing, right?
Use this Pydantic for data parsing. But there's just a bunch of built-in parts of this library that you can use within your functions, your serverless functions, to make it better. So it's got tracing, which includes decorators and utilities to trace Lambda functions, both synchronous and asynchronous.
There you go. Structured logging, metrics that asynchronously go up to CloudWatch. Remember, this is AWS. Event handlers for putting stuff over into GraphQL. You can build your own middleware, like something that runs before and after the request. That's really, really handy. Like only certain types of clients should be able to call this over the web.
Batch processing, typing, validation, a bunch of other stuff. Parsing, streaming. So you can actually set it up to, instead of loading some massive data set into your function, you can just stream that data in and process it as it goes. So there's some tutorials and there's some example applications.
There's a serverless shopping cart, a serverless airline. That's a pretty big one. Serverless e-commerce platform and some graph. Serverless, just let me just say this. It's not a joke. It's serious. Serverless GraphQL nanny booking API. There it is. Sure. Why not? So anyway, if people are doing serverless, especially if they're doing AWS Lambda, this might be cool.
John, she in the audience points out that Zappa works great for quickly in deploying Flask apps as, yeah. So if you look at AWS Zappo Lambda Flask, that's probably a sufficient search. Right. That's a pretty cool project. I believe we covered that way, way back in the day. So basically it turns your Flask routes into serverless function calls as well.
So anyway, here's some nice tools. I suspect you could probably put those together as well, right? Like your tracing and logging, you could probably still put inside of Zappo. But I haven't tried that combination. Cool. Neat. Well, I'm looking forward to whatever secret project. There's like a 17 and a half percent chance that that actually comes to fruition because it's got a lot of operational overhead.
So we're looking at Bob's GitHub profile. And one of the things you see that's different than the default is you see some stuff at the top, like the latest PyBytes articles and latest Python tips and even latest Boston on toots. So that's kind of neat. But how did he do this? Well, luckily, he's got a link at the bottom that says how to create a self-updating GitHub readme.
And we did talk about this way back in 2020. Simon Willison had a blog post about that. And so we'll link to the episode and Simon's also. And Bob actually says he was inspired by both Simon and I think Brett Cannon as well has an updated readme. But I really like this article. So it's just a little short thing saying, hey, I started updating my profile, GitHub profile with some tools.
And then he just published all the tools. So that's pretty awesome. First of all, he's got a script. So the script that runs, of course, he has it up on GitHub as well. And it just goes through and collects all of this data for him. And the script's pretty easy to read. And then all of it is used to fill out all that data is used to fill out a template, which he also published the template.
I think that's cool. So yeah, how does it look? I didn't look exactly where the template's being used in the code. Yeah, I don't see it either. But you don't have to have well-formed HTML for Jinja to run. You can just jam it against anything. For example, the RSS feed for Python bytes is generated using just an XML template with markup language in it like this.
So once a day. And when does it run? Well, it's a cron job. So I had to use my handy decoder because I can never remember that stuff. Crontab.guru. It's 845 in the morning. It goes off and runs this. Kind of neat. I wanted to try this. So I highlighted it again because it's been on my to-do list since 2020.
Well, let me go through my extras first since I got a follow up for this one. Okay. I got a few extras. I know that we both do. So you talked about crontab.guru, right? People haven't seen this before. I just learned about this that there's this funky syntax for cron jobs, but there's the site crontab.guru that lets you put in like, well, I want a five there.
It says every minute past hour five. If you just say star five, star, star, star, for example, or if you put, what's it? Like star over 20. Every 20 minutes, you know, past every minute past the 20th hour or like there's, there's weird syntax here, but there's this cool little site that you referenced.
Oh, wow. Yeah. Yeah. I was curious if you could do like a just day of the week and not like no Sunday, Saturday and Sunday, how you would do that? Yeah. Probably. Yeah. There's 20 star now. Anyway, there's, there's a whole bunch of different things and a little bit of a description on how this works, but way more interesting than I knew.
Okay. But this thing just added an AI capability called Inbox Copilot, which is a lot like GitHub Copilot. And so you just go to it and you just say, Hey there, email, write me a message that says this. So for example, you could just see like, if you got a message asking if you're going to be able to make the, so meaning you could just say, you type CCC anywhere in your message, it pulls up this little separate window that you talk to the AI and you just say, tell them, you know, apologize.
I'll be late by 20 to 30 minutes traffic. And that's all you say. And it writes like a really nice, formal, like well-written, friendly, not terse message back. So I'm going to try to start playing with this a little bit more. We'll see how it goes. I already had the app. It just, it, they, it just came with this Copilot thing.
I'm like, okay, that's pretty interesting. So people can check that out. I don't even know what it costs to be clear. Not an ad. This, this episode is sponsored by Microsoft, but yeah, it's like $20 a year. You know, not, not a terribly expensive thing to play with. All right. Next one is, this is a tweet from the Python package index itself.
Yeah, totally. That just went down and in load. If you look at it, yeah, I mean, it dropped at least 50% of usage there. And then if you, this is a pretty zoomed in picture. Someone else, Dustin Ingram, it was, tweeted, well, you should see it over time more. Look at, bam. There's this huge jump in the middle.
This is when they restarted it. You know, whenever you restart the app, it doesn't have like all of its caches and all that stuff warmed up. And potentially they even maybe had to throw away like Redis cache data if they were pickling it because 3.10 and 3.11 didn't, you know, they might not be compatible in a binary way.
So anyway, there's like this kind of like, ouch, you restarted us. It hurts type of thing. But then after that, it really, really drops. I mean, at least, at least 50% or 2x more for 3.10 than 3.11. So that's, that's really massive. That's pretty cool. Anyway, so 3.11 delivers. People can check that out.
Yeah. Yeah. Yeah. All right. So that's a good one. I was just in Las Vegas this weekend. That was fun. Thanks for rubbing it in. It's such a good time. Went to see the Blue Man Group and we went to see Cirque du Soleil and we had breakfast at like a beautiful brunch. They even had a, you know how some places have like a little omelet factory where you can have some eggs or whatever.
Oh, okay. First trip since I'd tried all those tools. And it worked pretty fabulously, actually. I just took my iPad and my ergonomic keyboard so I don't give myself carpal tunnel again. And it worked great. So all those tools we talked about, people, maybe I'll find a way. If people want to know, I'll find a way to link back to that episode.
It's right email. All right. Here's another good one. Linux, Amazon, Meta, and Microsoft want to break the Google Maps monopoly. So apparently Google Maps owns a significant portion of the mapping data and the street view data and so on. But all those groups I mentioned are working on creating this thing called Overture Maps Foundation.
I went to Redbubble, ordered an insane number of stickers and put on my laptop. What do you think of this thing, Brian? I'll put the link in the picture in the show notes. I like the laptop opening and closing tags. Yeah. It's got a bracket laptop at the top of the laptop, and it's got a bracket slash laptop at the bottom.
I got a few extras. So I just don't have a lot to add to these, but I'd noticed it's kind of interesting. So GitHub, I think this was on December 15th, announced that they're able to check for security leaks. And I'm linking to an article that they can check your GitHub repos for security leaks, like secrets and stuff.
So I wanted to shout out to Julia Evans. Did I get that right? Julia Evans. She's written a whole bunch of great stuff to help programmers, but she just released Pocket Guide to Debugging. And I was pretty intrigued by this. One of the things that highlighted was asking for help and writing a tiny program that reproduces the problem.
Those are two things that I really encourage people to do before they waste too much time. So I might throw some money away because those are really great free tips. Yeah, that's cool. There's a, I found this, what, Python Easter eggs repository. Not all of these work anymore. So I tried the first one, the import hello on Python 3.11.
Doesn't seem to work. But a bunch of these others are really pretty fun. Import this, of course, is there. One of the things that I think I knew about at one point, but I forgot about was the from future import Barry as Fluffle. So this was a joke from 2009 that's still in Python 3.11 that it's Barry Wars.
It's like a joke from Barry Warsaw and Brett Cannon. And if you do that, it completely, it removes the not equal, like the pound, like the, the bang equal sign with less than greater than for not equal. So the joke being if Barry was the dictator for life, he would change it. Anyway, it's kind of funny.
Fluffle stands for friendly language uncle for life. And there's even a PEP for it. So you can, you can read about the B PEP 401 with this. Anyway. Nice. Just a few extras. It could have been our joke. It could have been our joke section. It could have been our joke section, but we have another joke, don't we?
We do. So I told you, we'd wrap this up with some stuff about the cloud. So here's a nice little conversation a father and a daughter are having. They're out walking in a park and looking up at the sky and they see a cloud, you know, mostly empty sky, empty sky. And the kid says, dad, what are clouds made of?
The dad looks down and clearly says, Linux servers mostly. That's good, right? Yeah. Yeah. That's good. Even when they're serverless, they're probably still Linux things running in Docker, running on a Kubernetes cluster, running on Linux. Serverless is a hilarious word. It just means you don't know where the server is.
Yeah. It's like server's not my problem. Yeah. Well, this show is not a problem. It was a lot of fun. It was a lot of fun. Thanks so much for joining us and showing up again. And thanks everybody in the audience. Yeah, absolutely. Hey, before we go, I have one quick more announcement really, really quickly.
