- Podcasts
- Python Bytes
- #334 Packaging Organizations
About this episodeTopics covered in this episode: rye - Python workflow tool PyPI Organizations 5 tips to learn any new Python library faster Python gets…
- rye - Python workflow tool
- PyPI Organizations
- 5 tips to learn any new Python library faster
- Python gets down to (the) Metal
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#334 Packaging Organizations
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 334, recorded May 3rd, 2023. I'm Michael Kennedy. And I'm Brian Ecken. This episode is brought to you this time by us. Support our work through our courses over at Talk Python Training.
Got to hang out with you. You brought the Python staff of power and battled the snake, which was the episode album art from last time, which was a lot of fun. So yeah, it's starting to come back, isn't it? I mean, but still quite as many people or as vendors, but it's good to see it coming back to life.
Yeah. Yeah. I really enjoyed it. So should we kick in? Let's do it. Yeah. Jump in. Well, I was actually talking with one of our friends from PyCon that I'm blanking right now. So somebody from PyCon. So thank you. And apologies for forgetting your name right now. What I came across actually from several people mentioned Rai because we had talked about Hwak.
And this is a really pretty interesting project. So I tried it out this morning. Rai, it says it's Armin's personal one-stop shop for all of his Python needs. So that, and there's a video, which I didn't watch, but it's a nine-minute intro video. So what, what, what, what am I excited about with this?
The, so the other thing that, one of the things that I thought was really kind of cool is it also manages, I'm not going to find all the details here, but it manages Python. So you can, what, what are people using for PyEnv or something to install Python? To install Python. This installs Python also.
And it's pretty fast. It also handles virtual environments. So you can do things like add, run, run within your virtual environment. You can run a command without actually going into it. You can say like Rai run black and it'll run black on your project. You can say sync and it'll take all of the dependencies in your project.toml and install them in your virtual environment.
That's kind of neat. And also it's kind of like PipX also. So you can do things like install a global tool, like, you know, PipX install cards or PipX install really whatever you want. Or black, for instance, if you wanted to. If you're going to like have any global tools on, on your, you know, on your machine.
It confused me at first because I tried it and I couldn't get it in the thing to run. But it doesn't really, it doesn't, it isn't invasive. So it's not modifying your .zhrc or your RC files itself. You have to do that. So it's all going into a home directory .ri. And then I think there's a, there's a bin directory in there or something like that, that you just add to your path.
So it's doing that. The kind of neat thing about that, that all that isolation in the .ri directory is that if you decide you don't like it, you can just, you can just delete it. And then delete that directory and all that stuff's gone. So kind of cool. Yeah. I do like that it just blow away the directory and it's gone or it's reset, you know, that's pretty cool.
But it also uses a pip, but it doesn't expose any of those. So it is kind of interesting that it's outside. I kind of like that it's outside because you can do things like, like pip X and, and pie and V. And for me, it like just worked better. I, I've still had trouble getting pie, pie, pie, and V is a cool idea, but it mucks with everything in your environment.
And I don't like that. Exactly. Yeah. I don't like that either. So, I think the trend I've been talking, you know, we, I did the Python packaging discussion on talk Python a while ago. And there's, there's been a lot of talk about this, talked, to Ofec about a hatch and it's looking like there's a little more, a little more interest in saying like, okay, what if we had a tool that actually not just manages environments and packages, but actually manages Python.
Python, like it, for example, like this one, like install the version of Python you want and do a bunch of other things along those lines. So, yeah, it's, it's interesting. another, just a side note, Simon Willison wrote up some notes on his, when he tried Rye. So we're, we'll link that article as well.
Carol Willing gave a great keynote talking about, you know, let's make sure that, we're investing in the front end story for Python, investing in a mobile and deployment story for Python. And, you know, PyPI and the Python packaging authority, it's kind of there as well, right? Like as we grow in traffic, we need things like somebody to over watch over the security and some, you know, somebody to make sure all this stuff is developed and polished.
And people have been doing that, but to a large degree in a volunteer way. Right. But how does Python pay somebody to work on this? Well, there's been some grants, I think, I don't want to say the wrong company. It was from, some of the big tech companies are hiring people to do specifically security work, like a supply chain type of security for PyPI, which is great.
This is like the official AWS thing. Shouldn't this somehow be kind of more official than that? And how do I find the other AWS projects? I can like email the person or something. I don't know. I guess I could go over here and see this, this, the projects if I go to their user account, but it's kind of just, you know, AWS sort of hacked the system by creating an account named AWS.
And you can sort of see, right? You can, you can put this together officially as, as not Michael, but like this group. Right. So the big announcement is introducing PyPI organizations by Ederbin. So today we are rolling out today being a few days ago. Today we are rolling out the first step in our plan to build financial support and long-term sustainability for the Python packaging index, while simultaneously giving our users one of the most requested features, organization accounts.
So these are self-managed teams with their own exclusive branded web addresses. And the goal is to make PyPI easier for large community projects, organizations, and companies manage multiple sub teams and multiple packages. Right. So much like the GitHub org that I was talking about, you can say, okay, this person is an admin of it.
And this person can have right access to that thing, but not this thing. Right. So kind of, kind of those types of things instead of, Hey, everyone in the company, here's the one and only username and password for PyPI Go. Interesting. yeah. Yeah. Yeah. And it's like, I opened this conversation, increase the idea is to increase sustainability.
Yes, exactly. If you got to ask, no, just kidding. It says small fee. If you got to ask, it's not for you. Anyway, PyPI organizations, coming now, check it out. Okay. So is it just, oh, we don't know this yet, but is it just for things like, things like, companies or is it, could it be for, like, pytest or something like that?
Sure. It could be, like, for pytest. I mean, you talked about, it says for large community projects, for example. Yeah. Like, you talked about Flask. well, you talked about Armin, who was the original creator of Flask. But that's now under the pallets project, which runs a bunch of different projects and has a bunch of contributors.
and this is, actually near and dear to my heart because we do this on a weekly basis. you know, trying something, trying something new. and, I think I have a condensed version of this, but let's kind of walk through, these are pretty good tips on, if you're, if you're thinking about using something, or just want to learn, you hear, here's something cool.
So instead of just playing around with like maybe the things it does try to do something with it, try to have a task. And this, and this is a deliberate called deliberate practice, but, this is where I think you're really going to start learning. Something is, actually trying to get something done because often there'll be extra features you don't need right away.
So, going into to a deeper level is actually incorporate this library in a project of yours, or if it's similar to a, another project that you're already using, and you're just thinking about switching, go ahead and try switching it. you might not stick with it, but kind of feel how, how, how easy it is to change over to this new, new project.
and this, this is like massive, massive. and it just ties a bow on the whole learning process is trying to teach it back to somebody. And this could be a today I learned thing on your blog or an actual longer blog post, or maybe a little tutorial video or something, or actually just sit down and with somebody and try to talk to them about it.
one of the things that I find even just for ourselves from, for this podcast, trying to look at it and go, if I was trying to teach this to somebody or tell somebody why they should use it. Why? I mean, what are the different points? So like just earlier when I was talking about Rye, what's different about that?
Well, it's, it's different because it's, it handles the Python installs also. And it also kind of works like Pipex. I mean, the different things about it and then think about like, and then actually try it. So I tried it out. I went through, set up a, an extra little project directory and tried it out a few times and saw what it did, looked at the project Toml output.
so yeah. And then, just doing that. So, some great things. Yeah. I, I think, you know, teach it is, is really cool. You don't have to be an expert at something to give a presentation on it. If you structure, as long as you're genuine about it, right? Like if you, you said, Hey, I'm going to teach you everything you need to know and how awesome this thing is.
And really you just learned it last week at a conference talk. People might call you out. Like you don't seem to really know as much as you came. If you say, no, I'm, I'm excited about this thing. I just learned it. I wanted to share my excitement and, and just, you know, show you a quick getting started thing.
And then people won't go like, well, why does he know it? Like you just start out. Well, I just learned it, but I'm, I'm excited. And I think you'll be excited too, if you, you know, so I do think those presentations are awesome. I mean, there's plenty of places. There's user groups and meetups, regional conferences, like online meetups.
that you like, you can even say, I just, I just got excited about this, learned a little bit and I want to show you what it is. don't, I, yeah, don't make yourself out to be an expert in the, in the field. but that's great. That's this, this process actually is like exactly how I got started, blogging about testing is just learning, learning something new, writing an article about it and then writing a bunch.
and it, and then the whole thing could end up being a book. I mean, you could make a book or a course or something out of it eventually. So, but if you just want to do a quick one, this is a great way to. Yeah. All right. And, and speaking of just like, he opened Bob open his conversation here with like, and some of the things I'm learning are PyScript, Flet, PySimple GUI, Pyright, HTMX, Reddit, Leaflet.
Those are all awesome. So I can see why you would want to learn those. And Liz out there says, I'm an, I'm excited about this type of presentations tend to be more to the point, which is indeed. Yeah. All right. What's next. We have GPUs next. All right. I know you heard that, we can do all sorts of amazing things by programming GPUs.
And if we want to process, you know, tons of data, maybe we're doing medical research on protein folding, we're running around a cluster of GPUs and we could, you know, solve some kind of huge computational biological problem and make a big impact. But if you're going to do that, you sure better hope that you, if you're gonna do something like CUDA, you better hope that you have not just GPUs.
That's way too broad. No, no, no. You have Nvidia GPUs. And Nvidia GPUs are sometimes hard to come by. A couple of years ago, they were very hard to come by unless you're using the cloud where you can go get them. Right. I have an awesome Mac here. I've got my M two pro Mac mini now, and that thing has 16, GPU cores on it.
Can I do CUDA or use PI CUDA on it? No, that's not an Nvidia one. And so like honest on Mac, especially it's been extremely hard to do any sort of GPU computation. Right. Okay. We had the afterburner cards and those like weird external graphics cards on the older Intel ones, but those are not even an option in the last four years.
So, you know, that's, that's a drawback. And on Mac, the graphics language like direct X on windows or open GL and a lot of things is called metal. And so I want to introduce you to a library and an article called Python gets down to the metal, not like CPU, but GPU. And it says, are you a Mac and Python person?
Do you have a trillion numbers to multiply together? You don't have all day to wait for them. It says, well, Python is quite slow. Although the person acknowledges, I've been a happy Python user for quite a while. you know, for pure number crunching, Python is not as fast as the compiled languages like C and rest, which is totally true.
Is it plenty fast to drive your web API? Probably. It's probably really fast for that. But if you literally have a trillion numbers, you want to just crunch them in a loop. The advice is not to do that, right? The advice is to use something like pandas or numpy or desk or something like that, which are really all C base.
Or if you had a NVIDIA Jeep, graphics card, maybe you could use some kind of thing like PyCuda. But again, on the super powerful computer, it is just, you can't do it. There's no way to get an NVIDIA graphics card. However, if you could somehow program this metal, it says metal does have a way to program it.
It's just, there's not a lot of things for it. And it says there's a language to do on GPU computation that looks very C++ like. And it says on a, on an M2, this is not the pro, but the regular one has eight GP cores, which means let's see, that gives some numbers here. Yeah. It says, on the eight GP, GPU core version, you could do about a trillion floating point operations a second.
Yeah. Yeah. It's just hash include metal standard lib using namespace metal, write a function, do the operations. There's a lot of const device float star buffer. I mean, it's not easy, right? But it's also not that easy on, on CUDA and other things as well, generally speaking. So they come up and say, all right, what we're going to do is going to come up with a bunch of, you know, a vector and a matrix.
It's just a string there. That's, that's neat. It is. And if I was a, if this was my job and someone said, Michael, you're writing this program, I would not do what they are doing in this example and put triple quotes and put metal code, which is like C++ in there. I would write a metal file or a C, call it CPP or whatever's going to give you the best autocomplete and color syntax highlighting.
And then just do, you know, path read text and get that, you know, in one line, get that out, but have that in a separate file. So you could sort of more, more properly reason about it. But anyway, it says, look, we run this together and did a whole bunch of work, took 70 milliseconds to do 10 multiplications.
Not that impressive because there's a startup cost. What if we gave it a billion, a billion multiplications to multiply that vector in that matrix? Oh, that takes 0.3 seconds, a billion times. That's a lot. Yeah. So, so that's pretty good. It does say though, look like part of the speed or part of the challenge is moving data into memory and then out of memory.
And so the more you move stuff in and out rather than kind of loaded up with the data and then do operations on it, it will be slower. So it talks a bit about some of the performance things that you can do to make it faster. It gives some examples on how to do that. There's probably some interesting trade-offs with the Apple Silicon having a shared memory between memory memory and, and GPU memory, right?
You don't actually have to copy it between there, but I suspect that you're going from Python to C++ memory and back through some kind of serialization, right? That that's going to have some kind of cost. Who knows? Anyway, there's some cool examples of a Mandelbrot set being computed with this or Julia set rather.
But yeah, people are been dreaming of doing GPU processing on their Macs. Well, this might be worth checking out. Nice. The other thing that's kind of cool about it is it doesn't, you know, it's not like a library that takes Python code and compiles it or transpiles it to run on the GPU, which would be awesome.
But at the same time, it's, it means that it's, it's super flexible, kind of like a DB API. You open a connection, you say, here's a string, run that on the database. You can give it a selector, some kind of query or update, and it's, it kind of gets out of the way. So it seems pretty flexible in that regard.
Yeah. Yeah. Interesting. And this Mac only, right? So this is. Yeah, it's Mac only. But take that NVIDIA. You can't run Mac. No, just kidding. I have both an NVIDIA card and this, but I don't really have, I would like to do more GPU stuff, but I just don't have a trillion numbers that need multiplying right now.
Well, you know, it's not a bad thing. Someday. No. All right. Over to you. I've got, so we're onto extras. I've got just one extra that I wanted to bring up. And that was just the textual. So Will McGooghan posted like this picture and like with no explanation. Apparently it's the, it's the weird, I'm showing a weird bird with a large mouth.
It's kind of an ugly thing, I think. But it's the logo for frog mouth. And what is frog mouth? Frog mouth is the first, apparently first of possibly more to come applications that the textual team is releasing that are built on textual. So frog mouth is a markdown viewer and browser for your terminal.
Oh, yay. Yeah. I was going to talk about this as a main item. This thing called serenade at serenade.ai. And it's really neat. What it does is you install a plugin for your editor where your editor equals VS Code or Jetbrains IDs. None of them do. And then you run this in the background and you can speak to it.
Like you hit a hot key or whatever. And you basically start speaking code oriented operations. So there's a cool example that it shows somewhere in here. Let's see. Yeah. If you go and click on the docs, you'll see a bit of a video thing here. And basically you can go into it and you can say, you know, teach it to do tests.
You can navigate around. This is kind of cool. So if you're typing in the editor, you're kind of good. I mean, I know if you have RSI and stuff, that's not ideal. But one of the challenges is like, okay, I need to leave this and navigate over there. So you can say things like open some file name and it'll actually go through your editor and say, oh, that's over in this directory.
You need to expand the section and it'll jump to it. Or you can say, go to this function or, you know, those kinds of things you can speak to it and it'll do it. So anyway, it's really cool. Why is it not the main item? Because I'm super excited about these kinds of things. The reason it's not is it hasn't really been touched for coming up on a year.
And that was just a merge of some PR. Is it still going? I don't know. It was kind of working pretty good, but then it was throwing errors when I, so I don't know. I love the idea. If this thing comes back to life, you know, someone out there, let us know. Cause this is super cool, but it doesn't quite seem to be getting kept up with the editors and tools and so on.
I liked your comment in the show notes. Serenade has seemed to gone silent. It has gone silent. Oh, thank you. It sure has. But it's still worth checking out. It's kind of cool. And then Brian Skin is when I, we've been talking a lot about packaging on this episode and I did my packaging discussion and inspired by that, or maybe just the discussion that I was also inspired by.
They're setting up a Python distribution packaging round table, not just of the people inside Python core devs world, but in the broader ecosystem for like Anaconda and data science and that. All right. Do they have 13 maintainers across nine projects lined up for Tuesday, May 9th and a link to go attend it.
There's just like a bunch of stuff. And this joke highlights the small wins you might make in this situation. Okay. So it's just a person with two monitors, a bunch of energy drinks crushed next to them, a bunch of wrappers, empty coffee. They've clearly been here for a while and the arms are up like, yes.
Wow, a different error message. Finally, some progress. Yes. Have I mentioned I've been working with a guy named Lauren on a Flutter mobile app? Let me tell you, there are a lot of tools in that tool chain. And more than once here, I've been like, yes, that's not the same error. We're making progress.
