Latest / Talk Python To Me / #481: Python Opinions and Zeitgeist with Hynek
Transcript
- 0:00Hennick has been writing and speaking on some of the most significant topics in the Python space,
- 0:04and I've enjoyed his takes. So I invited him on the show to share them with all of us.
- 0:08This episode really epitomizes one of the reasons I launched Talk Python nine years ago.
- 0:13It's as if we run into each other at a bar during a conference, and I ask Hennick,
- 0:17so what are your thoughts on, and we dive down the rabbit hole for an hour.
- 0:22I hope you enjoy it. This is Talk Python To Me, episode 481, recorded October 8th, 2024.
- 0:30Are you ready for your host, please?
- 0:31You're listening to Michael Kennedy on Talk Python To Me.
- 0:35Live from Portland, Oregon, and this segment was made with Python.
- 0:39Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:45This is your host, Michael Kennedy. Follow me on Mastodon, where I'm @mkennedy,
- 0:50and follow the podcast using @talkpython, both accounts over at fosstodon.org,
- 0:56and keep up with the show and listen to over nine years of episodes at talkpython.fm.
- 1:00If you want to be part of our live episodes, you can find the live streams over on YouTube.
- 1:05Subscribe to our YouTube channel over at talkpython.fm/youtube and get notified about upcoming shows.
- 1:12This episode is brought to you by WorkOS.
- 1:14If you're building a B2B SaaS app at some point, your customers will start asking for enterprise features like SAML authentication,
- 1:21SKIM provisioning, audit logs, and fine-grained authorization.
- 1:25WorkOS helps ship enterprise features on day one without slowing down your core product development.
- 1:31Find out more at talkpython.fm/workos.
- 1:36And this episode is brought to you by Bluehost.
- 1:38Do you need a website fast?
- 1:40Get Bluehost.
- 1:41Their AI builds your WordPress site in minutes, and their built-in tools optimize your growth.
- 1:46Don't wait.
- 1:47Visit talkpython.fm/bluehost to get started.
- 1:51Eric, welcome back to Talk Python.
- 1:54Good to see you, man.
- 1:55Thanks for having me.
- 1:56Yeah, it's great to have you back on the show.
- 1:58I've been enjoying a lot of your articles and your videos lately.
- 2:02And you know what?
- 2:03Maybe we should just get together and have an opinion piece by Hennick.
- 2:07I can do opinions.
- 2:09Yeah, yeah, I know.
- 2:11You're great, Adam.
- 2:12And so we're going to talk about a whole bunch of different things.
- 2:15A lot of the things that you've been talking about, I'm also super interested in.
- 2:19Some cool articles you've written on Docker.
- 2:22UV, last time you were on, we talked about running in production.
- 2:26And maybe we can review that a little bit and just get some of your takes to see what's changed
- 2:31and what's still the same over the last couple of years.
- 2:33But all those things are awesome.
- 2:34We're going to talk about some of your open source projects.
- 2:36It's going to be a journey.
- 2:38It's going to be fun.
- 2:39Now, before we jump into all that, you know, it's been a couple of years since people heard
- 2:43you on the show.
- 2:44Just a quick background about who you are.
- 2:45All right.
- 2:46My name is Hennick.
- 2:47I usually just go by my first name because it's already overwhelming to most people to pronounce
- 2:52that one correctly.
- 2:53Hi, Brian.
- 2:53My last name is Slavak.
- 2:55There's really not a lot of Hennicks around.
- 2:57So I'll just stick to the first name.
- 2:59So as you can hear, I'm a Czech living in Germany.
- 3:02And I live in Berlin.
- 3:04And I work for a rather small web hosting company and domain restaurant called Vario Media.
- 3:08So you probably haven't heard of us unless you speak German because we only serve the German
- 3:13speaking market.
- 3:13Like we do speak English, but our stuff is in German.
- 3:17And I would say you would call it individual contributor there.
- 3:20So we don't have managers.
- 3:21So everybody is.
- 3:22Since you are rather small, stability is like the key thing when I'm building systems.
- 3:27And that's like informs a lot of my opinions that you will probably hear today from me.
- 3:31Also, I like traveling and I don't want to be paged in the middle of my vacation.
- 3:35I'm having margaritas on a beach.
- 3:38Nobody wants to have to put down the margarita because someone took down the server.
- 3:42Also, I'm sure we're going to speak more about that.
- 3:45But also nowadays, I'm also a YouTuber.
- 3:47So that's also very exciting.
- 3:49And thanks for the shout out in the last Python Bytes.
- 3:52I really appreciate it.
- 3:53Yeah, absolutely.
- 3:54You're very welcome.
- 3:55Awesome.
- 3:55And I think it's interesting to have people who work on small teams, especially smaller companies,
- 4:02because that's the common theme of what people do.
- 4:05I don't have it pulled up right now.
- 4:07But if you go to the PSF survey and you look at some of the demographics stuff,
- 4:12it'll say, well, what size of a team do you work on?
- 4:16Is it one person, two to five, 500 to 1,000?
- 4:20The vast majority is the two to 10 different people.
- 4:24It's not Google, Facebook, Microsoft, right?
- 4:28So a lot of the advice that comes from these huge places is just, I don't know,
- 4:32it's not super relevant.
- 4:33Call it like Google cosplay.
- 4:36And I feel like my opinions that there are about this whole production thing are informed
- 4:41by my distinct dislike for these kind of things.
- 4:44They're just like some big tech influencers having opinions on stage and everybody wants
- 4:48to mimic it.
- 4:49And it just doesn't make any sense.
- 4:50Because as you said, the long tail is huge.
- 4:53Like most people work for small companies.
- 4:55It's just like that.
- 4:56The things you should do, they're just different.
- 4:58And you know, no disrespect to those companies, but, and they have a lot of employees, but in
- 5:02the general population, it's very small group of people who have hyperscaling clouds and
- 5:09whatnot that they're, they're worried about, right?
- 5:11I think I want to start this conversation off here by talking about some of the articles
- 5:17you've written.
- 5:17So I think this one's interesting.
- 5:20Let's talk about virtual environments.
- 5:21Love them.
- 5:22I do too.
- 5:23And you wrote this article called why I still use Python virtual environments in Docker.
- 5:28And I do as well.
- 5:29And I, when I didn't use Docker, I had them on my server as well.
- 5:34I feel like they're a really interesting, predictable way to package Python.
- 5:39And you know, you hear about them, obviously, oh, well, you're going to create a virtual environment
- 5:43so you can have multiple projects in your computer and so on.
- 5:46But Docker, there's only one app running.
- 5:49What's the deal with these virtual environments in Docker?
- 5:51Yeah.
- 5:51I mean, you just said it, right?
- 5:53It's a lot more predictable in its behavior.
- 5:55It's a technology that we use everywhere too.
- 5:58I just understand what this directory is doing.
- 6:01I find it very important that when I just go on a server or in a Docker container, I
- 6:06know what a file is doing or how things interact with each other.
- 6:10And I don't have to hunt them down somewhere else.
- 6:12Or another popular thing is that I write in the first paragraph is that people use pip install
- 6:17user and then set the Python user base directory.
- 6:20And sure, you can do all these things.
- 6:22But why would you, right?
- 6:24Like, what are you gaining?
- 6:25And it's a lot of vibes.
- 6:27And I admit it in the article too.
- 6:29But I just find it easier to reason about.
- 6:31And not everything.
- 6:32We don't use only things we need, right?
- 6:35Like we use affordances in other places too.
- 6:37So why not this as an abstraction over an application artifact?
- 6:41Because we don't have anything better in Python.
- 6:43Yeah.
- 6:43And also one of the things that you point out in your article that I think is really nice,
- 6:47that's already the way you're working on your computer.
- 6:50And so when you go to your Docker container, it's the same.
- 6:54You don't have to think about, well, if it's misbehaving in production, that's because,
- 6:58well, maybe we've changed the Python path or whatever, right?
- 7:02It's exactly the same as everyone else is working with.
- 7:05Yeah.
- 7:05We forgot to set an environment variable.
- 7:07Oh no.
- 7:08Nothing works now.
- 7:09Exactly.
- 7:11That's been interesting.
- 7:12Let's talk about Docker just a little bit as well.
- 7:15I think that alone is a pretty interesting choice.
- 7:19You said you work on smaller teams and maybe web hosting companies give this a little bit
- 7:26of a plus plus slant on Docker or not.
- 7:29But Docker, no Docker, right?
- 7:31A lot of people, I think, see containers and they think complexity.
- 7:34They think it's hard to debug.
- 7:36Like if something goes wrong in the container, it's just, it's opaque to me.
- 7:40What would you say to people that feel like containers are too complicated?
- 7:43Obviously the answer is, as always, it depends, right?
- 7:45It's a trade-off like everything else.
- 7:47We don't give Docker to our customers.
- 7:50Like our customers, we sell mostly LAMP, like mostly WordPress, which is very interesting these days.
- 7:55Oh my gosh.
- 7:57I don't know if we want to go down that one, but it is super, super turmoil right now.
- 8:02Yeah.
- 8:02No, we don't.
- 8:03Let's not go down.
- 8:03Matt doesn't know we exist.
- 8:05It's fine.
- 8:05Yeah.
- 8:07So you're trading off the things you just said, like the debuggability and everything
- 8:11against development velocity and reproducibility.
- 8:16So we, for example, we don't run Kubernetes because it's just too complex for us to run.
- 8:22And we run everything on premise.
- 8:23So like we do not have anything.
- 8:25We do not use any external services whatsoever.
- 8:27Wow.
- 8:28Okay.
- 8:28So everything runs into our own data centers.
- 8:31So we are European.
- 8:32So some of the things we have to do, other things we do because Germans like it that way.
- 8:36We can say, like, our data center is right there.
- 8:40You can look at it.
- 8:41No data leaves it.
- 8:43Yeah.
- 8:43If you have to, I can come look at my code through the little rack window.
- 8:47There it is.
- 8:48You can try right inside and see how fast you get tasered by the security side.
- 8:52It's all good.
- 8:53We use quite a bit of HashiCorp software.
- 8:55So we had Consul and Vault before for configuration, service discovery, and secrets.
- 9:00So we use Nomad because it was a logical add-on to run our applications.
- 9:06So that's where most of our web applications run.
- 9:09Like, everything that can run in containers usually runs in our Nomad cluster in Docker containers.
- 9:15And, yeah, sometimes there are a bit of a pain to debug.
- 9:20But you can SSH into a Docker container, right?
- 9:23Yeah.
- 9:24First hot tip of the day, there's this thing called BusyBox, which is, like, one command.
- 9:28And depending on what name you call it, it's something different.
- 9:31And it's just, yeah, it's just very, very few bytes.
- 9:34Like, you can look at it.
- 9:36And it's static.
- 9:37And it gives me things like ping.
- 9:39And I think Traceroute is in there, too.
- 9:42Yeah.
- 9:43I can do all these basic things in those containers, too.
- 9:46So it's not like it's a completely black box.
- 9:48You can SSH into them.
- 9:49It's no problem.
- 9:50A couple of thoughts.
- 9:50One, I agree with you on that.
- 9:52One more thing.
- 9:52One more thing before.
- 9:53Yeah, yeah, go ahead.
- 9:53We do not run SSH clients on those Docker containers.
- 9:57This is an affordance that we get from Nomad.
- 10:00And I'm sure other cluster managers have that, too, that they allow you to enter containers from the outside.
- 10:06So, like, you SSH into the host, and that from there you get into the container.
- 10:10Right, right, right.
- 10:11That's SSH service.
- 10:13Yeah, I do that as well on my stuff.
- 10:16I've recently moved a couple, maybe a year or two ago, to running, I used to have a bunch of smaller servers.
- 10:23I don't know.
- 10:23Maybe I bought into the cloud computing.
- 10:26There's a bunch of commodity boxes, and you can just make a bunch of little ones, and that's the way you do it.
- 10:30And eventually, I'm just like, you know what?
- 10:32I'm tired of dealing with all these servers.
- 10:34Putting them all in one thing, running everything in Docker, keeping it isolated.
- 10:38And it's been really excellent.
- 10:39So, similar access model there.
- 10:42I'm not sure this makes sense for you guys, but I think for folks who maybe expected still to SSH into their server and mess with it.
- 10:52Maybe this doesn't make sense for your customers, but maybe it does for you guys individually behind the scenes.
- 10:57I like to have a couple of tools, a little bit like you were saying with BusyBox, already installed in my Docker container.
- 11:03So, if I need to get into it and ask it questions, I can actually log in through some sort of Docker exec, you know, Docker exec, dash IT, sort of ZSH or bash or whatever, and ask it questions.
- 11:17What are your thoughts?
- 11:17Do you think if you put something like, oh my Zshell, so you have better command history while you're poking around, is that sacrilegious in a Docker container?
- 11:26Or how do you feel about this?
- 11:27You're asking me if you have a fancy.
- 11:29Well, we are sacrilegious in a different way.
- 11:31Like our normal servers that we SSH into, we run fish on them.
- 11:34Because most of us like fish.
- 11:36Yeah, sure.
- 11:36We have very nice fish prompts running there.
- 11:38Everybody who claims they have to use Bash on their notebooks because they have to SSH into servers, look at us.
- 11:45It's fine.
- 11:46You can do whatever you want.
- 11:47It's your servers, man.
- 11:48I'm with you.
- 11:48I don't have the strong opinions because like, as I said, we run everything on-prem.
- 11:52So, we have our own Docker registry.
- 11:53So, I'm not losing sleep over how big my containers are.
- 11:57Like, obviously, I try to keep the surface small because like everything you install can probably be misused in some way, can be a problem.
- 12:05Like XZ, for example, right?
- 12:07Like, there's like things can be dangerous.
- 12:10But, I mean, if it helps you to get things done, whatever, right?
- 12:14Yeah.
- 12:14When you hear the security folks talk about living off the land, that's what they mean.
- 12:20They're like, oh, I somehow got into this machine and it turns out that this tool that I needed to access the database was just laying here and off it goes, right?
- 12:30They didn't have to get anything on the server.
- 12:31So, that in a sense, you kind of want to eliminate.
- 12:34I do think the trade-off is, are you pushing to a Docker registry and shipping the thing all around or is it just being built in some local-ish story, right?
- 12:44Interesting.
- 12:44Okay.
- 12:45So, the reason that I found out about your article, your virtual environment article, is I was actually looking around at your uv article.
- 12:57Because, wow, does uv speed up Docker builds?
- 13:00Oh, yeah.
- 13:01Oh, yeah.
- 13:01Jay Miller made a comment just yesterday.
- 13:03I saw that.
- 13:04It was pretty funny.
- 13:05He said, uv is the new AI.
- 13:07And I suppose AI is the new blockchain.
- 13:10Like, everyone's excited about it.
- 13:11There's some minor level of controversy about it.
- 13:15But I'm a big fan.
- 13:16What are your thoughts on uv these days?
- 13:18First of all, for people who don't know, we're talking a lot of two-letter acronyms.
- 13:23You said XZ earlier.
- 13:24Now, uv.
- 13:24Like, forget XZ.
- 13:26That was bad.
- 13:26But what's uv?
- 13:27Well, uv is a reimplementation of Python packaging in Rust, roughly saying, right?
- 13:34In Rust.
- 13:34Yes, Rust.
- 13:35Yeah, yeah.
- 13:35They started at the bottom.
- 13:37They implemented uv pip to replace pip.
- 13:40UVvnv to reimplement virtualenv.
- 13:43And uv compile, I think, was the thing.
- 13:46Yeah, yeah.
- 13:46To do our good old requirements.txt files.
- 13:49And they did it very fast.
- 13:51And already back then, I said in a video, it's nothing new under the sun.
- 13:57It's like, we've got nothing new.
- 13:59But this is how you approach this problem.
- 14:01Because what I think most people don't understand, and this is a bit of a tangent,
- 14:05is what an incredible Jenga tower Python's packaging is.
- 14:09Since, like, we've been building these things for 30 years, and there's so many loose parts.
- 14:14There's so many workflows that need to be supported.
- 14:17And, oh my God, I mean, just look at UV's bug tracker, what kind of workflows people need to have supported.
- 14:24Then you understand why it's hard.
- 14:27And why nobody before who did not have eight people, eight hours a day working on it to really move the needle.
- 14:35This portion of Talk Python is brought to you by WorkOS.
- 14:38If you're building a B2B SaaS app, at some point, your customers will start asking for enterprise features
- 14:44like SAML authentication, SKIM provisioning, audit logs, and fine-grained authorization.
- 14:49That's where WorkOS comes in, with easy-to-use APIs that'll help you ship enterprise features on day one
- 14:55without slowing down your core product development.
- 14:59Today, some of the fastest-growing startups in the world are powered by WorkOS,
- 15:03including ones you probably know, like Perplexity, Vercel, and Webflow.
- 15:06WorkOS also provides a generous free tier of up to 1 million monthly active users for AuthKit,
- 15:13making it the perfect authentication layer for growing companies.
- 15:16It comes standard with useful features like RBAC, MFA, and bot protection.
- 15:22If you're currently looking to build SSO for your first enterprise customer,
- 15:26you should consider using WorkOS.
- 15:28Integrate in minutes and start shipping enterprise plans today.
- 15:32Just visit talkpython.fm/workos.
- 15:35The link is in your podcast player's show notes.
- 15:37Thank you to WorkOS for supporting the show.
- 15:39With 0.3 or 0.0, they've now added proper workflow tools, which is very exciting, right?
- 15:48Now we are attacking Poetry PDM and their own Rai, actually, which they adopted from Arm in Ronaha.
- 15:55And now we have cross-platform log files, which is very exciting for people like myself,
- 16:00who develop on a Mac and an Arm Mac, no less, and deploy to Linux.
- 16:07Just asking for trouble there.
- 16:09Yeah.
- 16:09Just as you said, this is so incredibly fast.
- 16:12Like, UVSync, you can call it after every command.
- 16:16Like, the thing that makes sure that all your dependencies are at the state that is written in the log file,
- 16:23is faster than git status.
- 16:25And I realized that.
- 16:27Then I realized what Charlie Marsh means, what he said on your podcast the other day,
- 16:31that uv is categorically faster.
- 16:33It just enables a completely different lifestyle.
- 16:37Let's call it lifestyle.
- 16:38You behave differently when all those commands are free, basically.
- 16:43That's uv.
- 16:44It's a workflow tool.
- 16:45It also installs Python.
- 16:47Yeah, and I think one of, probably one of the things that I was most interested about,
- 16:52your take.
- 16:52There was, over on Python Bytes, we covered this thing by Simon Willison,
- 16:56where he kind of summarized a Mastodon thread about uv and whether it being written in Rust
- 17:04is detrimental to the Python ecosystem or not and all of those things.
- 17:08But I think it was there.
- 17:10Your take was, look, fast is interesting.
- 17:12But one of the really powerful things, I think, is here is a single binary that, if it's on your computer,
- 17:18you can do all things Python, right?
- 17:20And right now, it's super, without uv, it's been really challenging, right?
- 17:24Maybe I want to use pip-tools or I want to use pip to install something or all of those things are predicated on several steps.
- 17:33Do you have Python?
- 17:34Do you have a right version of Python?
- 17:36Have you realized you've got to create a virtual environment because you don't have right access to where there's just,
- 17:42before you can get started, like, well, here's a whole set of conversations you need to have about not terribly complicated things,
- 17:48but things that people might not care about.
- 17:50And now with uv, it's just uv, run.
- 17:52And you can even put in the comment in the top, like, these are the three libraries I need to run.
- 17:57And it'll just run.
- 17:58Oh, so they don't break.
- 17:58That's what I meant with the one binary, right?
- 18:00Like, I think most of Python's bad reputation around packaging is that things just break.
- 18:06Because Homebrew updated your Python or because you didn't activate your virtual length,
- 18:13accidentally installed something into your global thing.
- 18:16Or you used pip install --user and now it's in all your virtual lengths and you don't know why.
- 18:22And there's so much unpredictability around these things.
- 18:26And now suddenly we have, like, this one thing that behaves in certain ways that people understand,
- 18:32that people expect it to behave.
- 18:34As I said before, this is not necessarily the way I would like it to behave,
- 18:37but I understand why it's so important to just narrow the envelope of packaging of the behaviors that we expect
- 18:45and that we as a community endorse.
- 18:48Totally agree.
- 18:49There's certain things I would like to see different as well.
- 18:51But I'm really happy that Charlie and team are working on this and pushing it forward
- 18:56and maybe breaking some paradigms or expectations, saying, look, you don't even have to have Python installed.
- 19:01We can base it off of, gosh, I forgot the name of the project.
- 19:05Not Dead Snakes.
- 19:05But the Python builds, yeah, builds standalone.
- 19:09That's it.
- 19:10Exactly.
- 19:10And we'll just grab it, right?
- 19:12If you don't have Python installed, we'll just grab it.
- 19:14Now, a side issue or maybe a tangent parallel issue is I would love to see something in Python itself that gives you a binary that you can then deploy.
- 19:25UV is great for getting your machine up running and getting Python dependencies on it and stuff.
- 19:29But Python build my folder, my package with an endpoint or something.
- 19:35And like Go, like C++, whatever.
- 19:38Here's a binary.
- 19:39You just run it.
- 19:40It doesn't care what's on your machine.
- 19:41I know there's some packaging type stuff like Pyto app.
- 19:44I have an app that's based on that.
- 19:46But those are still kind of trying to piece things together in a funky way that Python will allow rather than something truly.
- 19:55It's the same like with the standalone builds.
- 19:58Python really fights you when you try to do this encapsulated things.
- 20:02And like my dream outcome would be if these standalone builds would be upstream to proper Cpython.
- 20:09Because this is really what I would like to have from Python.org.
- 20:13Like these directories that I can put anywhere and they just work.
- 20:17But it's not trivial.
- 20:19And the author, the original author of those standalone builds, because it's been taken over by Astro now too.
- 20:25But the original author was Gregory Shorts, I think.
- 20:27And he also did this PyOxidizer project, which was very exciting to me.
- 20:33But he kind of burned out completely on working with Python at all, because it was so frustrating for him to deal with these things and how Python behaves and fights him when he tries to do these things.
- 20:45Yeah, these kind of changes would have to come from Python proper.
- 20:49Yes, it would have to definitely come from Python proper.
- 20:51Well, maybe someday.
- 20:53There's some interesting things that come along.
- 20:55We might even have Python in the browser.
- 20:58Weirdest things have happened.
- 20:59Yeah, and out in the audience, Tony agrees that super powerful and I haven't thought much about it.
- 21:04One by any of the do everything, it's amazing.
- 21:06Indeed.
- 21:06So you want to talk about the controversies to you or just a segue?
- 21:09Let me just ask you a question.
- 21:12So here, I think the controversy is twofold.
- 21:17And I accept that it's somewhat controversial, but I wouldn't say that it's controversial to me.
- 21:22I think there's two things.
- 21:23One, uv is written in Rust.
- 21:26Rough and Rust.
- 21:27Yeah, I see the challenge here.
- 21:28Yeah.
- 21:29It's written in Rust.
- 21:30It's not Python.
- 21:31That makes it harder.
- 21:32I don't know any Rust.
- 21:33I might be able to look at Rust codes.
- 21:35I think that's Rust, but I'd have to do some learning to actually do anything with it.
- 21:39And the other is venture-backed versus just open source.
- 21:43Like, is that healthy?
- 21:45I think for the Rust part, like, for me, it's like, look, a lot of libraries are written
- 21:48in C++.
- 21:49And I used to do C++ or C, but I'd rather not go do C.
- 21:53If there's a bunch of C and a bunch of Rust, they're kind of similar to me.
- 21:58Like, I'd rather not mess with those.
- 21:59But if I had to, I could learn a feeling.
- 22:01And so I don't feel terribly worried about Rust in that regard.
- 22:05What are your thoughts?
- 22:06Just some quick takes on this.
- 22:08Yeah, the quick take is, I think it's a much more a thing of context right now.
- 22:12And it's actually how the thread on Mastodon started.
- 22:15We were just starting to get off having everything written in C.
- 22:19So we didn't have to learn C to contribute to certain projects.
- 22:22Because we ported them to Python.
- 22:25Like, now the Pyreple in Python 3.13, which I'm sure we were talking about, is now in Python.
- 22:31And suddenly we have more contributions, right?
- 22:32Now, people find this is a regression back when we start moving back to Rust, which in certain
- 22:38ways it is.
- 22:39But then again, I think people underestimate how many Rust-savvy people we have now in the
- 22:44community.
- 22:45So I think the upsides in this case outweigh the downsides.
- 22:49But of course, everybody has to decide it themselves.
- 22:52Yeah.
- 22:52And it's open source.
- 22:53If something goes terribly wrong.
- 22:55Yes.
- 22:55MIT Apache 2.
- 22:56Yeah.
- 22:57Yeah.
- 22:57There's already 646 forks.
- 22:59I'm sure there'll be some more.
- 23:00I'm happy to see Charlie and team working on this.
- 23:04And I told Charlie that a few weeks ago or a couple of months ago when he was on the show
- 23:08to talk about some of these ideas.
- 23:09I think what I would really like to stress here is that it's not like Astro came to the
- 23:14page and just like forbade everybody to stop to do open source packaging.
- 23:20We had like at least 10 years of trying to tackle this problem with our resources that
- 23:26we have as open source developers.
- 23:27And it turned out that we cannot do that.
- 23:30It's just a too complex problem.
- 23:32I've been like just a few months ago.
- 23:34I was literally saying that I would like to see someone to just put the money where their
- 23:38mouth is and just bankroll a good packaging tool.
- 23:42And this is literally what just happened.
- 23:44So I'm more on the relaxed side of that because I realized that we just couldn't do it.
- 23:49Like we tried.
- 23:50We failed many times.
- 23:51Like there's a whole graveyard of packaging tools.
- 23:54And right.
- 23:55Now we have a good one.
- 23:56And one day we will probably have to maintain it because VC is going to VC.
- 24:00But it's fine.
- 24:01It's interesting.
- 24:02That is for sure.
- 24:03I definitely know if you want to get VC funding, having Rust as your foundation seems to be
- 24:07the trick right now.
- 24:08But another thing I want, you know, while we're on this topic, you made a point in one of the
- 24:13YouTube videos, which I'll give a shout out to in a bit, but said something to the effect
- 24:18of be kind to all the people who have worked so hard on this problem before and don't just
- 24:23trash on the other projects.
- 24:25Six months ago, this thing was mission critical to you.
- 24:28And it was the way that you did everything.
- 24:29And now I go, it's people know it's crap because you like, I don't, I think it's, it's important
- 24:34to keep some perspective, you know?
- 24:36Yeah.
- 24:36I mean, I've been on the receiving end of such excitement, so I know exactly how it feels.
- 24:41And it's just, you can be excited about something without saying that finally I can stop using
- 24:47X.
- 24:47Ideally, add the maintainer of X.
- 24:50So they really know that you finally don't have to use their stuff.
- 24:53Yeah, exactly.
- 24:54You don't have to be.
- 24:55Come on now.
- 24:56So real quick, give us some of the tips of what you're doing to make your Docker builds
- 25:01faster.
- 25:02I know this build cache mount thing is pretty interesting, letting you, I mean, I adopted
- 25:08some of the ideas you got in here and some of my own and Docker builds so much faster.
- 25:13I mean, the most important thing is to have multi-stage builds, which means that you have
- 25:17a separate container that builds your application, whether it's a virtual amphi-chip, as we said
- 25:22before, which I like better.
- 25:23Or if you just build into a directory and then somehow get it over.
- 25:27Because you don't want to have a C compiler in all your production containers.
- 25:31So just a waste of space, as you said, living off the land.
- 25:35It's not good.
- 25:35You want to drop the hackers into a desert, not a lush forest.
- 25:39Exactly.
- 25:40I mean, they're still going to figure it out.
- 25:41But it's just nicer and easier to reason about.
- 25:44Then judicious layering makes a big difference that you are very clear about when you build
- 25:50what, that you basically sort your commands in the order in that they are most likely to
- 25:55change.
- 25:56So in a build container, that means that your last step is copying the application and the
- 26:01step before is copying the dependencies.
- 26:03Yeah, absolutely.
- 26:04And so I'll link to one of your articles here.
- 26:06But the other thing that I think is pretty interesting that people maybe don't realize or haven't used
- 26:13a lot, I'm not sure if I see, here you go, is when you run Docker commands, you can say
- 26:19--mount equals slash root slash dot cache.
- 26:24Yeah.
- 26:24That's build cache mounts that you mentioned.
- 26:26Yeah.
- 26:26Yeah.
- 26:26Yeah.
- 26:27Yeah.
- 26:27And what that'll do is when either, doesn't matter in this case, the way you got it set up,
- 26:31either pip or uv, if they, a lot of times when you pip install something, they'll say,
- 26:35oh, that's already cached locally.
- 26:36We'll just install it instead of download it.
- 26:38Right.
- 26:38Yeah.
- 26:39And that'll store somewhere on the host machine, all the, all the cache stuff, right?
- 26:44It depends.
- 26:45It depends.
- 26:45So this is something that I didn't spend a ton of time because you can configure where this
- 26:50is stored.
- 26:51And in the simplest case, it is just pulled from the last container that you built.
- 26:55That is like the simplest configuration that you can use that you say that, so now I tag
- 27:01an latest container, which I never did before because for deployments, I usually use numbers,
- 27:05but now there's always a latest tag.
- 27:08It will take the cache from there.
- 27:10So it's most likely pretty good because it was literally the last build.
- 27:13Yeah.
- 27:13Yeah.
- 27:13Okay.
- 27:14Interesting.
- 27:15I see that it's, it's part of the build cache, not the Docker layer cache, not some folder
- 27:20laying around.
- 27:20I think it's actually part of the container if I'm not mistaken completely.
- 27:23Okay.
- 27:23Yeah.
- 27:24So definitely lightens the load on PyPI a little bit and makes yourself faster.
- 27:29So that's all, that's all good.
- 27:30All right.
- 27:30What is next on my list here?
- 27:33Let me have a look.
- 27:33All right.
- 27:34Installing Python.
- 27:35That's probably a, maybe a segue that keeps us in the same realm.
- 27:39Honestly, how do you get Python on your machine these days?
- 27:41Are you, if you're going to work on something or do you brew install it or you download it
- 27:46from python.org?
- 27:47No.
- 27:48No.
- 27:48As my friend, Justin once wrote, homebrews Python is not for you.
- 27:52It's that Python is for homebrew to use in their applications.
- 27:56You notice it very fast because whenever they upgrade the Python audio virtual ends break.
- 28:00So this is not great.
- 28:03So I'm on macOS and I'm on an Apple Silicon Mac, which makes things a bit more complicated because
- 28:13I need to develop some of my projects on Intel because I need to use a driver for a very shitty
- 28:19proprietary database.
- 28:21And this, of course, they don't have that for ARM.
- 28:24It's written in C or some sort of binary layer.
- 28:26Yeah, yeah, yeah.
- 28:27It's a binary blob.
- 28:28So I have like these two types of projects.
- 28:30And so the official macOS installer from python.org has this amazing property that you get Python
- 28:403.13-intel64.
- 28:42And when I create a virtual end with that, I know this virtual end is Intel.
- 28:47And if not, it's not.
- 28:48And this is very nice and predictable for me.
- 28:51So I really like this behavior.
- 28:53And on servers, we use dead snakes.
- 28:56Yeah, very cool.
- 28:57Lately, I've been switching to just uv venv, give it a Python version, which I guess
- 29:03indirectly is using Python build standalone, right?
- 29:06They have a bunch of quirks based on the thing that we talked before that they fight, that
- 29:11Python fights it a little bit.
- 29:13So I cannot use those in production, at least not for everything, because I just had some
- 29:17some of my packages just won't install on them.
- 29:19They will probably be fixed at some point.
- 29:21But yeah, Python.org is a safe spin thing.
- 29:23And I have to shill my friends Glyph's tool mop up, which just allows you to upgrade those
- 29:29official installers very easily, especially when you use uvx, because then it's just one
- 29:34line.
- 29:34Yeah, mop up is an interesting project from Glyph, as you pointed out, that will update your
- 29:40your Python, right?
- 29:41Yeah.
- 29:42Yeah.
- 29:42If you've installed it from Python.org.
- 29:44All right.
- 29:45Another thing that's interesting, if you install Python from Python.org is in the installer,
- 29:51you can customize it and you can check a checkbox that says, give me the free threaded Python.
- 29:58Let's talk about free threaded Python.
- 30:00What do you think about this?
- 30:01This is one of the more significant changes to Python and one of the bigger peps.
- 30:07You know, we went through the two to three controversial challenges so much.
- 30:11And I think that was largely because strings were changed.
- 30:14I know there's a bunch of other changes, but it seemed to me that the real challenge of a
- 30:18lot of the upgrades of a lot of the packages been like, well, that used to be bytes or strings.
- 30:23Now we've got to treat them differently and we've got to change that.
- 30:26That's the part that was really took the work.
- 30:28And threading seems harder than strings.
- 30:31I don't know.
- 30:32Maybe it's not, but is this going to be a big challenge for people or what do you think?
- 30:35Yeah, I guess we will see, right?
- 30:36Like normal code is probably not going to be affected a lot.
- 30:39But for example, it's a perfect timing since I'm maintaining Argon2 CFFI.
- 30:45As the name says, it depends on the CFFI project to do the bindings.
- 30:50It does not support free threading yet.
- 30:54So I cannot build free threading wheels with that yet.
- 30:56Of course, people are already complaining in my issues about that.
- 31:00Why isn't your puppy parallel?
- 31:02Come on now, get this going.
- 31:03Yeah.
- 31:04So this is, there's probably more projects than just CFFI that are still stuck in some way
- 31:09because they are not important enough for someone from meta being parachuted into the project
- 31:16and fix everything.
- 31:17Yeah.
- 31:17I personally, I'm very excited by free threading.
- 31:20And I was like one of the, like, I mean, there was, I don't know how to call it, but
- 31:24it's a bit of an election, right?
- 31:26To decide on whether or not.
- 31:28And it was like this, we made public statements about how we feel about this whole thing.
- 31:34And I personally felt like good about it back then.
- 31:37I still do.
- 31:37I think it's a big chance, our one shot we will have because either this one works out
- 31:42or it's not going to happen ever.
- 31:44We will never have free threaded Python ever because this is like the perfect constellation
- 31:48of stars.
- 31:49This is not coming back.
- 31:50That's a really good point.
- 31:51We've had the Gilectomy and other attempts before, but this is, it's fast.
- 31:56It's accepted.
- 31:57It's already shipped.
- 31:58You're right.
- 31:59If this doesn't work.
- 32:00And we have meta who also like put several paid people on the job to get it done.
- 32:06Again, this is one of those things that just cannot be done by volunteers on the beer money
- 32:11from GitHub sponsors.
- 32:12This is a big thing that has to be, that needs serious money to be solved.
- 32:18This portion of talk Python to me is brought to you by Bluehost.
- 32:21Got ideas, but no idea how to build a website?
- 32:25Get Bluehost.
- 32:26With their AI design tool, you can quickly generate a high quality, fast loading WordPress site
- 32:32instantly.
- 32:32Once you've nailed the look, just hit enter and your site goes live.
- 32:36It's really that simple.
- 32:37And it doesn't matter whether you're a hobbyist, entrepreneur, or just starting your side hustle.
- 32:42Bluehost has you covered with built-in marketing and e-commerce tools to help you grow and scale
- 32:47your website for the long haul.
- 32:49Since you're listening to my show, you probably know Python, but sometimes it's better to focus
- 32:53on what you're creating rather than a custom built website and add another month till you
- 32:58launch your idea.
- 32:59When you upgrade to Bluehost cloud, you get a hundred percent of time and 24 seven support
- 33:04to ensure your site stays online through heavy traffic.
- 33:08Bluehost really makes building your dream website easier than ever.
- 33:11So what's stopping you?
- 33:12You've already got the vision.
- 33:14Make it real.
- 33:14Visit talkpython.fm/bluehost right now and get started today.
- 33:19And thank you to Bluehost for supporting the show.
- 33:22I'm excited, but I don't think it's going to be that big of a problem.
- 33:26And I think it's going to do some very excited things that we are not thinking about because
- 33:30a lot of the arguments against it was, oh, threads are bad.
- 33:35It's hard to write multi-threaded code, which is all true.
- 33:38The problem is that we just don't have good APIs for that.
- 33:40Like you can build good APIs for threading.
- 33:42You just have to look what Go is doing with channels.
- 33:44We can have channels in Python once we have good threading.
- 33:48But we never bothered to build these kind of APIs because it doesn't make any sense with
- 33:53the guild.
- 33:54It's just, it's better to go async.
- 33:56That's a really good point.
- 33:57And I think there's an analogy with async.
- 34:00Remember, async.io shipped in Python 3.4, but async await, the keywords and the programming
- 34:06model shipped in 3.5.
- 34:07So for a while, it was like, well, you guys figured it out.
- 34:10And then the programming model got way nicer.
- 34:12We might have not gotten this shot if async.io didn't happen back then because it just showed
- 34:18how we can do like a test balloon in a community.
- 34:21We don't have to do it perfectly on the first time.
- 34:25I think we had even breaking changes in minor releases of 3.5 because we had to fix things
- 34:32up.
- 34:32So yeah, I think I'm sure it was a bit of an inspiration.
- 34:35I remember a breaking change somewhere in Python, but further down the road where the async context.
- 34:43So the way to say a function was async, you could use a decorator before async and await
- 34:48came along.
- 34:49And my code, which was running on MongoDB, which was running on, which was using motor.
- 34:54They were using that older style to get their async.
- 34:58And then when it got taken out of Python, it just, well, stuff doesn't run anymore.
- 35:02There is no such decorator async, something I can't remember exactly what it was, but it
- 35:07took a week or two before I could run the new Python because that wasn't a big deal.
- 35:11You know, I just didn't use it, but it did break.
- 35:14There was plenty of breaking changes in async.io because I was quite involved with that whole
- 35:19thing.
- 35:19And I remember things breaking a lot in the beginning, but it's good.
- 35:23It's good that we don't carry that technical debt around with us now.
- 35:26Yeah, absolutely.
- 35:27I want to give a quick shout out to a pytest plugin called pytest-FreeThreaded from Anthony
- 35:34Shaw and friends.
- 35:35And this one basically lets you run your tests in the free threaded Python mode and run them
- 35:43with parallelism and stuff like that.
- 35:44Because if you're going to have a library and you have tests for it and it's supposed to
- 35:48support free threading, you should probably test it with free threading actually running
- 35:51at some point.
- 35:52People are trying to move their libraries along and I think they said, look, we tested
- 35:57this on one of the libraries that said it was free threaded, supporting it, segfaulted Python.
- 36:01So maybe it wasn't quite ready.
- 36:04So run your tests if you're going to support this.
- 36:07I think it needs to be stressed that the trick to not break your code is to just not mutate
- 36:11global data in multiple threads at once.
- 36:14Just avoid doing this and you'll be fine.
- 36:18And most people don't.
- 36:19So I don't expect like this large scale breakage.
- 36:22The problem is more in the lower level things like CFFI and those kind of things that are
- 36:27going to take a lot of time to figure out, I think.
- 36:30Yeah, I agree.
- 36:30Like, does your web framework support free threading?
- 36:33Well, you're going to find out pretty quickly.
- 36:35You definitely will.
- 36:37I'm personally excited about it as well.
- 36:39I think we're going to have a lot of good times.
- 36:42What else about 3.13 are you excited about?
- 36:45I feel like Python 3.12 and 3.13 was more like planting trees than a good harvest, you know?
- 36:53Like, there's a lot of work, a lot of very, very hard work when it did these two releases
- 37:00that don't benefit us immediately.
- 37:03They built a foundation for great things to come.
- 37:06Like, free threading is an example.
- 37:07Sub-interpreters are an example.
- 37:09Like, internally, I mean, I shouldn't admit it, but I'm also a Python core developer,
- 37:13but I'm just not very active because I have enough of my own stuff going on nowadays.
- 37:17But internally, the 3.13 is kind of called like a secret 4.0,
- 37:22which everybody who has to do with C-APIs have noticed because, like,
- 37:27unlike the releases before, like 3.12, 3.11,
- 37:29it took quite a while for the ecosystem to catch up with all the changes to the C-API
- 37:35because there's been a lot of changes.
- 37:37I mean, the PyRipple is great.
- 37:39Pablo has made a big push for better error messages, which is also nice.
- 37:43And they continue to get better.
- 37:44Yeah, that's great.
- 37:45This is like the things that are truly user-facing,
- 37:48but things that I don't really care about that much.
- 37:51I mean, I use IPython, so I will probably keep using it still.
- 37:55I just hope that maybe PDB will get better now that we have a better REPL
- 37:58because my favorite debugger, PDBPP, has been broken for two releases.
- 38:02I'm not really excited about anything from 3.12 and 3.13.
- 38:07I'm just excited for what those releases are going to give us in the future.
- 38:11I'm excited for just the entire FasterCpython initiative as it kind of works out over across, you know.
- 38:18Yes.
- 38:193.11 was probably the biggest one of those, I guess.
- 38:21Although, we'll see about this free threading.
- 38:23This might, you know, if you've got a lot of cores, that's a massive difference if you can take advantage of it.
- 38:28If, yeah, that's a problem, right?
- 38:30Because I think what was said that they will merge it if the penalty for non-threaded code is less than 10%,
- 38:40which it did, but single-threaded code is going to be slower in a free-threaded Python build,
- 38:46and it's something we have to keep in mind.
- 38:47Right, yeah.
- 38:48Well, I guess it depends on your workload, what you're doing right.
- 38:50But with little dev tools, I fixed.
- 38:52What's new in Python 4?
- 38:55Ship it.
- 38:56Ship it.
- 38:57Although, I got a few more spots.
- 38:59I got to do a little find and replace in this documentary.
- 39:02Looking at the what's new in 13.
- 39:04Okay, also, I think, yeah, I think the new REPL is quite nice.
- 39:07It's been, using the traditional REPL, I think it's been really challenging.
- 39:11Did you write a loop?
- 39:13You want to go back and edit it?
- 39:15Well, you got to, yeah, I remember that was four lines up for the four part,
- 39:18and then the four again to get, you know, like, that was just challenging to have multi-line edits on there.
- 39:23Now, a lot nicer.
- 39:24Well, just simple things like key binding, sometimes not working, or just printing weird stuff into your console.
- 39:32Yeah, but these are the things kind of like the virtual environment, you know, get your virtual environment set up, get your dependencies installed.
- 39:39It doesn't sound like that big of a deal, but it is friction to people who come to the ecosystem.
- 39:44Every paper cart less is good.
- 39:46Yeah, that's 100% right.
- 39:47Definitely good.
- 39:48YouTube.
- 39:49I mean, look, you're on YouTube right now, but we're talking about you being on YouTube on YouTube, so it's kind of meta.
- 39:54But, yeah, you're doing a really good job with your YouTube videos lately, you know.
- 39:58Thank you so much.
- 39:59I've done a couple of the last, yeah, yeah, you're welcome.
- 40:02I think I've done a lot of YouTube videos, but even more, sit down by yourself behind a camera for course videos.
- 40:09I have like 270 hours of course videos.
- 40:12And, you know, the editing, the I'm excited to talk to nobody, right?
- 40:17All of these things are not that easy to do.
- 40:19And, yeah, I want to just talk about what you're up to over there a bit.
- 40:23Maybe let's start with a silly reason why I started doing this.
- 40:26I'm very aware and self-conscious about how bad my spoken English is.
- 40:30So it's my third language.
- 40:33And I don't speak it often enough.
- 40:35So there's this joke from my friends at the Piken when the just arrived jet-lagged Hinek who only spoke English to the U.S. immigration officer trying not to get detained.
- 40:43It's very different from the Hinek like a week later who spoke to his friends for a week, right?
- 40:49So my hope is that maybe it forces me to like speak a lot more English in my everyday life.
- 40:56It turned out I'm way too slow at producing videos.
- 40:59So that part didn't work out at all.
- 41:00I mean, you say like 300 hours.
- 41:03But for me, like the 25-minute video that I've just published, that's like one hour of film material that I'm cutting down to 25 minutes.
- 41:10Yeah.
- 41:10So that's a lot of work, a lot of editing.
- 41:12And, yeah, the more serious reason that actually worked out, and this is not going to be all of Philly.
- 41:19is I do have a lot of people that follow me across my platforms and know me from PyCon.
- 41:25And I've heard the term PyCon cinematic universe put out, which I'm probably a part of.
- 41:32But this universe is tiny.
- 41:34Like the Python community is huge.
- 41:36People don't understand how huge they are.
- 41:39And I mean, just like this Twitter account that posts just like these trivial things that sometimes I'll write wrong.
- 41:45And they have like hundreds of thousands of followers.
- 41:47And the same is on YouTube.
- 41:50I haven't found any Python content on YouTube that I really liked, like for the things that I care about.
- 41:57Like maybe there's amazing data science stuff there, but there's not things that I care about.
- 42:01So I thought with the usual programmers hubris, sure, I can do that.
- 42:04And I'm trying to build our own.
- 42:06We're doing it.
- 42:07How hard can it be?
- 42:08And so I'm trying to do content that I wish existed for me 15 to 20 years ago.
- 42:14But to be honest, like the ultimate trigger is that before COVID, I had like this nice lifestyle where I wrote one amazing conference talk per year, like scare quotes.
- 42:23And I could just like travel the world and give it.
- 42:27And this doesn't work anymore.
- 42:28Like the conference world has more or less collapsed.
- 42:31Conferences have no money anymore.
- 42:33It's much harder to get invited.
- 42:34So I told you I work for a small company.
- 42:39So like my actualization and creativity comes mostly from the community.
- 42:43And I felt like being cut off.
- 42:46Like I couldn't do my creative work anymore because I couldn't pay for all those flights.
- 42:50The same happened to writing.
- 42:52I mean, whatever Google and Twitter are doing right now, unless your blog post lands on Hacker News front page, you basically get no more traffic anymore.
- 43:01It has been completely obliterated.
- 43:03Like my blog has like 40% less traffic than a year ago.
- 43:07And I don't think it's that my content got stale.
- 43:09It just changed.
- 43:11I thought I should try a new avenue.
- 43:14I should go where the people are.
- 43:15I read somewhere that like YouTube is the second biggest search engine or something.
- 43:19So I'm trying my hand.
- 43:21It's an interesting outlet.
- 43:22And you know, you look at it's the numbers are ridiculous.
- 43:26Right.
- 43:26I look at, oh, this person just posted a video on this.
- 43:30And six hours later, it has more views than if it was a major television series or something like this.
- 43:35It's a weird world.
- 43:36It's a weird world for sure.
- 43:38I'm a niche in a niche.
- 43:39So I don't expect ever to blow up like this.
- 43:41But yeah, we'll see how it goes.
- 43:44It's still great.
- 43:45Let's talk a little bit about some of your projects.
- 43:48Talked about Argon.
- 43:50I think maybe one of the things you're best known for might be Adders.
- 43:54Would you say?
- 43:55It depends who you ask.
- 43:56Okay.
- 43:56I think Adders has the big, had the biggest impact on the community because they are the direct predecessor of data classes that I designed with Guido and Eric back then.
- 44:06That goes back to Adders because people wanted something like Adders in a standard library.
- 44:10But all right.
- 44:12Well, tell us, tell people about Adders for those who don't know.
- 44:14Imagine data classes, but more powerful, more powerful.
- 44:17People sometimes try to compare it to Pydantic, but that's not that.
- 44:22Adders is not trying to be a validation thing.
- 44:25Adders is there for creating classes that you would have written yourself.
- 44:29And I call it like a class writing toolkit.
- 44:33And data classes keep catching up with what we do, but we are still ahead.
- 44:38So we have more features.
- 44:39We work better.
- 44:40And especially for data science-y things, because we allow people to define comparisons in a custom way.
- 44:47So you can compare NumPy arrays and everything.
- 44:50And yeah, things like that.
- 44:52And you don't need to use type annotations if you hate them.
- 44:55That's also a big feature we have.
- 44:57Yeah.
- 44:57So when you create a class, you can just put some fields on it and that's great.
- 45:02But there's probably some other things you might want to do, like define a hash and define an equals and an not equals and stir and a repr and all these kinds of things.
- 45:12Right?
- 45:12Yeah.
- 45:13You just get that out of the box, right?
- 45:14And maybe you want the class to be frozen.
- 45:17Maybe you want slots and these kind of things.
- 45:20Slots.
- 45:20Interesting.
- 45:21I don't know.
- 45:22Everyone knows about slots.
- 45:23Slots are kind of a cheat code for low memory, fast access.
- 45:28Tell people about slots.
- 45:29Dunder slots.
- 45:30When you create a class in Python, by default, it's a so-called dictionary class because it has a dunder dict field where all the attributes are defined.
- 45:40And you can do those classes whatever you want.
- 45:41You can just add more attributes.
- 45:43But if you define a slotted class, which doesn't have this dunder dict, but dunder slots, and you enumerate all attributes that this class will have, and it's then baked into the class.
- 45:54So this is the big upside.
- 45:55It's like, if you try to assign an attribute that doesn't exist, it will throw an error, which is good because it probably means that you mistyped.
- 46:04And this is like the thing that you see from the outside, from the inside, it's much more interesting because those classes are more baked.
- 46:09So they are just faster.
- 46:10They're faster and use less memory.
- 46:12Yeah, they use quite a bit.
- 46:13I think named tuples use more memory, you know, and you think how tuple is kind of like as about as bare bones as it can get.
- 46:20But yeah, it's quite interesting.
- 46:22My experience is that even attribute access is a tiny bit faster than in regular classes.
- 46:28Yeah, and this is why in the new APIs, it's the default in others.
- 46:32Like data classes grew slots too, but it's optional in others.
- 46:36It's now opt out because it's really good.
- 46:39Yeah, yeah.
- 46:39Because why not?
- 46:41My experience is it's cool to have the dynamic nature of classes and types and you can do all sorts of stuff to change them.
- 46:49But most of the time you don't.
- 46:50And if you're not going to, like you said, get the I mistyped something catch because it won't let you do it.
- 46:57And the better memory and better performance, right?
- 46:59Yeah, I think this is something that Rust has changed too.
- 47:03The influence of Rust on Python has been that we got a little less dynamic with time, which I personally think is a good thing.
- 47:10Because I started moving away from that sooner.
- 47:12Like using dictionaries and tuples and all these things.
- 47:16It's just very hard to reason about when you come back like a year later and try to understand what this code is doing.
- 47:22What is this star star KWRX thing?
- 47:24What are we doing here?
- 47:25Oh yeah, there's still so many APIs.
- 47:27You have a nice IDE.
- 47:29You press F12.
- 47:31You jump to the function and it's star star KWRX.
- 47:34And thank you.
- 47:36Yes, exactly.
- 47:36You know, if that works out well, there might be a big doc string that says these are the seven things that can actually go in this keyword arguments.
- 47:44And here's their type.
- 47:45You're extra lucky it's true.
- 47:47Yeah, it's actually true or it's actually comprehensive.
- 47:51Yeah.
- 47:52I don't know.
- 47:52I feel a lot of times if when you're doing that kind of stuff, if you end up back in the documentation, like something's kind of gone a little bit wrong.
- 47:59Like you should probably be able to tell at least, does it take arguments?
- 48:02What might they possibly be?
- 48:05But then you go to the documentation, it's auto generating.
- 48:07Like, well, no, not getting far on this one.
- 48:09All right.
- 48:10Well, since we have this, the opinion of Hennick episode, what are your thoughts on types?
- 48:16What do you think?
- 48:17Like I just said, I was moving to like more static things in general because it's just easier to reason about, easier to understand.
- 48:24And it informs the design of APIs too, like which I just find the APIs that come out nowadays are widely more accessible than what we used to have.
- 48:35And as Lukasz Langer's keynote a few years ago at PyCon US was like, if something is hard to type, maybe it's just bad design.
- 48:41That's an interesting take.
- 48:43Yeah.
- 48:43It's not always true, by the way.
- 48:45Like there are legitimate use cases for Python where typing is a bad fit.
- 48:50It's completely true and it's not great for everything.
- 48:52But I personally just take any help that I can get that helps me to make my code more understandable and help me like ensure that I'm writing what I'm thinking I'm writing.
- 49:04Like types helped me the best with finding logic errors in what I thought I was passing around and what I was actually passing around.
- 49:11Because like things that work by accident because something gets auto-converted somewhere are the most dangerous things because they explode when you are on the beach with your margarita.
- 49:21Yeah, they do.
- 49:22And that's not good, as we already pointed out.
- 49:24You know, another thing that I really like about them, I'm kind of on your team with this one as well.
- 49:29And I really like that I hinted at before.
- 49:31You don't have to go to the documentation and go like, what is this?
- 49:34I know it says it takes an options.
- 49:36What is an options?
- 49:37You know, like I have no idea what goes here still.
- 49:39This doesn't tell me.
- 49:40But if it means it's this class or it's a dictionary, well, at least you got some hints on like, well, this is where I start knowing what I'm supposed to do here.
- 49:47And also with the editor, right?
- 49:49If I hit dot, it gives you a way better chance of just continuing to type instead of going and looking up stuff.
- 49:55And also, that's something people don't talk that much about, but it forces you to give things names.
- 50:00Sometimes when you have problems to give a type a name, that's a sign that you don't quite understand what the thing is doing.
- 50:08Or maybe it's doing too many things.
- 50:09And that way you have like this instant feedback about your design and how you think about things.
- 50:15And that I find very useful.
- 50:17And also, I have to point is, typing would be just marking things that could be none or not.
- 50:22That would be already like 99% of the value of types.
- 50:27Like just helping to avoid non-type errors.
- 50:31Yeah.
- 50:31Optional or not optional?
- 50:32What are we going to do here?
- 50:33Yeah.
- 50:34Yeah.
- 50:34I do like that it's optional, that it's progressive.
- 50:38I came from static languages to Python.
- 50:41And the fact that it didn't have types, I kind of wanted something.
- 50:44But I also played around with TypeScript.
- 50:47I battled with the TypeScript system where it's like, well, we don't know what this thing is, but you're supposed to pass in something that's known in the type system.
- 50:53And you're like, I know this will work.
- 50:55Just get out of my way and let me do it.
- 50:57You know what I mean?
- 50:57And I think there's a pretty good balance that's got here.
- 51:01I have a whole keynote in my head about the true Python superpower is the graduality.
- 51:06Because you can start with the biggest trash, shitty code in a Jupyter notebook and just work yourself up by putting it in a file, running rough linter, then adding types and so on.
- 51:18And you end up with production code of the best kind.
- 51:21But you started with complete shit.
- 51:23And that's how my brain works.
- 51:24Like, I like to try things out and then just polish the turds, must I say.
- 51:28Polish it when it's proven that it's worth putting your time and energy to, right?
- 51:33Exactly.
- 51:33And I find this very frustrating with languages like Rust or Go, which I read a lot of Go.
- 51:37And Go won't even compile your thing if you have an unused import.
- 51:41And this is just so frustrating.
- 51:43Oh my gosh.
- 51:45Just eat my trash and make it work.
- 51:46I will fix it later.
- 51:48I promise.
- 51:48That's a pretty interesting take.
- 51:50All right.
- 51:50Well, let's give maybe a shout out to Stamina also.
- 51:55Like, that's the story of Stamina.
- 51:57That's a good one.
- 51:58Yeah?
- 51:58It's like from my latest projects, kind of the most popular one, because it just solved
- 52:04the problem we all have that we use Tenacity, which is a great.
- 52:07We all used Tenacity, which is a great package, but it has no good default because it's also
- 52:12a very old package.
- 52:13And everybody's just copy pasting these standard settings around that make it behave in a good
- 52:20way.
- 52:21And it's also, at least back then, didn't do proper typing.
- 52:24So I just wrote this tiny shim around that so I can stop copy pasting the same things
- 52:29over and over again.
- 52:30It turns out a lot of people have the same problem.
- 52:32Yeah.
- 52:32So if you've got a function, for example, I give a little example here that might crash
- 52:37because it's here.
- 52:39Like, you know what?
- 52:40If I just tried this again, I bet it would work.
- 52:42Right?
- 52:43Just add stamina dot retry.
- 52:44Specify the error.
- 52:45Yep.
- 52:46And I don't, it's been a while since I checked it out, but it's got like exponential back
- 52:50off and other, other types of things like.
- 52:52And jitter.
- 52:52Oh, and jitter.
- 52:53Okay.
- 52:53Nice.
- 52:53Yeah.
- 52:54I use it in certain things.
- 52:56It's not very often that you need something like this, but when you do, you're like, oh,
- 52:59yes, it's getting this.
- 53:00Like in my experience, you need it whenever you talk to external systems, because if you're
- 53:05doing this API cost, it will fail at some point.
- 53:07And just, just put it on it.
- 53:08Just think.
- 53:09I mean, nowadays it has a lot of more features.
- 53:12Like you can now like have a callable that decides where you want to really want to retry.
- 53:16For example, you've got an HTTP error, but in HTTPX, there's no difference between HTTP error
- 53:21because you got a 500 back or because you got a 401 back.
- 53:25If you keep retrying on 401 or 403, you will get banned from the API, right?
- 53:29On the 500, you probably want to retry.
- 53:31These kind of things.
- 53:32Yeah, absolutely.
- 53:33Yeah, the whole rate limiting thing.
- 53:35That's also tricky to work with.
- 53:38But I suppose if you said, like, okay, well, retry it, but put some kind of delay, you know,
- 53:42maybe, maybe you'll be all right.
- 53:44The delay is built in.
- 53:45That's the whole point.
- 53:46It's exponential back off.
- 53:47One thing I do want to talk about as well is just Argon.
- 53:50Yes.
- 53:51So quick, like very, very cool algorithm.
- 53:54It's one of these so-called memory hard problems that is somewhat resistant to brute forcing
- 54:00over just massive parallelism and so on.
- 54:03Want to talk about that real quick?
- 54:04What do you want to hear?
- 54:05Well, just tell people what it is.
- 54:07Maybe, you know, what's your project about and what should people consider using it, you know?
- 54:10Yeah.
- 54:11So many, many years ago, I think it was like 2016 or so, there was this password hashing
- 54:15competition because we needed to find a way to hash our passwords in a way that is, as
- 54:22you just said, memory hard.
- 54:23If you hear of rainbow tables, you shouldn't be using MD5.
- 54:28All these things are like all part of that.
- 54:29Like we got to get past that, right?
- 54:31But this is like next level because people are running ASICs.
- 54:33So like programmable boards that are just specifically for cracking passwords in parallel.
- 54:40The only way to get to fight this is make it memory hard.
- 54:44like checking these passwords or hash, this hashing algorithm also needs a lot of memory
- 54:49to work.
- 54:50There's one more famous one, which is called S-crypt or Yes-crypt, which is nowadays also
- 54:56part of the standard library.
- 54:57So that's that.
- 54:59But Argon2 won the password hashing competition.
- 55:01And yeah, it works.
- 55:03It's in wide use.
- 55:05And yeah, I'm maintaining it for now like six years or something, or I think longer.
- 55:10So if you're storing your own passwords, certainly this is one of the good options.
- 55:15Do you know what the story is with, oh gosh, what is it?
- 55:18Is it passlib, I believe?
- 55:20Yeah, this is really, passlib is throwing a lot of warnings about things that it's using
- 55:26that are being deprecated or even removed.
- 55:29I feel like it was really great for a while, but you know, now you go to it, it's like...
- 55:34Yeah, last edited four years ago, that's a problem.
- 55:36Yeah, it's not great.
- 55:38And I feel like it was on, almost on SourceForge or something for a while, which is really, you
- 55:43know, I can't remember exactly where I was talking about.
- 55:44Bitbucket.
- 55:44It was in Bitbucket.
- 55:45Bitbucket's fine.
- 55:46Yeah, okay.
- 55:46Bitbucket's fine.
- 55:47No, it's not.
- 55:48It's gone.
- 55:49Oh, is Bitbucket gone?
- 55:51Yeah, more or less.
- 55:51You can see the URL.
- 55:53This is a Heptapod, which is like the only Mercurial hosting that open source projects
- 56:00can use nowadays.
- 56:01There you go.
- 56:02Bitbucket, deprecating Mercurial support, yeah.
- 56:04All right, but well, they also have Argon2 support, which is nice.
- 56:08They use my library.
- 56:09Yeah, that's what I thought.
- 56:10Yeah, that's what I thought.
- 56:11Yeah, super cool.
- 56:12Awesome.
- 56:12All right, let's close this out with one more take before, I think we're pretty much out
- 56:17of time, but it's been a lot of fun.
- 56:19LLMs.
- 56:20LLMs writing code for us.
- 56:22Are we just going to be out of work in a year or two?
- 56:25What do you think about this?
- 56:26I'm not super worried about it, but it's definitely changing things, I think.
- 56:30When you say we, it can mean we, the two of us.
- 56:33The answer is clearly no.
- 56:35I think we, as in Michael and Hinnick, will benefit from LLMs, I think.
- 56:39But we, as programmers in general, and especially junior programmers, that's going to be a different
- 56:46thing.
- 56:46And I wouldn't dare to guess how that will play out.
- 56:51Like, I'm personally using LLMs.
- 56:55I use Anthropic.
- 56:57But I use it in a way that I feel like you have to be very senior to actually use that.
- 57:05Because when you ask it for code, you just get code with old libraries because it's trained
- 57:11on old code from GitHub, right?
- 57:14My co-pilot once gave me a SQL injection code suggestion.
- 57:20It'll be fine.
- 57:21What is the most common security problem with code?
- 57:25Yeah, SQL injections.
- 57:26Of course, it's going to be in those LLMs and suggesting it to me.
- 57:30I think it's going to, it is a useful tool.
- 57:32It usually doesn't give me what I need, but it gives me enough to help me to ask a search
- 57:38engine what I actually need.
- 57:40So this is what I'm going to say.
- 57:41What it's actually really good for is writing SQL in my experience, because my brain, I somehow,
- 57:46I cannot write CTEs.
- 57:48Like, I just, the syntax, I don't know.
- 57:51I just can't.
- 57:51So I usually ask an LLM to write the CTE for me and then just write the rest of the query.
- 57:57Well, for me, that's regular expressions.
- 57:58That's why I go to LLMs.
- 57:59I'm like, you need to write me a regular expression with some capture groups because this is too much
- 58:05for me.
- 58:05I've been using LM Studio, which is really nice.
- 58:09It lets you download a bunch of different models and been running Llama and Mistral lately,
- 58:14and they've both been pretty good.
- 58:15Yeah, but they run locally, right?
- 58:17They run, it's free.
- 58:18It's super nice.
- 58:19One thing that's pretty interesting here is if you talked about this as well, and I don't
- 58:24know what this trend means.
- 58:25If you go to Stack Overflow Trends and you look at the most popular languages and you look
- 58:30right around late 2022, early 2023, there is a ridiculous drop in the popularity of questions
- 58:39on Stack Overflow for Python, for JavaScript, and interestingly, not a whole lot for the others.
- 58:44But that's when ChatGPT came out.
- 58:47Yeah.
- 58:47All right?
- 58:48So I don't know what it's going to mean, but it's clearly having some kind of effect somewhere,
- 58:53right?
- 58:53I don't know, but that might just be making people more productive and they're not on Stack
- 58:57Overflow, right?
- 58:57That might be a Stack Overflow problem, not a developer ecosystem problem.
- 59:00The friction to ask LLM is much, much smaller than asking actual people and then get some,
- 59:07get trolled by some moderator or whatever.
- 59:12So I can see that people are going to prefer LLMs to talking to people.
- 59:16And also most questions on Stack Overflow are quite trivial, to be honest.
- 59:20So I think that makes sense.
- 59:21How do I connect to a database using this library, right?
- 59:24How do I disable SSL because I'm getting this certificate error all the time, the classics.
- 59:29But it also means that a lot of trash code is being written right now, right?
- 59:34Like the things that I just told you that where you and I, we look at this code and we say,
- 59:38okay, this in principle is useful, but I cannot put this into production because error handling
- 59:44is wrong or there's some security issue or whatever.
- 59:47This is something that actually concerns me.
- 59:49Like a lot of people are writing code they don't understand or putting into production.
- 59:53And I think that's going to have consequences that are not going to be pretty.
- 59:56Yeah, I totally agree with you.
- 59:58And also my, one of my concerns you touched on as well is like, how do you go from beginning
- 1:00:03developer to slightly beyond junior developer?
- 1:00:07I don't know if LLMs are going to help people make that jump quicker or if they're just going
- 1:00:11to make that jump like a wider chasm because people won't need juniors because they're just
- 1:00:15going to ask the LLM to just do the thing, you know?
- 1:00:18Yeah.
- 1:00:18Yeah.
- 1:00:18This is, this is the problem.
- 1:00:19Like, like bean counters are going to look into Excel and I got to wonder what makes more
- 1:00:25sense, right?
- 1:00:26And the fact that they're eating their seed for next year and there's suddenly, oh my God,
- 1:00:31why are there no new senior software engineers?
- 1:00:34Well, we didn't make them, but yeah, it's going to be like a Cobalt.
- 1:00:38Fewer people who are really, really needed to keep things working.
- 1:00:43We will never retire, Michael.
- 1:00:44You will never retire.
- 1:00:45Exactly.
- 1:00:45Yeah.
- 1:00:46We're going to be programming on the beach with our margaritas in our seventies.
- 1:00:50Well, let's leave it there.
- 1:00:53Is that a positive take?
- 1:00:54I don't know.
- 1:00:54I really enjoyed our conversation though.
- 1:00:56And a lot of good advice for people.
- 1:00:58So thanks for being here.
- 1:00:59Yeah.
- 1:01:00Thanks for having me.
- 1:01:00Yeah, you bet.
- 1:01:01See you later.
- 1:01:01This has been another episode of Talk Python To Me.
- 1:01:05Thank you to our sponsors.
- 1:01:07Be sure to check out what they're offering.
- 1:01:08It really helps support the show.
- 1:01:10This episode is brought to you by WorkOS.
- 1:01:13If you're building a B2B SaaS app, at some point, your customers will start asking for enterprise
- 1:01:18features like SAML authentication, skim provisioning, audit logs, and fine-grained authorization.
- 1:01:24WorkOS helps ship enterprise features on day one without slowing down your core product development.
- 1:01:30Find out more at talkpython.com.
- 1:01:32And this episode is brought to you by Bluehost.
- 1:01:37Do you need a website fast?
- 1:01:38Get Bluehost.
- 1:01:39Their AI builds your WordPress site in minutes, and their built-in tools optimize your growth.
- 1:01:45Don't wait.
- 1:01:45Visit talkpython.fm/bluehost to get started.
- 1:01:49Want to level up your Python?
- 1:01:50We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:01:54Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:02:00And best of all, there's not a subscription in sight.
- 1:02:02Check it out for yourself at training.talkpython.fm.
- 1:02:05Be sure to subscribe to the show.
- 1:02:07Open your favorite podcast app and search for Python.
- 1:02:10We should be right at the top.
- 1:02:11You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:02:16and the direct RSS feed at /rss on talkpython.fm.
- 1:02:21We're live streaming most of our recordings these days.
- 1:02:24If you want to be part of the show and have your comments featured on the air,
- 1:02:27be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:02:31This is your host, Michael Kennedy.
- 1:02:34Thanks so much for listening.
- 1:02:35I really appreciate it.
- 1:02:36Now get out there and write some Python code.
- 1:02:38I'll see you next time.