Latest / Talk Python To Me / #544: Wheel Next + Packaging PEPs
Transcript
- 0:00When you pip install a package with compiled code, the wheel you get is built for CPU features from 2009.
- 0:06Want newer optimizations like AVX2? Your installer has no way to ask for them.
- 0:11Want GPU support? You're on your own configuring special index URLs.
- 0:16The result is fat binaries, nearly gigabyte-sized wheels, and install pages that read like puzzle books.
- 0:22A coalition from NVIDIA, Astral, and Quansight has been working on WheelNext, a set of peps that let packages declare what hardware they need and let installers like uv pick the right build automatically.
- 0:34Just uv pip install Torch and it'll work.
- 0:37I sit down with Jonathan Decker from NVIDIA, Ralph Gommers from Quansight and the NumPy and SciPy teams, and Charlie Marsh, founder of Astral and creator of uv, to dig into it all.
- 0:47This is Talk Python To Me, episode 544, recorded March 2nd, 2026.
- 0:53Talk Python To Me, yeah, we ready to roll.
- 0:56Upgrading the code, no fear of getting old.
- 0:59They sink in the air, new frameworks in sight, geeky rap on deck.
- 1:03Quark crew, it's time to unite.
- 1:05We started in Pyramid, cruising old school lanes.
- 1:08Had that stable base, yeah, sir.
- 1:09Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
- 1:14This is your host, Michael Kennedy.
- 1:16I'm a PSF fellow who's been coding for over 25 years.
- 1:20Let's connect on social media.
- 1:21You'll find me and Talk Python on Mastodon, Bluesky, and X.
- 1:25The social links are all in your show notes.
- 1:28You can find over 10 years of past episodes at talkpython.fm.
- 1:31And if you want to be part of the show, you can join our recording live streams.
- 1:35That's right.
- 1:36We live stream the raw, uncut version of each episode on YouTube.
- 1:40Just visit talkpython.fm/youtube to see the schedule of upcoming events.
- 1:44Be sure to subscribe there and press the bell so you'll get notified anytime we're recording.
- 1:48This episode is brought to you by Sentry.
- 1:51You know Sentry for the error monitoring, but they now have logs too.
- 1:55And with Sentry, your logs become way more usable, interleaving into your error reports to enhance debugging and understanding.
- 2:02Get started today at talkpython.fm/sentry.
- 2:06And it's brought to you by Temporal, durable workflows for Python.
- 2:10Write your workflows as normal Python code and Temporal ensures they run reliably, even across crashes and restarts.
- 2:17Get started at talkpython.fm/Temporal.
- 2:21Hey, a quick announcement for everyone taking courses over at Talk Python Training.
- 2:25We just rolled out course completion certificates.
- 2:28I'm really excited about these.
- 2:29When you finish a course, you can now generate a certificate automatically.
- 2:33The best part is there's a one-click button to add it straight to LinkedIn on your profile as an official certificate.
- 2:40Potential employers, current colleagues, they'll all see it right there on your profile.
- 2:43Just head over to your account page at Talk Python Training, find a course you finished, click certificate, and the share to LinkedIn option is right there.
- 2:52Zero friction.
- 2:53And if your employer gives you credit for professional development or reimburses you for training costs, but require some sort of proof, you can also download a full certificate as a PDF.
- 3:04Handy for that kind of thing.
- 3:05I'd love to see a wave of Talk Python certificates showing up on LinkedIn.
- 3:09Head over to Talk Python, click courses, go to your account page, and grab your certificates.
- 3:15Jonathan, Ralph, and Charlie, welcome.
- 3:17Welcome back, depending on which one of you are hearing this.
- 3:21Welcome to the show, you all.
- 3:22It's awesome to have you on Talk Python and me.
- 3:24Thanks for having us.
- 3:24Thanks for having us.
- 3:25Thanks for having us, Michael.
- 3:27We're going to dive in deep to Python packaging and really look at how the needs of Python packaging have evolved.
- 3:36And what you all, as well as a group of a bunch of other people, I see very long contributor lists on these peps.
- 3:42So a lot of people involved in this project.
- 3:44Really great.
- 3:45So let's get into it.
- 3:47Before we do, let's just do a quick round of intros for you all.
- 3:51I guess go around clockwise.
- 3:53Jonathan, you can go first.
- 3:54I work at NVIDIA for like, I think, the better of eight years right now.
- 4:00I did all kinds of different roles.
- 4:02But very recently, I mean, over the last two something years, I move into improving our CUDA and Python offering, trying to find better ways to expose GPU programming, essentially, at the Python layer.
- 4:17And I think for a little bit over a year, I've been working with Ralph and Charlie over multiple proposals to improve Python packaging.
- 4:26Initiative call WheelNext.
- 4:28And I think we'll talk a little bit more about this.
- 4:30So excited to be on the show today.
- 4:33Yeah.
- 4:33Excited to have you.
- 4:34You have really seen the roller coaster at NVIDIA, I'm sure.
- 4:38Right?
- 4:38Well, it's really exciting.
- 4:39Yeah, it was like gaming and probably some data science and then all the changes and now just center of the universe.
- 4:47So I'm sure it is exciting.
- 4:48You know, the funny thing is I wanted to join NVIDIA since 15 years.
- 4:52And I did a PhD to actually be able to join NVIDIA.
- 4:56That is so awesome.
- 4:58I love it.
- 4:58I was amazed by the CUDA technology when I was in high school.
- 5:02And I was like, ah, this is so incredible, the concept.
- 5:06And I wanted to join.
- 5:07So I'm happy I was able to make this happen.
- 5:10You know, CUDA is going to be an important part of this discussion.
- 5:13Not the only part, but it certainly is one of the forcing functions for the things happening here.
- 5:18Give people the background on CUDA.
- 5:21What is it?
- 5:22How does it work?
- 5:22Why is it so amazing?
- 5:24Well, CUDA is essentially a programming language that allows you to program on GPUs, specifically NVIDIA GPUs, and has a different programming model than what you would usually do in C.
- 5:37So because GPUs are fundamentally very different than CPUs, you have to program them with a different mindset.
- 5:44Like, for example, the biggest important thing when you start with GPUs is to not think about a single thread executing the instruction.
- 5:52But like, how can you massively parallel a task on like thousands of threads at a single?
- 5:58And it takes a different perspective and mode of thinking to how can you imagine doing a task on so many threads at the same time?
- 6:08We're not used to it as classic computer scientists.
- 6:13If anything, multi-threading is something that we tend to shy away from because there's a lot of caveats.
- 6:20But well, GPU programming is all about how can you have as many threads as possible.
- 6:25Yeah.
- 6:26It comes from graphics and videos where like this pixel is computed independently of that pixel.
- 6:33And we've got, you know, 5K resolution.
- 6:36So let's just break that up, right?
- 6:38Yeah.
- 6:38It's exactly the idea.
- 6:40And now we have this reasonably new model that's called title programming that abstract it even more, which essentially instead of thinking about threads and blocks and grids, you think in terms of title.
- 6:52So kind of a mini representation that you could have in mind.
- 6:56And that thing can scale and adapt differently on different hardware.
- 7:00So pretty cool.
- 7:01But yeah, that is amazing.
- 7:03People think that their CPU has a lot of cores.
- 7:06It's got nothing on the graphics cards.
- 7:10Well, yeah.
- 7:11It's a different type of hardware.
- 7:14Rich is different.
- 7:15Absolutely.
- 7:16Yeah.
- 7:16Well, very cool.
- 7:16Very cool.
- 7:17And what a journey if you did all that work to get there.
- 7:20I absolutely love it.
- 7:22Ralph.
- 7:22Welcome.
- 7:23Hello.
- 7:23Yeah.
- 7:24Thanks, Michael.
- 7:24Great to be here.
- 7:25So about me.
- 7:26I am a physicist by training.
- 7:29I did a PhD in atomic and quantum physics.
- 7:32Worked in the semiconductor industry in a while.
- 7:35And I rolled into scientific computing.
- 7:38Due to that, I started using Python in 2004.
- 7:41And used the mailing list at that point.
- 7:43Because there was, I mean, NumPy didn't exist yet.
- 7:46There was no documentation for anything.
- 7:48So you had to join a mailing list.
- 7:49That's how I rolled into open source early on.
- 7:51I became the release manager of NumPy and SciPy in 2010.
- 7:56And yeah, I've been kind of doing that ever since.
- 7:59As a volunteer for 10 years.
- 8:00And then I got really too much.
- 8:02So I made it my job.
- 8:03I joined Quansight, which is a small consulting company.
- 8:06Primarily around like data science, supplied AI, scientific computing.
- 8:10And yeah, I'm now one of the two co-CEOs of Quansight.
- 8:14Awesome.
- 8:15Trying to basically, we just converted last year to a public benefit corporation.
- 8:19Which is very much aligned with what, you know, most of our team wants to do.
- 8:23Most of them are open source maintainers.
- 8:25And yeah, we basically do consulting to allow ourselves to make impactful open source contributions.
- 8:32Quansight is doing a ton in the data science space.
- 8:35Scientific computing space, for sure.
- 8:37I've had multiple rounds of Quansight folks on the show and things like that.
- 8:42And very neat.
- 8:43Yeah, it's a lot of fun and rewarding.
- 8:45So yeah, glad to be here.
- 8:47It's an interesting transition going from a science or something along those lines into programming, right?
- 8:53And I got into it through working in my math research and so on.
- 8:58And actually, this is just more fun.
- 9:00I'm just going to do programming.
- 9:01It's not exactly physics, but it's pretty similar, you know?
- 9:05Yeah.
- 9:05I mean, I've always liked both.
- 9:07But I did experimental physics.
- 9:10And there, you have much less control over what you end up producing.
- 9:15You know, building and using lasers in the lab.
- 9:17If one broke, maybe I had to send it off for repairs and wait a month, right?
- 9:21And what do you do in the meantime?
- 9:22You program.
- 9:23So, you know, that's one of the nicer things about it.
- 9:26And yeah, I gradually started with like, even before Python, there was some MATLAB.
- 9:31And then, you know, you roll into open source.
- 9:33And then, you know, mostly just Python a bit of C and kind of like go down from there.
- 9:37And then you encounter packaging.
- 9:39And it's one of those things that like only 5% of people like and the rest see it as a chore.
- 9:43But yeah, when you like it, you just have to do more and more of it.
- 9:46Yeah.
- 9:47You're with your people now, I think, on this call.
- 9:49That's for sure.
- 9:50Hey, Charlie.
- 9:51I mean, do we even need to give you an introduction?
- 9:53We just say uv and then go on or?
- 9:56No, I'll generally.
- 9:57No, please do.
- 9:59I'm just kidding.
- 10:00But the reason I say that is uv has taken the world by storm, really.
- 10:06And congratulations.
- 10:07And yeah, tell people about yourself.
- 10:08Thank you.
- 10:08Yeah, yeah, of course.
- 10:09So my name is Charlie.
- 10:11I'm the founder and CEO of Astral.
- 10:13I've been working on the company for, let's see, started the company in October 2022.
- 10:19That's the easier way to do it.
- 10:20So I've been working on this for a few years.
- 10:23We mostly build open source.
- 10:25So we've worked on a couple of different tools that have become quite popular in Python.
- 10:30So we build Ruff, which is our linter and formatter.
- 10:32TY, which is our type checker.
- 10:34And then most relevant for this episode would be uv, which is our Python package and project manager.
- 10:40So yeah, we spend all our time thinking about how to build tools that make it easier and to work with Python and how to make Python programming more productive.
- 10:49A lot of that's about speed.
- 10:52We try to build things that are really fast, but it's also about user experience and trying to sort of like take complexity out of the critical path for users.
- 11:00So, you know, for example, we've definitely spent a lot of time thinking about how we can make it easier for people to install PyTorch, which is, you know, one of the examples that will come up, I'm sure, you know, over the course of the show.
- 11:12And one of the motivating examples for the peps we've been working on.
- 11:15So, yeah, that's why I'm here.
- 11:17We've been collaborating with Jonathan, Ralph, and honestly, like a bunch of other people, too.
- 11:21It's been a really big effort, and I'm sure we'll get into that.
- 11:23But it's been cool to have this long running and very like wide ranging collaboration around trying to push Python packaging forward.
- 11:30Well, like I said, congrats on all the stuff with Astral.
- 11:33And we're going to talk a little bit about pyx, I think.
- 11:36Maybe see if there's any.
- 11:37Just to check in at the end of the show after we talk about some of these things, I think, if you're up for it.
- 11:42Yeah, sounds good.
- 11:43I mean, let's just start with what is the challenge.
- 11:45You all have described this as the lowest common denominator packaging problem that we've got to deal with.
- 11:52And the idea or the problem is different CPUs have specialized instructions, different graphics cards, all these different compute and platforms and so on might have specific instructions.
- 12:05And they're optimized, right?
- 12:06Like do this as vectors operations instead of on registers or whatever.
- 12:10But maybe some other thing that it might run on doesn't support that, right?
- 12:15I don't know, WebAssembly, whatever.
- 12:16Yeah.
- 12:17And so then how do you actually end up shipping something to Python people that takes advantages of the specializations that are there when they're there, but without breaking the other ones, right?
- 12:28That's kind of the core problem.
- 12:29Is that right?
- 12:30Yeah.
- 12:30I can take one little step back before.
- 12:32Go ahead, Alan.
- 12:33If you think about it like a wheel, when you take the Python package that we have everywhere, there is a few parts of the fine names that essentially allows you to know what it's been built for.
- 12:46So inside this, you have, if it's a pure Python package, it's simple.
- 12:50You might have a minimum Python version, but in most cases, it's pretty generic.
- 12:55So that's not an issue.
- 12:56When you start having compiled code inside the package, that's a different story because now we're talking about what kind of OS it was built for.
- 13:03So Windows, macOS, Linux, different flavors.
- 13:08We're talking about the type of CPU that it was built for.
- 13:11So x86, ARM, PowerPC, potentially RISC-V, all these things.
- 13:17Mobile.
- 13:18And then finally, the Python API.
- 13:20And in most cases, it means the minimum Python API that you need.
- 13:24So, and for people, an ABI is essentially the same as an API, but for a binary.
- 13:31So it's important when things are stable at the API level because it allows you to be future compatible.
- 13:38What does API mean?
- 13:39Jonathan, help us out.
- 13:40What does ABI mean for those of us who don't know?
- 13:42Application binary interface.
- 13:43So it's the same as API, but instead of specifically for binaries.
- 13:48And the problem that we collectively kind of try to get to is that, well, today, the compute space and the scientific computing space,
- 13:58which if we take the latest JetBrains Python developer survey, is at least 40 to 50% of the Python developers are essentially doing data science or similar.
- 14:10So it's a massive percentage of the community is doing, in some form, scientific computing to whatever extent you may want to think about it.
- 14:21And, well, the problem is when we do these things, we try to do them fast because who likes to wait on the return of some Pandas operation or NumPy or PyTorch operation.
- 14:32But to go fast, you need to use all the tricks in the books that you can get to essentially, you have to optimize the binary for a specific CPU,
- 14:42for a specific GPU, or for a specific library that you want to use, like BLAS.
- 14:48BLAS is a general concept, so which BLAS implementation is, or MPI.
- 14:53And the problem is, well, we don't have the tags or markers to allow us to essentially flag this specific binary to be compatible with X, Y, and Z.
- 15:03Right, so the wheel might say, this is for 3.14, it is for ARM CPUs, and so on, but it's not going to say,
- 15:14and it supports this vectorization optimization on Intel chips, right?
- 15:18I just said ARM, didn't I?
- 15:20A very good example with ARM is that the default most people build with is actually a Raspberry Pi, ARM level.
- 15:30Yeah, yeah, yeah.
- 15:31And you can imagine that when you build for any type of desktop CPU, ARM, you have a little bit more complex CPUs and a little bit more advanced chips.
- 15:42And it's a lot of performance that you leave on the table by not optimizing for a specific platform.
- 15:48So obviously, in some cases, it doesn't really matter, but in other cases, it does really matter.
- 15:53This portion of Talk Python To Me is brought to you by Sentry.
- 15:56You know Sentry for their great error monitoring.
- 15:58But let's talk about logs.
- 16:00Logs are messy.
- 16:01Trying to grep through them and line them up with traces and dashboards just to understand one issue isn't easy.
- 16:08Did you know that Sentry has logs too?
- 16:10And your logs just became way more usable.
- 16:13Sentry's logs are trace-connected and structured, so you can follow the request flow and filter by what matters.
- 16:19And because Sentry surfaces the context right where you're debugging, the trace, relevant logs, the error, and even the session replay all land in one timeline.
- 16:28No timestamp matching, no tool hopping.
- 16:31From front end to mobile to back end, whatever you're debugging, Sentry gives you the context you need so you can fix the problem and move on.
- 16:37More than 4.5 million developers use Sentry, including teams at Anthropic and Disney+.
- 16:42Get started with Sentry logs and error monitoring today at talkpython.fm/sentry.
- 16:48Be sure to use our code, talkpython26.
- 16:50The link is in your podcast player's show notes.
- 16:53Thank you to Sentry for supporting the show.
- 16:55I'll give a very concrete example.
- 16:57Intel x86-64 is kind of the most common CPU that most people will have at home.
- 17:04If you build a wheel for that, you can only use CPU features, performance CPU features that go back to about 2009.
- 17:13Any new hardware features that were introduced after 2009, things like SSE4, AVX2, later versions of that, you just cannot use because the installers don't know that you put that in the wheel.
- 17:27And hence, they will also install it on computers that don't have those instructions, right?
- 17:32And then you just get like very ugly crashes.
- 17:34Hence, what we all do is we ship wheels, binaries that are only compatible with 2009.
- 17:40And the difference between the 2009 hardware features and, you know, the 2019 or 2023 one could be a factor of 10x, 20x in performance, depending on what you're doing.
- 17:5110x to 20x?
- 17:53Oh, yeah.
- 17:53For, you know, especially when you work with scientific data and SIMD instructions.
- 17:58Yeah, you can get massive performance increases.
- 18:01If you heard of vectorization, this is a huge deal.
- 18:05Yeah.
- 18:05I mean, I guess the way I think about it from our perspective of building, like, because these problems, like one of the things that's very hard about solving them, and it has required,
- 18:12like us to be so collaborative across the industry, is that it touches, like, basically every piece of the Python packaging stack.
- 18:21Like, it impacts how you build things, how the registries work, like what they support, how installers, like, choose what to install.
- 18:30And so, like, for us, it's like, you know, there's the superpower of Python, I think, in some ways.
- 18:36Sorry, I think the superpower of Python in some ways is, like, you can build and distribute all this software that's built for, you know, that uses native code.
- 18:45Like, you can take native code, and you can distribute it out to users, and they can run it just like it's any other piece of Python code.
- 18:51And in the spec, we have these things like, okay, you can build a wheel that targets Windows or Linux or macOS, and it can target, like, x86 or ARM or whatever else.
- 19:03And those are all captured in the spec.
- 19:04And so, for us, like, building uv, we know how to detect those things, how to figure out, like, which wheel to install based on what the user's machine is running.
- 19:13But there's all this other stuff that's not captured by any of those standards, like the instruction set or even, like, the supported CUDA version.
- 19:20Like, all these things are not captured in that wheel file, and installers don't know how to detect them.
- 19:25They don't know how to figure out, like, okay, which PyTorch build should I use based on the CUDA version on the user's machine?
- 19:30Like, all that stuff is lost.
- 19:31And that's kind of the gap that we're trying to bridge.
- 19:34And part of the philosophy is also, so right now, Python packaging exposed what is called platform tags.
- 19:41So, essentially, a sort of, like, mini tag that comes with a specific definition that installers know how to resolve.
- 19:48And what we're trying to evolve is to end up creating 200 more today and 200 more in two years and 200 more, again, in four years.
- 19:57So, we try to come up with a generic system that will allow you to essentially include arbitrary definition that then resolvers and package managers can then understand by some sort of mechanism.
- 20:10And resolve, but not create a sort of blessed list of things that you constantly have to update because it's a lot of maintenance.
- 20:19Yeah, that's how we got into the situation now, right?
- 20:21Because there's one for the version, there's one for the architecture of the CPU, but then there's not a spot for the other stuff.
- 20:27So, the overall idea is to say almost just a metadata section in there and things can read it or ignore it as they see fit.
- 20:35Yeah, that's exactly a concept.
- 20:37Conceptually, yeah.
- 20:38A little bit.
- 20:39Yeah, yeah.
- 20:40I mean, it's like, I guess the question is, like, okay, if we have this, like, huge space of things that we might possibly want to detect and condition installs on, like, okay, anytime someone publishes a wheel for Python, they should now tell us, like, what CUDA version is it built for?
- 20:55Or, like, if any, what, like, CPU instruction sets does it support?
- 20:59Like, blah, blah, blah.
- 21:00Like, where would we put all that stuff, right?
- 21:01Becomes the question.
- 21:02It's like, what, are we just going to keep expanding, like, the platform tag and everything else?
- 21:06And that's, like, the problem that we're trying to solve in kind of a generic way.
- 21:09Yeah, you can end up with a file name that's 4,000 characters wide or something.
- 21:13They can already get pretty long, by the way.
- 21:14But, yeah, that's, if you have any changes, we have to work around that in uv sometimes, file name length limits.
- 21:21But, yeah.
- 21:22It's actually a very famous package that used, I think, 200 first digits of pi as the version number.
- 21:28Oh, my gosh.
- 21:31It's a pretty good joke.
- 21:32I didn't know about it.
- 21:33There's somebody on discuss.python.org that posted the link.
- 21:36And I was like, but that's hilarious.
- 21:38That is wild.
- 21:40So, before we dive into what you all are proposing, let's maybe talk about how just a couple of packages or libraries solve this problem now in maybe different directions.
- 21:50So, Ralph, what about NumPy, right?
- 21:52I mean, you guys talked about vectorization and stuff.
- 21:56Yeah.
- 21:57That's so in line with NumPy, right?
- 21:59Is NumPy, like, and pandas, that's the way, you know?
- 22:02Yes.
- 22:02NumPy, yes.
- 22:03Pandas, no.
- 22:04So, NumPy does contain SIMD instructions and, you know, because it's incredibly useful for performance.
- 22:14You know, NumPy has all large arrays and basic instructions on them that, like, have direct hardware implementations typically.
- 22:21But the way it's done is incredibly complex because you need to end up with a wheel that works on every type of CPU, right?
- 22:29We didn't, you know, I'll stay with x86, but the same happens on the other platforms, right?
- 22:33You know, it needs to run on a 2010 CPU and it needs to run better on a 2024 CPU.
- 22:39So, what we do in NumPy is we have a system that basically allows you to either parameterize a source file that, you know, and then rebuild it multiple times, you know, four different particular CPU architectures.
- 22:54So, like, you know, like a Haswell family and then a Skylake family and so on.
- 22:59And then we basically merge that together in a single Python extension module.
- 23:03And then at runtime, we have our own code to detect the CPU and basically then some, like, dispatch shim layer that kind of fishes out the right, you know, family from the extension module.
- 23:16So, yeah, you put up the diagram there.
- 23:19It's pretty complicated.
- 23:21And I'd say there I've been collaborating with some of the, you know, world experts on this.
- 23:27We had like an in the end, this was only successful because we built a generic architecture that other experts per, you know, CPU architecture could come and contribute to.
- 23:38So, we now have a specific team of like four people that help maintain the architecture.
- 23:44But then like, you know, Intel for years paid one of their engineers to optimize specifically the x86 code path.
- 23:52And then ARM has a NumPy maintainer who, you know, got commit writes a few years ago.
- 23:57And he's the final authority on all the ARM instructions that are in there.
- 24:01So, that whole complicated thing is now shipped and it's extremely good for performance.
- 24:06But you can see how this is not a scalable process to do in many packages, right?
- 24:10Plus, you know, if you compile everything five times, you get a binary that's, you know, it's not five times bigger, but it's a lot bigger.
- 24:17So, it's not great for users as well.
- 24:19Yeah, actually the nickname for these things are called Fatbin.
- 24:22So, you have the idea for why they are called that way because they tend to be very heavy to download.
- 24:28Yeah, yeah.
- 24:29Instead of wheels, you got big wheels.
- 24:31Yep.
- 24:31So, what happens if all these changes get adopted and it doesn't need to be compiled into one giant binary?
- 24:38Okay.
- 24:38Are all these maintainers still working?
- 24:40They just don't have to deal with trying to boot it all into one thing?
- 24:44They might still have to do, yes.
- 24:46I think essentially you're correct.
- 24:48You still need to write the actual code that uses the SIMD instructions.
- 24:52But then you can just produce a wheel that says like, okay, it works on this specific CPU architecture and just ignore this code if I'm building for another architecture.
- 25:01And all the, you know, detecting the CPU at runtime and the dynamic dispatch features you all don't need.
- 25:06Will it make the code faster?
- 25:08It will, well.
- 25:09Like will you have a better cache hits?
- 25:11Will there be smaller stuff in memory?
- 25:12You know, that kind of stuff.
- 25:13I don't think it will make the NumPy code much faster.
- 25:17It will, you know, it will make a huge difference for all the other packages that don't have this amount of complexity today.
- 25:24So like SciPy, scikit-learn, Pandas, Pillow, like none of these packages actually use SIMD code.
- 25:31And for SciPy, it's the easiest for me to talk about because I'm also a SciPy maintainer.
- 25:35We actually have a lot of code that, you know, got vendored in from somehow, like Fourier transforms, for example.
- 25:41They benefit a lot as well.
- 25:42We have AVX2 and ARM Neon implementations, but we just don't build them and don't ship that as wheels because we have no way of doing that.
- 25:51As soon as we have, you know, wheel variants, we can say, okay, let's ship two sets of wheels.
- 25:56I mean, that's more CI jobs to build more wheels.
- 25:59But, you know, when it's worth it, you know, you can make that trade-off, right?
- 26:02Like we already have the code.
- 26:03We just have to change a build option, produce a different wheel, and ship it.
- 26:07So do you just set up something like a hash if def sort of thing for like if defs this capability?
- 26:15Else you put in the generic code?
- 26:18Exactly.
- 26:19The, yeah, the C code is basically just a bunch of if defs.
- 26:22And, you know, if you only, you know, for maintainability reasons, you only add more if defs if, you know, it's really much faster.
- 26:29Like you are going to do it for 10 or 20% faster, but if it's 2x faster, well, why not have an extra else bridge?
- 26:36Yeah, absolutely.
- 26:37Charlie, does Rust have a hash if def equivalent?
- 26:40It must, right?
- 26:40Yeah, you can do.
- 26:42It has directives like that.
- 26:44Yeah, but you guys don't really need to worry about using this for yourself.
- 26:47This is more for the things that you service providing to everyone, right?
- 26:52Yeah.
- 26:52Yeah, this is mostly, this wouldn't have a huge impact on uv or, I mean, it could have some small impact.
- 27:00But I think largely this is about, yeah, how can we make it easier for users to consume this stuff?
- 27:04And I mean, the NumPy, like this is a good example of how it affects like build and distribution.
- 27:10Because, yes, they still have to write like architecture specific code if they want to get these optimizations.
- 27:15But what we'll be doing with these proposals is making it much easier for them to ship separate builds that are like dedicated for each of those different variants.
- 27:24So like the end user, you know, will get access to it.
- 27:28But in this case, it's like the bottleneck is, or part of the bottleneck is like all the complexity it puts on the maintainers and the people publishing.
- 27:36How much do you think it would impact the performance to ship Python standalone with different CPU extension?
- 27:42That is a good question, Jonathan.
- 27:44So we'd actually like to do, I don't know that I have a great answer to that.
- 27:49I mean, like a good quantitative answer to it.
- 27:52I think we are very interested in doing stuff like that.
- 27:55We've also considered, for example, shipping a build.
- 27:57Like we ship with a relatively old like glibc minimum.
- 28:01We've considered shipping a build, a variant, not in the sense of the, sorry, a different build.
- 28:07Let me just put it that way.
- 28:08That uses a more modern glibc version, for example.
- 28:11We do run into other problems with that.
- 28:13Like our build matrix is really big.
- 28:15We have to split it across multiple GitHub actions now.
- 28:18And so like we need to, we just have like a lot of builds.
- 28:20So we'd probably, we're worried about like doubling the size of the build matrix, for example.
- 28:24But that's a separate problem.
- 28:26But yes, it could actually, it could actually be helpful there.
- 28:28Although we don't ship those as wheels today.
- 28:29Yeah, that's awesome.
- 28:31In a very interesting angle to think about how much leverage, I mean, this probably does, this is probably something you've thought about.
- 28:37But how much leverage you and your team actually have on Python performance by how you control Python build standalone.
- 28:44This portion of Talk Python To Me is sponsored by Temporal.
- 28:48Ever since I had Mason Egger on the podcast for episode 515, I've been fascinated with durable workflows in Python.
- 28:56That's why I'm thrilled that Temporal has decided to become a podcast sponsor since that episode.
- 29:00If you've built background jobs or multi-step workflows, you know how messy things get with retries, timeouts, partial failures, and keeping state consistent.
- 29:10I'm sure many of you have written brutal code to keep the workflow moving and to track when you run into problems.
- 29:15But it's trickier than that.
- 29:16What if you have a long-running workflow and you need to redeploy the app or restart the server while it's running?
- 29:22This is where Temporal's open source framework is a game changer.
- 29:25You write workflows as normal Python code and Temporal ensures that they execute reliably, even across crashes, restarts, or long-running processes, while handling retries, states, and orchestrations for you so you don't have to build and maintain that logic yourself.
- 29:41You may be familiar with writing asynchronous code using the async and await keywords in Python.
- 29:46Temporal's brilliant programming model leverages the exact same programming model that you are familiar with, but uses it for durability, not just concurrency.
- 29:55Imagine writing awaitworkflow.sleep, time delta, 30 days.
- 30:00Yes, seriously, sleep for 30 days.
- 30:02Restart the server, deploy new versions of the app.
- 30:04That's it.
- 30:05Temporal takes care of the rest.
- 30:07Temporal is used by teams at Netflix, Snap, and NVIDIA for critical production systems.
- 30:12Get started with the open source Python SDK today.
- 30:15Learn more at talkpython.fm/Temporal.
- 30:17The link is in your podcast player's show notes.
- 30:19Thank you to Temporal for supporting the show.
- 30:22Maybe just tell people, what is the relevance there?
- 30:26Like, why?
- 30:27What is Python Build Standalone and how does this even apply to what we're talking about?
- 30:30Oh, yeah, sure.
- 30:31I use it every day.
- 30:32I love it.
- 30:33A lot of people use it and don't even know.
- 30:34I mean, it's probably the least, it's the least like public or like user, direct user facing thing that we do.
- 30:41But we took over maintenance of a project called Python Build Standalone probably like a year ago, maybe a little more.
- 30:49And that project, the basic idea is like typically when you build CPython, you know, at least like on Linux, for example, a bunch of absolute paths get embedded into the binary, which makes it hard to build like reproducible and relocatable CPythons.
- 31:05Like it's hard for someone to build a CPython that you can then download and run on your machine.
- 31:08You typically need to build it on your own machine.
- 31:12So what this project does is it's sort of like a fork of the CPython build system.
- 31:17It's like the CPython build system with a bunch of patches and other changes applied on top.
- 31:21And it makes it so that we can build Pythons that you can just download, unzip and run.
- 31:27So when you install Python with uv, and these are also used in like Bazel and in a bunch of other tools, we don't actually like build Python from source.
- 31:35We actually download, unzip and run Python, which just makes it much easier.
- 31:39It means it's faster.
- 31:41You don't have to have like the build tool chain on your machine.
- 31:45You don't run into problems around like failing to build it or anything like that.
- 31:48But the other thing that's been cool about that project, at least recently, is we've been very focused on performance.
- 31:53So on actually just trying to make sure that we're distributing, like our goal is to be like the fastest Python distribution.
- 32:00Like even without changing CPython source code, just changing how we build it and various things that we can tweak there.
- 32:07And so we've been working on a bunch of benchmarks.
- 32:08I do think we have the fastest Python now, but we haven't actually published our rigorous benchmark methodology.
- 32:14So I won't stake my reputation on that claim yet, but we've been very focused on it.
- 32:19And it's been a cool point of leverage because like we can just, yeah, if we can make Python, you know, if we can put out a Python distribution that's like 10 or 15% faster, you know, just by changing how we build it.
- 32:28Yeah, it's a big lever for impact.
- 32:30Yeah, it's a huge lever.
- 32:31And I hadn't really thought about it being a lever until Jonathan brought it up.
- 32:35But for example, it's not directly impacted by this because we don't ship it, I guess, for the reason that we don't ship it as a wheel.
- 32:40Although someday we potentially could.
- 32:42Right now it's just, they're just the files that uv knows how to install.
- 32:45But it's the same logic at the core.
- 32:47Once you start tweaking the packaging of Python packages, the next part you want to tweak is your Python install.
- 32:55Well, for example, all of my stuff that runs in on the servers, it's all in Docker and it has a base Docker image.
- 33:03And one of the very first lines is, you know, install the, use curl plus the shell to install uv.
- 33:09The next line is uv, V, E, and V.
- 33:12And that, that installs Python from Python build standalone.
- 33:16And then whatever, you need to make an actual app out of that afterwards.
- 33:19Right.
- 33:20And so how many people are doing that?
- 33:22I, it seems like a huge portion of the world has adopted uv for sort of bootstrapping Python instead of the other way.
- 33:29So that's, that's why it's such a big lever, right?
- 33:31Yep.
- 33:32Yeah, exactly.
- 33:33All right.
- 33:33As a way to sort of get into the peps, Charlie, you mentioned variants.
- 33:39You're like, wait, wait, wait, not that variant.
- 33:42What variant are we talking about?
- 33:43That's not that variant.
- 33:45What is that variant?
- 33:46I guess that we're not talking about in uv or Python build standalone.
- 33:49Who wants to take that?
- 33:49Ralph, do you want to take that?
- 33:50I'm not actually sure what the question is here.
- 33:53I think you were targeted for the question.
- 33:55Yeah, yeah, yeah.
- 33:58That's fine.
- 33:59I mean, like the, so we use, so the peps revolves around this concept of wheel variants.
- 34:03And the idea is you can have, I'll keep using the word variants.
- 34:09You can have different variants, different builds, you know, of a wheel that are intended to be installed based on properties that are known or detected on the machine.
- 34:20So, for example, that could be like, okay, what NVIDIA drivers do you have on your machine?
- 34:29Like, what are the versions of those drivers?
- 34:30Because that then implies things about what versions of the CUDA runtime you can use.
- 34:34And so when someone publishes a wheel, maybe that wheel, you know, leverages CUDA and needs to be built against CUDA and needs to be built, you know, in a way that leverages CUDA.
- 34:43And so they might publish different variants, effectively just different, you know, slightly different versions of, versions is wrong, different variants, slightly different flavors of that package that are all built against different, you know, different CUDA versions.
- 34:58And so we would call those different, you know, different variants.
- 35:01It's a, it's a, you need to correct me.
- 35:03The terminology across what I understand the packaging space, even outside of Python, if you type variants in general, this is, we try to reuse the terminology that ends up being
- 35:14pretty widely adopted in the packaging ecosystem, not Python packaging, the packaging at large.
- 35:21This is the, variants is the name that you'll find around for this kind of concept.
- 35:26You know, related to that, like, especially in the astral flavor these days, but also in many other areas, I feel like crates and rust, what they've done with their packaging system has kind of influenced some of the things we're adopting in the Python world.
- 35:41Has anything from the rust world influenced the, these peps that we're about to talk about?
- 35:46Well, crates are source distribution now, mostly.
- 35:49Yeah.
- 35:50Well, in this case, we're talking about actually binary distribution.
- 35:54Yeah.
- 35:54Yeah.
- 35:54Yeah.
- 35:54So not really.
- 35:55Okay.
- 35:56But in a sense.
- 35:56That's actually interesting, right?
- 35:58Yes.
- 35:58Yeah.
- 35:59Because a lot of the best packaging systems, you know, whether it's, it's rust or, you know, Nix, they start from source, right?
- 36:07And they know exactly what's, you know, in the box.
- 36:09And then binaries are kind of like an optimization, right?
- 36:12It's like, you have a thing that you know exactly what is the binary and you can check like, oh, I don't have to build this thing from source.
- 36:19I can grab a binary somewhere.
- 36:20Right.
- 36:20The packaging is absolutely not like that.
- 36:23Like if you build a wheel and you have an sdist, I mean, you have no idea if they're the same thing.
- 36:28If you, you know, you cannot rebuild the wheel from the sdist unless, you know, you use very, very well predefined constraints.
- 36:36Yeah.
- 36:36Yeah.
- 36:36I hadn't really thought about that either, but that is an interesting juxtaposition.
- 36:40Like the binary stuff that is all binary is shipping as source, but the interpreted stuff is shipping as binary.
- 36:46And I think part of the reason, or maybe the main reason is if we're talking about binary stuff for Rust, well, it's all Rust that's compiled, but for Python, it's this mix, this
- 36:57crazy mix of all these different libraries that are not, none of them are Python, but they're all binary in the end.
- 37:03And so you've got to get around the fact like, well, I don't have a Fortran and a Haskell compiler, so I can't run this project, you know?
- 37:10There's something quite amazing to Python in general, which is called the CFFI.
- 37:15So the C foreign function interface, which essentially allows you to build any sort of application you want in whatever language.
- 37:23As long as you're compatible with CFFI standard, you can call it from Python and it's incredible and amazingly useful.
- 37:33But to come back on what Ralph was saying, a lot of the design actually from WeR variant has been inspired by a system that is called Spack that was designed for supercomputers.
- 37:47And we use this, especially around the design of CPU variants to kind of get a lot of inspiration around a package called Spack that is just, from my perspective, pure brilliance in some of design.
- 38:02Just my words, but in my opinion, but I really think they got the thing right.
- 38:08It's just beautifully designed.
- 38:10Everything is static and JSON-fired and it's extremely easy to scale and maintain.
- 38:15But yes, if you take all the kind of system designed to support the most specific deployment scenarios like SPAC, like Nix, or even in some cases, cargo, well, they mostly ship sources
- 38:29to go around this variant problem because that allows you to control the entire build chain essentially.
- 38:35And in some cases, maybe Ralph can talk about it, but Conda Forge also kind of take an approach that is similar to Nix to kind of go around these issues a little bit.
- 38:44Maybe Ralph, if you want to talk a little bit about that.
- 38:47Not quite because Conda and Conda Forge don't do source distributions at all.
- 38:52They just take a release and they build binaries.
- 38:54And if there are no binaries, you can't install it.
- 38:58But yeah, I would say that's a good point, right?
- 39:00We have people that worked on all these systems.
- 39:02Like one of Jonathan's colleagues at NVIDIA, Mike Sarahan, used to work on Conda.
- 39:07I contribute to Conda Forge as well.
- 39:09And so we have some ideas that originally came from Conda, some that came from SPAC.
- 39:14And the end result is nothing like, not exactly like any of those systems, but it takes some of the best aspects of them to enhance Python packaging.
- 39:22Not reinventing the wheel.
- 39:24I mean, maybe, but not too much.
- 39:27Yeah, not too much.
- 39:29But it's kind of, it's cool because I think, like, I feel like a lot of this work really got kicked off.
- 39:35We did an in-person summit.
- 39:37And I honestly can't remember when that was because my mind is such a blurb.
- 39:41March 2025.
- 39:42Thank you.
- 39:43Okay, so it was about a year ago.
- 39:44And there's a bunch of notes about this.
- 39:46And we had people from probably like, I don't know, I'd have to guess 20 different companies, maybe more, all in person for a day, just talking about these problems.
- 39:56And a bunch of people presented on their own open source projects and how they intersect with, like, we had people from PyTorch, people from the JAX team, just talking about like, how, what their concerns are, like, what's working well for them, what's not.
- 40:07And so, you know, similarly to how we've, I think a lot of the design has really been influenced by like, what are other designs?
- 40:14What's the prior art and like, what's working well?
- 40:17You know, a lot of it was also informed by like, just talking to a bunch of people across the industry and understanding like, what their concerns are.
- 40:24And so, at least from my perspective, having not, honestly, by calendar time, I have not been involved in Python that long.
- 40:31But it's been like, definitely the most like cross company, cross project, cross organization effort I've been involved in by a lot.
- 40:38We try to replicate a model that I really like in the Python community that was faster cpython.
- 40:46We try to philosophically create the packaging child of faster cpython.
- 40:51But, and that's how we created WheelNext.
- 40:54It was all the amazing work that the faster cpython community did on the cpython side, and kind of creating the same synergy, but around Python packaging.
- 41:05And that's why it was.
- 41:06I would almost say it's even, you know, quite a bit more diverse.
- 41:11At least my understanding is faster cpython is primarily like funded and created by Microsoft, and it kind of turned into a community thing.
- 41:18But like, all the money came from Microsoft, I think.
- 41:21I think the majority of the people were working in a team inside Microsoft, at least.
- 41:25And here, we've got NVIDIA, Meta, the PyTorch folks at Meta.
- 41:30We got some contributions from AMD and Intel, and then Astral, Quansight.
- 41:35Large amount of the time that we've been able to spend at Quansight came from funding from Red Hat, who came with their own problem sets.
- 41:43And, you know, so, and that's just the most prominent contributors.
- 41:47So there's like at least 10 companies that started investing in this, because it solves so many problems.
- 41:53Yeah, that's really encouraging as well.
- 41:53On the left side, you'll see a section called Who We Are.
- 41:57Yeah, so I pulled up this project, Wheel Next.
- 42:00And, you know, Ralph, this is yours?
- 42:02Yeah, who are we?
- 42:03And the name of also the open source project that contributed time and expertise.
- 42:09Yeah, AMD, Anaconda, Aprio, Astral, Google, Huawei, Intel, Lap, Lab, Meta, NVIDIA, Preferred Networks, Quansight, and Red Hat.
- 42:18That's a bit of a group working on this.
- 42:21And you can see just above all the different open source projects that different OSS and lead maintainers have contributed time and energy to kind of try to make this move forward.
- 42:32So it is quite a few people.
- 42:35Yeah, yeah.
- 42:35Most notably, maybe CuPy and PyTorch, possibly.
- 42:38I mean, they're all...
- 42:39Maybe one company that is not too well known, undeservingly, because they should, which is Probabl at the bottom that you mentioned, which is essentially the support company behind scikit-learn.
- 42:52So if people don't know it, Probable is essentially representing Scikit.
- 43:00Yeah, so this is wheelnext.dev.
- 43:03This is basically the website for the group, the working group, something like that.
- 43:08Yep.
- 43:09We try to leave our notes, our thinking, our drafts.
- 43:13One aspect that I really like on the work that we did is that it kind of felt like a startup.
- 43:18We were making a mock-up and iterating very fast and getting feedback.
- 43:23And this, I don't like this.
- 43:24I don't like this.
- 43:25I don't like change it.
- 43:27I worked really closely with two people, one from Quansight, one from Astral, Constantine and Michel.
- 43:34And we did so many hours of work.
- 43:37So many different prototypes, iterating, exposing the work to people, collecting feedback, adjusting, and repeating the cycle so many times until we finally got to something that we thought was reasonable.
- 43:52And that's where we started to write the peps.
- 43:54But that process took us a year.
- 43:57All right.
- 43:58Well, we should probably jump into the peps.
- 44:00And I'll tell you what, you all have quite the authorship attribution here.
- 44:04But also, I believe, correct me if I'm wrong, that this PEP is notable in that it's the longest PEP ever.
- 44:10Something like that, right?
- 44:12Yeah.
- 44:12I don't know if it's an achievement to be proud of.
- 44:17It's the most powerful PEP ever.
- 44:19Yes.
- 44:20No, no.
- 44:20It's a super PEP.
- 44:21So much so that we're talking about PEP 817 wheel variants, which is the variant thing that we actually are talking about, not the other variants, beyond platform tags.
- 44:31But then so much so that it actually got kicked to the curb for like, well, what is the minimal viable PEP of this pep?
- 44:38So we can take it in steps.
- 44:40And Jonathan, you just told me really good news that pep, so you spun off this other pep, PEP 825 wheel variants package format, which is smaller, which still has a significant authorship.
- 44:52But that this was just, it says draft, but is that true?
- 44:56Yeah.
- 44:56Yeah.
- 44:57So peps, maybe Ralph, you want to discuss a little about what's the process for PEP that I think that's important.
- 45:04Yeah.
- 45:04So when you submit a pep, it first, you know, submit up on GitHub.
- 45:08And then there's a group of folks called the PEP editors who basically just edit, you know, they review it for clarity, you know, language, consistency with other peps and so on.
- 45:17So they don't really look at the content of what you're proposing.
- 45:21So it's just, as long as it's clear, they're happy, you merge it in.
- 45:24But because the first PEP was already so long, that process took like over a month already.
- 45:29But at that point, it's merged as draft.
- 45:31And then you go to the Python packaging discourse where you say, okay, here's our PEP.
- 45:38You know, now please let's start the actual community review.
- 45:41And then basically anybody with an opinion can weigh in.
- 45:44And it's just, it's a forum.
- 45:47They're not, it's not even a threaded forum.
- 45:49So it's just one long thread of comments, which tends to make it like a little challenging.
- 45:54You know, the more complex the topic gets, the harder it is to make sense of this conversation.
- 45:59It's really hard to have a threaded multi-component conversation.
- 46:04It is.
- 46:04Exactly.
- 46:05So that's one of the reasons it's now split into smaller parts.
- 46:09So you can at least have separate threads about different topics, right?
- 46:12So, and because especially not all of the parts of the design apply to everybody.
- 46:17When we're talking about installers, we want to hear primarily from the authors of uv and pip, Poetry, Hatch, PDM.
- 46:26But if we're talking about how do you build a wheel, well, we have to talk primarily to setup tools, scikit-build-core, Meson Python, the build backends.
- 46:36And, you know, the index server the same, right?
- 46:39Do you want to know that the PyPI maintainers are happy?
- 46:42So that's why, you know, organizing this review and chopping it up into a complex part, it's still going to be really hard to get the right amount of feedback.
- 46:50But we now have like the first PR, you know, the first merge path in draft status.
- 46:56So it's going to only be accepted once the whole community review process is done.
- 47:02And probably what will happen is it's going to be provisionally accepted only because we know there's like three more paths coming for the other parts.
- 47:10And eventually, like the, you know, you want all four to be, you know, working and accepted.
- 47:15Like, you know, we now have prototypes, but, you know, we want the prototypes for the final design and have like, you know, the tool author say like, yeah, this works for us before you really go from provisional to actually accept.
- 47:26Amazing.
- 47:27So this is part of what I get out when I said at the beginning that this touches like every part of the packaging stack.
- 47:33There's just like, it's very hard to break it up into, I mean, that's what we're trying to do in some sense.
- 47:39But like, it's from the start, it's been hard.
- 47:41It's hard to, there aren't necessarily super great cut points because it does affect how you build packages, how you publish them, like how they get hosted and served from the registry, how installers like look at them and understand them.
- 47:53All of those things, like marker syntax, all of that stuff gets impacted in different ways.
- 47:59It's very funny.
- 47:59We're prototyping this for a year.
- 48:03We ended up pretty much forking the entire ecosystem.
- 48:06PIP got fork, uv got forks, warehouse got fork, packaging got fork, like absolutely every package in the ecosystem, but it didn't being forked because we needed to test our implementation.
- 48:21And we needed to verify.
- 48:21The goal, of course, is to unfork those things.
- 48:24Yes.
- 48:24Like over time.
- 48:25It's a re-merge pack, but we needed to have a playground to be able to experiment and see how the concept that we were developing was functioning in pip.
- 48:36And then in packaging, but then also in setup tools.
- 48:39And then in scikit-build-core.
- 48:42And then in meson-python.
- 48:43And it just keeps spreading essentially to every single corner of the packaging, installation, and distribution aspect of Python.
- 48:51So that was pretty funny.
- 48:53Yeah.
- 48:53What ecosystem you got in?
- 48:56I think you have fork in uv, or I guess technically it's just a branch that Constantine on our team on here on the PEP has been, who's been super involved.
- 49:06Oh, thanks.
- 49:07Who's been super involved, you know, throughout and done a ton of work on basically implementing the standard in uv.
- 49:12So we have like a working implementation that we've used to, yeah, you can actually install it from, you know, we basically distribute it to a slightly different URL.
- 49:22So you can install it and test it.
- 49:24But yeah, that's been, that fork has evolved a lot, or that branch has evolved a lot.
- 49:29And it's been a lot of work to, I mean, it's been incredibly helpful for the design process for us to understand like what's hard, what's easy.
- 49:35And then I also think it's important for PEPs just to have like working implementations too.
- 49:40And I mean, a lot of people agree that's not an awful point, but that's been one of the goals too, is to show what it's like in practice and that it actually works.
- 49:47So people want to play around with this.
- 49:48An easy way might be to try to use this fork.
- 49:52We put a lot of work to actually make it, go ahead and try it.
- 49:56Because I think it's, I personally have a lot of like admiration for the work done in free threading Python, especially to the PEP.
- 50:05And I think Sam Gross, who is the main author, managed to make significant amount of progress as he was coming up with prototypes that are, it's not just my word.
- 50:15Let me show it to you.
- 50:16It works.
- 50:18And there was so much skepticism around that idea of free threading Python.
- 50:22He had to, had to show, not tell.
- 50:24But I think if we didn't do the work similarly on variant enabled wheels, people would have told us, oh, well, resolution is too slow.
- 50:34It's going to slow down installers too much.
- 50:36And Astral is probably one of the installers that care the most about speed.
- 50:41So we need to both convince us, but also Charlie's and his team to be, hey, it's not going to slow down anything.
- 50:47Yeah.
- 50:48And we had plenty of feedback on that front too.
- 50:49Well, during the design, we were like, no, this is going to be too slow.
- 50:52Or like, this is like a better way to do it, et cetera.
- 50:54But, but I like, I mean, I like this little snippet.
- 50:57Cause like, this is basically like, if you haven't felt this pain, it might not be meaningful to you.
- 51:02But if you've like worked with PyTorch, like this is kind of like, this is what we want to enable.
- 51:06Right.
- 51:06Is like, you don't, you don't have to like configure a specific index URL that like captures the CUDA variant or anything like that.
- 51:12Like you just say, hey, install Torch.
- 51:15And then in this variant enabled build, uv would, it would go look at Torch.
- 51:19It would see, okay, Torch, you know, it has different variants for different CUDA versions.
- 51:25And here's how I inspect, you know, what CUDA version I should use on your machine.
- 51:29And then it would pick out the right version based on what's supported by the GPU that's running.
- 51:32Like that should all happen and users shouldn't have to think about configuring it effectively is like what we were, what we have been working towards.
- 51:39And in the future, the first line doesn't exist because right now the first line is just here to install this variant enabled.
- 51:44Yeah.
- 51:44That just installs the fork.
- 51:46Yeah.
- 51:46And for people listening and not watching what they mean by this, there's three lines here to say how to use this.
- 51:51It says curl.
- 51:51I'm sorry.
- 51:52Basically.
- 51:52Yeah, no worries.
- 51:53It's the install statement for uv, which is typical, except for that it overrides the.
- 51:59The download URL.
- 52:00The download URL.
- 52:01It's a different URL, which is wheelnext.astral.sh.
- 52:05We serve, we distribute a separate variant enabled experimental quote unquote prototype build.
- 52:10Right.
- 52:10And then you just create a virtual environment, uv, V and V, and then you just uv pip install like normal, but it handles this.
- 52:16And, you know, Charlie, we spoke, I think on the pyx episode about just how large some of these things are like PyTorch and others that are compiled there.
- 52:26You can't just come download everything, all the variations into one wheel.
- 52:30I mean, I guess you could, but it'd be crazy, right?
- 52:32That's actually a big benefit, right?
- 52:34Like right now you go to PyPI, you download the PyTorch wheel.
- 52:37It'll be about 900 megabytes.
- 52:40You could make it small.
- 52:41You know, part of the reason it's so large is, again, these bad binaries, right?
- 52:44Like the NumPy ones are like a few megabytes.
- 52:47The PyTorch ones have a bunch of CUDA inside, like for five or six different CUDA architectures.
- 52:52And, you know, it floats very, very quickly.
- 52:54And actually the PyTorch team has to try incredibly hard to stay under one gigabyte.
- 52:59If we have variants, we can just slim it down to one CUDA architecture per wheel, you know, so you can go down to like, you know, 200 megabytes or so, 250 maybe.
- 53:09But it's way better for, you know, both for index servers, it's better for users.
- 53:14It's going to be pretty slow too.
- 53:16The only thing it's not better for it's CI servers that have to build all these different things if you start sharding.
- 53:23But that's a one-time cost that at the end ends up being.
- 53:26It's much better to have a slight increase one time and massive decrease scalable, essentially.
- 53:33You build it once, it gets installed a million times.
- 53:36That's a massive difference.
- 53:38And, you know, it's also better for the warehouse folks like PyPI.
- 53:43And it's easy for people to just assume pip install, uv pip install, that sort of stuff is going to work.
- 53:49But the cost of just the bandwidth in that infrastructure is astronomical, which is crazy.
- 53:55So this is going to be a major benefit for bandwidth.
- 53:59Yeah, and like also like install speed.
- 54:01You'll also benefit from that because you're no longer downloading as much stuff to actually install PyTorch.
- 54:07I mean, if you use uv, it's got some really good caching and it's pretty quick.
- 54:12Oh, but it doesn't multiply your bandwidth by magic.
- 54:16I wish.
- 54:18Charlie, if you find a solution to that.
- 54:20I haven't yet.
- 54:22But yeah, if you're downloading Torch and all the NVIDIA, all the CUDA stuff, it's, yeah.
- 54:27It's hefty.
- 54:27It's a large number of megabytes.
- 54:31Let's talk real quick about the PyPackaging Native Guide.
- 54:34And then I want to get an update on pyx real quick before we go.
- 54:37So, Ralph, this is your project, right?
- 54:39Tell us about this.
- 54:39I'll be sure to show it.
- 54:41Okay, so I've been watching discussions about some of the topics we've talked about in this episode, you know, since 2010 or so in Python packaging.
- 54:51And even back then, long before we had wheels, you know, NumPy, for example, had different .exe installers that we would upload to PyPI.
- 54:59And, like, there would be one named underscore sse2, one underscore sse3.
- 55:04And, like, user had just the right .exe and install it on their Windows machine.
- 55:09What?
- 55:09Wow.
- 55:10Oh, I have no idea.
- 55:11Okay.
- 55:11Yes, it was not fun.
- 55:14And actually, this was by far the hardest thing when I became NumPy release manager because we had to build these things on Linux under Wine.
- 55:21And there were no instructions and there were really janky scripts.
- 55:24So, it took me three months to get the first release out.
- 55:27But, yeah, so we, I saw all these discussions about, you know, this was sse2 and sse3.
- 55:34And, like, you know, the pip authors and, you know, most of the people who work with pure Python, like, you know, the DevOps folks, the, you know, web framework folks, they had no idea about this.
- 55:44And usually, these conversations went in circles because when you explain something to one person, the next person would come in and, like, you know, this is endless mailing list threats.
- 55:52That would never go anywhere.
- 55:53So, after, you know, seeing that for 12, 13 years or so, I, you know, finally got tired of that.
- 55:59And I thought, I'm going to write a reference site that explains the problem.
- 56:03I don't want to propose any solutions, but just explain the problem.
- 56:06So, the next time someone starts a new conversation about, you know, SIMD extensions or about GPUs or, you know, about some of the issues with mixing, you know, source and binary distributions.
- 56:18Just link to this site.
- 56:19Like, please use that as our best, you know, approach at trying to summarize a problem, you know.
- 56:24So, we have a baseline to start talking about solutions.
- 56:27And I think, you know, Jonathan, you know, is one of the people who saw this.
- 56:30I think a lot of people read this.
- 56:32But it was a nice basis to, you know, just point at this as, like, there are your problem descriptions.
- 56:38And, you know, for the GPU part, like, NVIDIA folks really helped to make sure that all the explanations of the problems were correct.
- 56:46So, when we started Wheel Next, we could just start talking about, like, okay, what are the solutions here?
- 56:51This website is absolutely incredible.
- 56:54It's amazing.
- 56:55Yeah, it's amazing.
- 56:56Thanks to the work that Ralph and every contributor to this website have made.
- 57:01This is by far the best explanation anywhere on the internet to all these packaging issues.
- 57:08And I really like the perspective that Ralph has took, which is don't state the solution.
- 57:12Just focus on stating the problem very clear.
- 57:14And then with Wheel Next, we try to take the exact flip coin, flip side of the coin, which is don't focus on the problem.
- 57:21It's already explained.
- 57:23Just focus on proposing one solution to some of the problems.
- 57:26And this is how we created Wheel Next.
- 57:28I love it.
- 57:29You know, one of the big problems, challenges, I guess, is if you don't fully understand the problem space, you could be debating two different things.
- 57:37And one person sees a really important angle, the other person doesn't even see that angle.
- 57:41They have a different perspective that they're arguing for optimizing for.
- 57:45And so, yeah, it's sort of a little bit like the Wheel Next stuff.
- 57:48Like, let's get everyone involved and see all the angles and then discuss it, right?
- 57:52Exactly.
- 57:52Well, you know the saying, a problem well stated is a problem half solved.
- 57:57So, this is exactly what we are trying to say.
- 58:02I love it.
- 58:02All right, I want to get a quick update on pyx since I feel like, Charlie, you're right in the middle of this.
- 58:10I know pyx was looking to solve some of these problems as well.
- 58:14Give us the elevator pitch and just, we have a whole episode on this from, I don't know, six months ago or something.
- 58:19But, yeah, give us the, what's the situation here and does this change things on how you're handling it and make things easier?
- 58:24Yeah, yeah, yeah, for sure.
- 58:26So, like, yeah, pyx is our hosted package registry and it's in beta right now.
- 58:32So, we're live with a bunch of great customers.
- 58:37The goal of pyx is basically to enable us to solve, like, more of the packaging problems that we see in the uv issue tracker by having our own registry that we think is well implemented and solves problems that we see that other registries don't really solve.
- 58:51So, like, basically from the start, the way that we've approached the wheel, these, like, problems around the GPU stuff is from, like, two perspectives.
- 59:00And in pyx, we're really just focused, in terms of how it overlaps with wheel variants, we're really just focused on the GPU part.
- 59:07But the way that we've approached it has basically been try to push the standards forward as much as we can.
- 59:14And that's what we've been doing in this effort.
- 59:15And then simultaneously try to figure out how we can help users, like, until the standards change.
- 59:21And so, pyx has mostly been, has more been in that second camp of, like, assuming the standards don't change because we don't want to, we don't want to, like, unilaterally start changing a bunch of things, like, without going through the process.
- 59:32How can we make the world, like, a little bit easier for people who are working with this kind of stuff?
- 59:36So, for example, like, in pyx, we take a lot of packages that are, like, PyTorch extensions or need to be built against CUDA, and we, like, build those.
- 59:46Like, we build them across a wide range of, like, CUDA versions, PyTorch versions, Python versions, CPU architectures, and we make those available to users.
- 59:53So, it doesn't solve the core problem of, like, how do you build and distribute this stuff?
- 59:58But it does mean that, like, if you're operating within the constraints of, like, the current set of standards, we can make people's lives easier by making it so they don't have to build so many things.
- 1:00:06Like, we build them well, they all work together, all that kind of stuff.
- 1:00:10So, that's what, like, we've been focused on.
- 1:00:12And I think, like, looking forward, like, our goal is to support WheelNext, like, as soon as, like, sorry, Wheel Variants, like, as soon as possible, and, like, put those into the registry.
- 1:00:21So, as soon as we feel like that's a, you know, a feasible thing to do on the registry, we'll support it in pyx and support it for, like, our users and our customers.
- 1:00:29But in the meantime, it's kind of been, like, a parallel track effort of pushing forward on all the WheelNext work and standards, and then just trying to, like, solve immediate user problems without changing standards, like, partly through the registry.
- 1:00:40Things are going good at pyx?
- 1:00:41You're making progress?
- 1:00:42Yeah.
- 1:00:42Getting closer to public launch?
- 1:00:43Yeah, we're making progress.
- 1:00:44Yeah, yeah.
- 1:00:45No, it's good.
- 1:00:46Customers are growing.
- 1:00:47Numbers are growing up.
- 1:00:48It's good.
- 1:00:48Awesome.
- 1:00:49People want to try pyx?
- 1:00:50What are they?
- 1:00:51Are they?
- 1:00:51They can join the waitlist here.
- 1:00:53Yeah, yeah.
- 1:00:53This is, you know, you just, we have a, yeah, or you can go to astral.sh.pyx, and we look at all the responses, and we basically onboard people one by one.
- 1:01:01So, talking about when is this stuff going to be ready, you'll be able to adopt it, I guess maybe that's a good place to close out our conversation here is, what's the timeline?
- 1:01:10What are expectations?
- 1:01:11How are things going?
- 1:01:12What's next?
- 1:01:13It's a great question.
- 1:01:14Everything's open source.
- 1:01:15It's a two-month delay.
- 1:01:20No.
- 1:01:20What's the party line on this question?
- 1:01:25Oh, gosh.
- 1:01:27Well, it's, I liked, we have a joke inside, I don't know if it's inside widespread inside WeOnX, but we call this the Barry's fourth law, Varso fourth law, I don't remember exactly how, which is essentially make an estimate, multiply it by two, and change the unit.
- 1:01:44So, if you think it's going to take six months, it's one year.
- 1:01:47Oh, no.
- 1:01:48Change the unit, one decade.
- 1:01:50And it's a running joke that we have that I think is really good.
- 1:02:00Realistically, I think it depends on where are we going to set the bar for starting to roll things out.
- 1:02:09So, as Ralf was saying, we'll probably see some provisionally accepted.
- 1:02:13But as we get to that point, some of the stuff will be possible.
- 1:02:18For example, I expect that little by little, we can start experimenting with things without getting necessarily to the absolute final stage.
- 1:02:28But the full feature will be available to the app at the last stage.
- 1:02:32So, complicated question to answer.
- 1:02:35We hope that it's not going to take too many years.
- 1:02:38I'll make a connection back to pyx here.
- 1:02:40Because I think, you know, there's part is like, okay, there's four PAPs that need to be reviewed.
- 1:02:45Probably we need to update some prototypes here and there.
- 1:02:48It's probably going to take, you know, the better part of this year.
- 1:02:51At that point, you know, you have accepted PAPs, right?
- 1:02:53But then PyPI needs to be updated.
- 1:02:55Like, you know, all the tools that, like Twine, would need to be updated.
- 1:02:59Like, there's a new metadata version.
- 1:03:01So, everything that consumes that needs to be updated before, you know, package authors can actually start producing these wheels and upload them to PyPI.
- 1:03:10So, that's going to not be this year, right?
- 1:03:12There's a very long tail of, you know, how the implementation rolls through the ecosystem.
- 1:03:17And then you have to wait until users get newer tools.
- 1:03:20And then, only then can you start uploading wheels.
- 1:03:22So, I'm going to poke at Charlie a bit here.
- 1:03:25Because one of the advantages of having a separate registry is, you know, plus the ability to rebuild everything.
- 1:03:31You can start using variant wheels, like, the moment that everything is accepted.
- 1:03:36It's way sooner.
- 1:03:36I know.
- 1:03:36It's way sooner.
- 1:03:36Yes.
- 1:03:37Have you thought about that?
- 1:03:38That is true.
- 1:03:39Yeah, yeah, of course.
- 1:03:40Yeah.
- 1:03:40I think from our perspective, we're mostly like, do we feel like the design is done or how much turn will there be on the design?
- 1:03:47But yeah, we're definitely in a position to, like, start building and distributing this stuff much, much sooner.
- 1:03:51UV has a second advantage, which is I think they have a much shorter tail of users in terms of version.
- 1:03:57I think uv users end up on a much more quote-unquote recent version.
- 1:04:02If you look at pip, I think, I don't remember the statistic on top of my head, but a still significant portion of users use five-year-old version of pip, which I don't even know which version of Python.
- 1:04:12It was 3.9 or something.
- 1:04:15So it is, uv is able to move a lot faster, but also the users are more reactive.
- 1:04:21That's a very interesting point.
- 1:04:23A very interesting angle.
- 1:04:24I mean, I think a lot of people who are very tuned into the Python space have switched to uv, started using uv.
- 1:04:30And there's probably a lot of people who don't read the newsletters, don't listen to the podcast, and so on.
- 1:04:35And they know pip, and they just keep on PIPing, which is fine.
- 1:04:38I'm not knocking it.
- 1:04:39But, you know, it means not only are they using pip, they might be using an older version of Python because they don't want to shake it up.
- 1:04:47And, you know, those are going to be the long tails that are going to be hard.
- 1:04:50I guess one more thought about what's next here before we call this a show here.
- 1:04:55What is the minimal?
- 1:04:56We talked about PEP 825, the minimal PEP.
- 1:04:59What is the minimal amount of adoption, right?
- 1:05:01So if the top five biggest data science and machine learning libraries adopt this and the installer tools like uv and pip support it, that actually alone might be a really big benefit if all the other packages are just ignored, right?
- 1:05:15So that's way more achievable than every single package that has native code has all these specifiers, right?
- 1:05:22What's the minimum level of adoption?
- 1:05:24I'd say that, I mean, the minimum level at which you can call it a success, yeah, five is probably not that far off.
- 1:05:30The benefits start to accumulate quickly.
- 1:05:32But I would expect once packages like PyTorch start adopting this, especially in the deep learning space, you know, this will be adopted very widely, very quickly because it solves so many problems.
- 1:05:43Like many of the most popular packages like VLLM with very large development teams and very large numbers of users.
- 1:05:50If you look at their install pages, it's like, you know, it's like a puzzle book.
- 1:05:54You just don't know how to install this stuff and they don't have wheels on PyPI and they have their own extra index servers.
- 1:06:00And it's not for lack of trying.
- 1:06:02It's not for lack of trying.
- 1:06:03Like those teams like put a lot of effort into trying to make it easier to install, but they basically all run into different kinds of roadblocks.
- 1:06:09I think five packages is what you'll get after maybe two weeks.
- 1:06:14After a month, you will get twice that amount and probably a quadratic progression for quite a few weeks.
- 1:06:21But it's especially in the scientific compute space and maybe machine learning to be more specific.
- 1:06:27Well, the moment that it works, so many packages will switch.
- 1:06:31Like so many.
- 1:06:32If you just take PyTorch, half of its dependencies will probably activate variant mode.
- 1:06:36And then the people that build on top of PyTorch are people who build on top of Jax.
- 1:06:41So just that, you end up with at least 50 packages in a matter of a few months.
- 1:06:47Yeah, I'm just thinking there's probably a very small set that are feeling the most pain.
- 1:06:52You could do direct outreach to just the most important projects and get that adopted and make a really big difference, even if it's not every package.
- 1:07:00But the funny part is that most of the packages that would be interested, that we would reach out to are already part of WheelNext.
- 1:07:08Because they in some way find the pain pretty significant and are starving for a solution.
- 1:07:16They know.
- 1:07:17They already know.
- 1:07:18All right, let's call it a show, folks.
- 1:07:20Let's final call to action.
- 1:07:21People out there listening, either they're maintainers of packages or they're users of these libraries or they got their own open source project.
- 1:07:30They're seeing the light.
- 1:07:31They want to get involved.
- 1:07:32They want to try it out.
- 1:07:33What do you tell them?
- 1:07:34Well, first, it would be great if people were to come and discuss.python.org.
- 1:07:39That's where the community is trying to aggregate to discuss all these different proposals.
- 1:07:45So I think the more people get involved, the more better.
- 1:07:51But also trying the different packages that we are trying to publish that Charlie's has been helping us and his team has been helping us to create a sort of end-to-end experience.
- 1:08:02I think right now we have example of Linux, macOS, and Windows.
- 1:08:08It works on different type of hardware, different type of CPUs, different type of GPUs.
- 1:08:13It works pretty broadly, and we wanted to give a sort of sample flavor of what could be a variant-enabled world.
- 1:08:22Yeah, I'd say, yeah, for the majority of listeners, they're not going to be packaging tool authors, right?
- 1:08:26So those are the ones you would expect to participate in the review primarily.
- 1:08:31But I'd say if you're a user of any of the packages we mentioned, just try it out.
- 1:08:35You know, download the uv variant-enabled installer.
- 1:08:39And if you're a package author and we haven't mentioned your package, but it will solve a problem for you, get in touch.
- 1:08:45Because I think that's maybe the most relevant part here.
- 1:08:49There's at least hundreds, maybe thousands of packages that we think we have answers for.
- 1:08:55But if their solution or their problem statement is slightly different, I think now would be a great time to learn and make sure we cover as many use cases as possible.
- 1:09:02Yeah, I mean, I guess the only thing I'd say is ideally the average user won't even have to think about this, right?
- 1:09:08And hopefully they just get it through uv or through pip or whatever in the long term.
- 1:09:13But that may take time.
- 1:09:15But that's our goal, certainly.
- 1:09:16Yeah, it's all behind the scenes.
- 1:09:18They don't know.
- 1:09:18But certainly, if it solves a problem, reach out, be part of it.
- 1:09:23Jonathan, Ralph, Charlie, thanks for being on the show.
- 1:09:25It's been great.
- 1:09:26Keep up being around.
- 1:09:26Thanks for having us.
- 1:09:28Bye.
- 1:09:29Bye-bye.
- 1:09:29Bye.
- 1:09:30This has been another episode of Talk Python To Me.
- 1:09:32Thank you to our sponsors.
- 1:09:34Be sure to check out what they're offering.
- 1:09:35It really helps support the show.
- 1:09:37This episode is brought to you by Sentry.
- 1:09:39You know Sentry for the error monitoring, but they now have logs too.
- 1:09:43And with Sentry, your logs become way more usable, interleaving into your error reports to enhance debugging and understanding.
- 1:09:51Get started today at talkpython.fm/sentry.
- 1:09:54And it's brought to you by Temporal, durable workflows for Python.
- 1:09:58Write your workflows as normal Python code and Temporal ensures they run reliably, even across crashes and restarts.
- 1:10:05Get started at talkpython.fm/Temporal.
- 1:10:09If you or your team needs to learn Python, we have over 270 hours of beginner and advanced courses on topics ranging from complete beginners to async code, Flask, Django, HTML, and even LLMs.
- 1:10:21Best of all, there's no subscription in sight.
- 1:10:24Browse the catalog at talkpython.fm.
- 1:10:27And if you're not already subscribed to the show on your favorite podcast player, what are you waiting for?
- 1:10:32Just search for Python in your podcast player.
- 1:10:34We should be right at the top.
- 1:10:35If you enjoyed that geeky rap song, you can download the full track.
- 1:10:38The link is actually in your podcast blur of show notes.
- 1:10:41This is your host, Michael Kennedy.
- 1:10:43Thank you so much for listening.
- 1:10:44I really appreciate it.
- 1:10:45I'll see you next time.
- 1:10:46Bye.
- 1:11:16Bye.