Michael Kennedy: How many cores does your machine have?
Michael Kennedy: 10?
Michael Kennedy: 18?
Michael Kennedy: Well, your async Python code uses just one of them.
Michael Kennedy: That isn't a bug in asyncio.
Michael Kennedy: That's the design.
Michael Kennedy: And things like optimizing the event loops to be faster by maybe 20% with uv doesn't fundamentally
Michael Kennedy: change that.
Michael Kennedy: That's why Giovanni Bariliari started over.
Michael Kennedy: Joe is the creator of Granian, the Rust-based server that powers Talk Python and all the
Michael Kennedy: other things we run here.
Michael Kennedy: His new project is Tone.io, an async runtime written from scratch specifically for free-threaded Python.
Michael Kennedy: Real threads, a handful of primitives instead of async.io's pile of them,
Michael Kennedy: and it flat out refuses to even start if the GIL is present.
Michael Kennedy: This is Talk Python To Me, episode 561, recorded September 1st, 2026.
Michael Kennedy: Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
Michael Kennedy: This is your host, Michael Kennedy.
Michael Kennedy: I'm a PSF fellow who's been coding for over 25 years.
Michael Kennedy: Let's connect on social media.
Michael Kennedy: You'll find me and Talk Python on Mastodon, BlueSky, and X.
Michael Kennedy: The social links are all in your show notes.
Michael Kennedy: You can find over 10 years of past episodes at talkpython.fm.
Michael Kennedy: And if you want to be part of the show, you can join our recording live streams.
Michael Kennedy: That's right.
Michael Kennedy: We live stream the raw uncut version of each episode on YouTube.
Michael Kennedy: Just visit talkpython.fm/youtube to see the schedule of upcoming events.
Michael Kennedy: Be sure to subscribe there and press the bell so you'll get notified anytime we're recording.
Michael Kennedy: This episode is sponsored by Sentry's Seer.
Michael Kennedy: If you're tired of debugging in the dark, give Seer a try.
Michael Kennedy: There are plenty of AI tools that help you write code, but Sentry's Seer is built to
Michael Kennedy: help you fix it when it breaks.
Michael Kennedy: Visit talkpython.fm/sentry and use the code Talk Python26, all one word, no spaces,
Michael Kennedy: for $100 in Sentry credits.
Michael Kennedy: And it's brought to you by us.
Michael Kennedy: Talk Python and Python Bytes both now have MCP servers.
Michael Kennedy: Point your AI at 10 plus years of Python episodes, transcripts, and show notes.
Michael Kennedy: Free. Click MCP in the nav at talkpython.fm and at Python Bytes.
Michael Kennedy: Hello, hello. Welcome back to Talk Python and me.
Michael Kennedy: Great to have you here, Joe.
Michael Kennedy: Hey, thanks for having me. It's nice to get back to the show.
Michael Kennedy: It's been a while.
Michael Kennedy: It has been a while.
Michael Kennedy: And we talked about Granian last time, the Rust-based web application server for Python.
Michael Kennedy: And I got to just take a moment and say thank you.
Michael Kennedy: We'll come back to this.
Michael Kennedy: But thanks for powering Talk Python and all the different things.
Michael Kennedy: I think across our web apps, I don't know, like 10 million requests a month.
Michael Kennedy: And it's been flawless.
Michael Kennedy: So thanks.
Michael Kennedy: I appreciate you serving up all the stuff for everyone.
Giovanni Barallari: Oh, yeah.
Giovanni Barallari: Thanks.
Giovanni Barallari: It's been a pleasure.
Giovanni Barallari: Like, it's nice to see, you know, when something just works.
Giovanni Barallari: like when you do something and like at the end of the day it just works and people start using it
Giovanni Barallari: like of course like they they ask for a bunch of features you know um but it's nice to see yeah it
Michael Kennedy: is really nice to see and i think it's i think it's good now it's been a while since you've been on the
Michael Kennedy: show a couple years i don't i didn't check the exact date when i look back maybe people are new
Michael Kennedy: to the show or haven't heard your prior episode or just don't remember like give us a quick
Giovanni Barallari: introduction who you are yeah sure so i'm giovanni but everybody can call me joe i'm italian but i
Giovanni Barallari: live in vienna i am working as a programmer in century but i'm a physicist so i think like
Giovanni Barallari: that's pretty peculiar i've been like in the open source ecosystem uh mainly in python um probably
Giovanni Barallari: for the last oh god I think like it's almost 20 years now um and fun fact like I actually started
Giovanni Barallari: like um doing open source or or um contributing to open source projects even before actually
Giovanni Barallari: working as a programmer so um yeah that's me I maintain like too many packages nowadays for like
Giovanni Barallari: the energy I have.
Giovanni Barallari: But yeah, that's pretty much.
Giovanni Barallari: Excellent.
Michael Kennedy: Yeah, I know how that goes with the packages.
Michael Kennedy: It's like, oh, here's a cool idea.
Michael Kennedy: I want to put it out there.
Michael Kennedy: If it gains no traction, you can shut it down.
Michael Kennedy: If it gains a ton of traction, you're excited.
Michael Kennedy: If it gains a little traction,
Michael Kennedy: but enough, then you got to keep working on it.
Michael Kennedy: That's kind of not ideal, right?
Giovanni Barallari: Yeah.
Giovanni Barallari: And especially like nowadays with AI,
Giovanni Barallari: like the amount of things you,
Giovanni Barallari: oh, I have an idea.
Giovanni Barallari: Like the chances like to just throw a bunch of agents into that and see what happens.
Giovanni Barallari: It's very dangerous.
Michael Kennedy: I have an idea.
Michael Kennedy: It'll probably take me an hour.
Michael Kennedy: Let me see if I can validate it.
Michael Kennedy: Thursday afternoon, you're still like, oh, I'm still almost there.
Michael Kennedy: It's like, where did my week go?
Michael Kennedy: What happened?
Michael Kennedy: It's fun though, isn't it?
Michael Kennedy: It's a wild time.
Giovanni Barallari: Yeah, it's weird, right?
Giovanni Barallari: Because in a way, we have this very powerful, not super constant tool.
Giovanni Barallari: but it's very powerful and and sometimes just amazing like sometimes like what do you what
Giovanni Barallari: you get back is just amazing and you say like oh okay that's nice that's unexpected sometimes is
Giovanni Barallari: the dumbest thing possible you can you you can get but i guess like the point the main point is that
Giovanni Barallari: i think it it shows up how as humans we have like a complicated relationship with tools
Giovanni Barallari: it can exploit a bunch of weird human behavior sometimes so yeah yeah if you like building things
Michael Kennedy: you know create you've got ideas and you want to see them come to life it's an unprecedented time
Michael Kennedy: if if you really your main joy was to be in the code working on the little bits of nuance i can
Michael Kennedy: see that it's frustrating and uh there's there's a whole there's a whole thing that we go into there
Michael Kennedy: but that's probably not.
Michael Kennedy: But wow, what a crazy time, right?
Michael Kennedy: Yeah, absolutely.
Michael Kennedy: Yeah, so let's jump into the topics here.
Michael Kennedy: I think the first thing I want to do is let's just do a little dive into Granian.
Michael Kennedy: That's why I reached out to you to have you on the show the first time.
Michael Kennedy: Like I said, it's powering.
Michael Kennedy: I have on the Talk Python server,
Michael Kennedy: there's 33 different containers running a bunch of different things,
Michael Kennedy: and probably about 15 of them are running Granian.
Michael Kennedy: Nice.
Michael Kennedy: Yeah.
Michael Kennedy: So like I said, it's been really, really cool.
Michael Kennedy: just tell people what is Granian because I think not only is it interesting as a thing that you've
Michael Kennedy: done previously and been on the show before it's also an interesting lead-in to where we're going
Giovanni Barallari: with Tonio so what's great yeah sure uh so Granian is an application server for Python so in Python
Giovanni Barallari: for historical reasons um we separated like the application layer from the HTTP layer so when we
Giovanni Barallari: want to serve a web application in Python compared to other languages
Giovanni Barallari: in which the server part is actually a part of the application.
Giovanni Barallari: In Python, we tend to have a separated package, which is a server,
Giovanni Barallari: and that server's import your actual application.
Giovanni Barallari: And then we have application protocols
Giovanni Barallari: to make the server talk with your application and back.
Giovanni Barallari: The two main protocols in Python are VUSGI or WSGI.
Giovanni Barallari: I never really understood how to say that,
Giovanni Barallari: which is like the original PET333, if I'm not mistaken.
Giovanni Barallari: So it's quite ancient in the Python history.
Giovanni Barallari: And once we had like AsyncIO, a new protocol emerged.
Giovanni Barallari: That's called ASGI or ASGI because, of course,
Giovanni Barallari: it's the asynchronous server gateway.
Giovanni Barallari: So, Granian is, again, an application server,
Giovanni Barallari: so you can consider it as an alternative to MicroVoosgi,
Giovanni Barallari: Uvicorn, Hypercorn, and a bunch of other servers
Giovanni Barallari: that happened during the years.
Giovanni Barallari: And, yeah, the peculiar fact is it's made with Rust.
Giovanni Barallari: So, compared to all the other servers you might use in Python,
Giovanni Barallari: all the HTTP part or the network layer
Giovanni Barallari: is running completely out of the interpreter,
Giovanni Barallari: which kind of alleviates the load on the interpreter,
Giovanni Barallari: like on the Python side.
Giovanni Barallari: And depending on the context,
Giovanni Barallari: it might be more performant
Giovanni Barallari: or it might stabilize your latency more.
Michael Kennedy: You know, I think thinking back now, I'm pretty sure that that was the reason I chose Granian.
Michael Kennedy: Not that it was a ton faster, but the P95 bad side of things.
Michael Kennedy: Like how much might it slow down under certain weird circumstances?
Michael Kennedy: It was way more stable than a lot of the other servers, right?
Michael Kennedy: And that's kind of what you're referring to.
Giovanni Barallari: Yeah, because again, like a normal server which runs everything into Python,
Giovanni Barallari: Like it has this kind of side effects that when your application is starting becoming slow, it kind of becomes like an infinite loop in which like the server adds additional load to the interpreter, which is already like highly loaded from your application.
Giovanni Barallari: And so like Graniac kind of avoids all of that because like even if your application is fully loaded, like all the web and network layer is out of the interpreter.
Giovanni Barallari: It doesn't disturb, let's say the interpreter with that.
Michael Kennedy: Yeah.
Michael Kennedy: I do want to just give a little bit of a hat tip to WSGI or WSGI.
Michael Kennedy: Because, yeah, you pointed out it is old, but it's really, really nice that if somebody is out there running on GUnicorn or they're running on some other server, MicroWSGI, which you should stop running MicroWSGI because it's not supported anymore.
Michael Kennedy: You don't have to change your code at all.
Michael Kennedy: You just take your flask or your Jenga or whatever, and you just say, now run here.
Michael Kennedy: And they just, Grandin talks WizGey or Asggy to that thing, and it's transparent.
Michael Kennedy: It's beautiful.
Michael Kennedy: Yeah.
Giovanni Barallari: I mean, there are like still some, you know, sometimes weird things like, like, Vertzoic
Giovanni Barallari: has some subtleties, sometimes some nuances.
Giovanni Barallari: So I had to like add some environment key just for Verzoic because under some circumstances, if that key is not there, things don't work exactly good.
Giovanni Barallari: So yes, I agree that like having like the two protocols separated and coded like in a specific way gives you this ability to switch the server.
Giovanni Barallari: On the other hand, sometimes, you know, you can be a pain in some time.
Giovanni Barallari: Yeah, for sure.
Michael Kennedy: Yeah, for sure.
Giovanni Barallari: But yeah, I'd say like we like recently it's getting more popular.
Giovanni Barallari: So I'd say if I'm not mistaken, like a few weeks ago, I think I surpassed like HyperCorn in terms of downloads.
Giovanni Barallari: Awesome.
Giovanni Barallari: And yeah, it's used like in a bunch of different big companies, Microsoft, Google, for sure.
Giovanni Barallari: We use it at Sentry, of course.
Giovanni Barallari: And I think like Sentry is the only company in which we use like all the three supported
Giovanni Barallari: protocols of Granian because Granian also supports like its own protocol, which is named
Giovanni Barallari: like RSGI, I don't know, like RSGI, which is a redesign.
Giovanni Barallari: Risky.
Giovanni Barallari: Yeah.
Giovanni Barallari: um so yeah i'd say it's going pretty good um i think like the last let's say this year was mostly
Giovanni Barallari: into um not not not not mostly about features i think features but mostly about you know making
Giovanni Barallari: the thing more stable and covering like some edge cases um especially again we're using it the
Giovanni Barallari: Sentry. So now like if something is wrong with Grinia, like I have people knocking on my door.
Michael Kennedy: I bet you do. Well, I mean, with Sentry, Sentry gets an insane amount of like an unimaginable
Michael Kennedy: amount of traffic. I'm sure with the error reporting side of things and probably a little
Michael Kennedy: more so these days on the MCP and API side as well with all the agents. I know that I use the MCP
Michael Kennedy: and absolutely love it. It's been incredible. It's really, really good. I could just say on my
Michael Kennedy: project hey there's a century error i got what's up like literally that's all i gotta say in clause
Michael Kennedy: like hold on we're on it and it's like yeah you know five minutes later it's like here's what's
Michael Kennedy: going on let's work on it you know yeah really good stuff uh i do want to give a quick shout out as
Michael Kennedy: well uh on this regard to gradient like people are like oh it's it's not as popular as server x or
Michael Kennedy: whatever right although i think that's starting to fade it's it's got 5 000 stars and a ton of
Michael Kennedy: people using it and so on yeah but it's also based on hyper from rust which itself has uh where where's
Michael Kennedy: my numbers, 410,000 projects using it. So it's really tested, right? And obviously the stuff at
Giovanni Barallari: Sentry as well. Yeah. Yeah. Like the only thing I'm sure about Granian is that like the HTTP stack,
Giovanni Barallari: that's super safe. Like that's like, I could bet like everything I have on that. So if something
Giovanni Barallari: is wrong in Granian, like that's on me, not on Hyper, like to be clear. This portion of Talk
Michael Kennedy: Python to me is brought to you by Sentry and Sear AI. There are plenty of AI tools that help you
Michael Kennedy: write code, but Sentry Sear is built to help you fix it when it breaks. The difference is context.
Michael Kennedy: Sear isn't just guessing based on syntax. It's analyzing your actual Sentry data,
Michael Kennedy: your stack traces, logs, and failure patterns. Because it has the full context, it can
Michael Kennedy: A, spot buggy code in review and help prevent issues before they happen,
Michael Kennedy: and B, identify the root cause of production errors.
Michael Kennedy: It can even draft a fix and hand the work off to an agent-like cursor to open a PR for you.
Michael Kennedy: Seer turns Sentry into a complete loop.
Michael Kennedy: You have your traces, errors, logs, and replays to see the problem,
Michael Kennedy: and now AI to help solve it.
Michael Kennedy: Join millions of devs at companies like Claude, Disney+, and even Talk Python,
Michael Kennedy: who use Sentry to move faster.
Michael Kennedy: Check them out at talkpython.fm/sentry and use code talkpython26,
Michael Kennedy: all one word, for $100 in Sentry credits.
Michael Kennedy: Thank you to Sentry for supporting Talk Python.
Michael Kennedy: I recently did a post over on my personal blog
Michael Kennedy: calling cutting Python web app memory by 31%.
Michael Kennedy: And I did a ton of analysis and stuff
Michael Kennedy: on how I was running Granian and different things,
Michael Kennedy: just how I was running Python.
Michael Kennedy: And I think this is going to be a good lead-in
Michael Kennedy: to where we're going as well.
Michael Kennedy: I got it to where I was using 1.3 gigs, let's say, for Talk Python training the courses specifically.
Michael Kennedy: And people are like, oh, it's just a little courses thing.
Michael Kennedy: Like, well, it has 178,000 lines of Python, so it's not a totally small project.
Michael Kennedy: But down by the end, I did a bunch of stuff on it.
Michael Kennedy: Lazy imports.
Michael Kennedy: I switched to async, which is why I brought this up.
Michael Kennedy: But somewhere down here, I don't know what the final number is.
Michael Kennedy: Here we go.
Michael Kennedy: In the end, I got it down to 450 megs from 0.28 gigs.
Michael Kennedy: One of the main reasons I did that as a way I want to kind of want to lead into like this,
Michael Kennedy: where we're going is I said, well, the way grading works is for each,
Michael Kennedy: either you can make multi-processes that are single threaded or it could do multiple threads
Michael Kennedy: and then it'll create a separate interpreter for each one.
Michael Kennedy: Either way, it kind of like replicates out the running.
Michael Kennedy: It'll create copies in one way or another of your code.
Michael Kennedy: And that, if you could run one of them, that would be great.
Michael Kennedy: But why do we have so many?
Michael Kennedy: We have so many because of the GIL.
Michael Kennedy: We have poor concurrency.
Michael Kennedy: It's really hard to handle a lot of load and like actually access, you know, my servers,
Michael Kennedy: eight cores.
Michael Kennedy: Like I could only access one core like normally, right?
Michael Kennedy: And so we do all these things to like explode them out.
Michael Kennedy: But what is the most expensive?
Michael Kennedy: Like five years ago, this was true on servers, but really is true now.
Michael Kennedy: What is most expensive?
Michael Kennedy: Memory, not compute, right?
Michael Kennedy: Yeah.
Michael Kennedy: Thanks AI.
Michael Kennedy: Thanks Altman.
Michael Kennedy: We really appreciate that.
Michael Kennedy: But we've free-threaded Python now.
Michael Kennedy: That's a thing.
Michael Kennedy: And so we're kind of moving into this world where we can take better advantage of the hardware and we don't have to multiply out.
Michael Kennedy: I know your process takes 500 megs of RAM, but we need four of them.
Michael Kennedy: So now you need two gigs just to run your code.
Michael Kennedy: We don't necessarily need that anymore.
Michael Kennedy: And grading would be a really good foundation for that.
Michael Kennedy: But let's just think broadly about free-threading and async as it is and stuff.
Michael Kennedy: I know you've thought a lot about this because of this project that you built.
Michael Kennedy: Well, what do you think?
Giovanni Barallari: First thing, can I say free threading to me?
Giovanni Barallari: It's super exciting.
Giovanni Barallari: And I don't know why people are not as much excited as me on this.
Giovanni Barallari: Because this is, I'd say, the biggest thing that ever happened into Python since the beginning of Python.
Giovanni Barallari: In the last 30 years.
Giovanni Barallari: do you remember like Python 2 to Python 3 and all like,
Giovanni Barallari: oh, now strings are not bytes anymore and everything is Unicode?
Michael Kennedy: Yeah.
Giovanni Barallari: That's nothing compared to, hey, the gil is not there anymore.
Giovanni Barallari: Like we talk about like every Python room everywhere in the world,
Giovanni Barallari: like at some point talked about the gil and why we have to do to have the gil, right?
Giovanni Barallari: Right.
Michael Kennedy: The Gilectomy that Larry Hastings had, it seemed to perpetually be working on and never
Michael Kennedy: kind of went anywhere.
Michael Kennedy: Yeah.
Michael Kennedy: It took like 15 years of people talking about this and it finally landed.
Giovanni Barallari: Like last year, yes, of course, last year it was beta because like in Python 3.13, it
Giovanni Barallari: was like, this is an experiment still.
Giovanni Barallari: That was the asterisk on top.
Giovanni Barallari: But since Python 3.14, that's considered stable.
Giovanni Barallari: It's exactly as the normal GIL-included interpreter.
Giovanni Barallari: And at the end of the day, the biggest part of all of this
Giovanni Barallari: was using reference counting instead of singleton.
Giovanni Barallari: So I guess I'm excited about free-threaded Python
Giovanni Barallari: because finally I have the language I love the most.
Giovanni Barallari: not because of the structure, not because of types or how it's designed,
Giovanni Barallari: but because of this awesome community that only Python language has,
Giovanni Barallari: at least in my experience.
Giovanni Barallari: And so finally, I can use this language with actual threads.
Giovanni Barallari: So I'm not obliged anymore to think, oh, wait, we are in Python,
Giovanni Barallari: so I need to use a C library or something to take advantage of my CPU,
Giovanni Barallari: Especially given, I don't know, we are in the era of, hey, even if you buy a $200 CPU that probably has 12 cores or something.
Giovanni Barallari: So yeah, I'm very excited.
Giovanni Barallari: I'm confused about the lack of adoption.
Giovanni Barallari: I would love to see more adoption in this.
Giovanni Barallari: And of course, like there are reasons, like every native C compiled extension has to be fixed to be thread safe.
Giovanni Barallari: And probably like on a bunch of ancient extensions, that's not simple or easy.
Giovanni Barallari: Yeah, I don't know, man.
Giovanni Barallari: Like I'm just too excited.
Giovanni Barallari: Like I want people to use free thread.
Michael Kennedy: I know.
Giovanni Barallari: And getting it is so much easier as well.
Michael Kennedy: it's just uv Python install, you know, that 3.14 T and you got it, right?
Michael Kennedy: Yeah.
Giovanni Barallari: Yeah.
Giovanni Barallari: And like, I don't know, I'm so pissed at the maintainer of the Docker images
Giovanni Barallari: because we don't have like an official 3.14 free threaded image.
Giovanni Barallari: Like why?
Michael Kennedy: Why?
Michael Kennedy: Oh yeah, that is actually a good point.
Michael Kennedy: Like it has been a year and a half and it just requires putting the T on the uv installed bit.
Giovanni Barallari: Yeah.
Giovanni Barallari: Yeah, but again, to my perspective, free-threaded Python opens the window to do a bunch of...
Giovanni Barallari: First, to solve a bunch of the issues you mentioned, which is, for example, in Centri,
Giovanni Barallari: the number one issue is...
Giovanni Barallari: I mean, Centri at the end of the day is this 18-years-old Django monolith.
Giovanni Barallari: And so, yes, we deploy in several multiple different deployments, activating just some parts.
Giovanni Barallari: But even so, like, yeah, we have the same problem, which is, hey, like, in order to use like one C view out of like a VM that GCP gives us, like, yeah, we need to spawn like four different processes and require like, I don't know, four, five, six gigabytes of memory for like a single pod.
Michael Kennedy: And not only do you have to do that, you also have to, anytime there's some sort of in-memory cache, like an LRU cache or something, every one of those has to be spun up for all four, not just for one, right? There's a lot of powerful sharing.
Michael Kennedy: Do we want to start talking about observability?
Giovanni Barallari: Because you cannot just use like
Giovanni Barallari: the Prometheus SDK or anything like that.
Giovanni Barallari: Because again, like then those became like
Giovanni Barallari: four different instances.
Giovanni Barallari: So you cannot even track like the same metrics
Giovanni Barallari: unless you do like some weird tricks.
Giovanni Barallari: Like, yeah, relying on the multiprocessing library.
Giovanni Barallari: It's messy, man.
Giovanni Barallari: So like, yeah, I think like
Giovanni Barallari: FreeThreader like solves a bunch of problems,
Giovanni Barallari: Especially in web development in Python.
Giovanni Barallari: Because everybody says like, oh yeah, they did this just because of AI, you know,
Giovanni Barallari: because they can like make things parallel, whatever.
Giovanni Barallari: I don't get that.
Giovanni Barallari: Like, like we have like this amazing feature and it solves a bunch of problem
Giovanni Barallari: on web development and also like it opens up the a bunch of new opportunities.
Giovanni Barallari: Because again, like one of the most annoying parts in Granian, which is also
Giovanni Barallari: Like one of the things that people opens like the most, the vast majority of issues about
Giovanni Barallari: is because nobody understands like how socket sharing works across different processes.
Giovanni Barallari: And again, like with FreeThreader, like that's just go away if we have something different
Giovanni Barallari: from a Synco.
Giovanni Barallari: And I guess that's the, that's when we get on the point here.
Giovanni Barallari: Because for example, like in Grainium, so Grainium supports FreeThreader Python scenes
Giovanni Barallari: 2.0, if I'm not mistaken.
Giovanni Barallari: And so when you use
Giovanni Barallari: Granian on a free-threaded interpreter,
Giovanni Barallari: workers become
Giovanni Barallari: threads.
Giovanni Barallari: They're no longer processes.
Giovanni Barallari: And I can skip all the dance
Giovanni Barallari: of, yeah, open the socket,
Giovanni Barallari: but just bind
Giovanni Barallari: on that, but not on listen, because then
Giovanni Barallari: it gets to be shared across processes
Giovanni Barallari: and so each worker can have his own
Giovanni Barallari: backlog. It's a mess, man.
Giovanni Barallari: So on the free-threaded variant,
Giovanni Barallari: Like, Grenian already, like, used threads.
Giovanni Barallari: The subtlety is that each thread has its own event loop.
Giovanni Barallari: So what Grenian cannot do today is sharing things between those threads.
Giovanni Barallari: At the end of the day, yes, the application is shared, but, like, every request, like, if a repus comes to a worker, that's it.
Giovanni Barallari: Like, there's no...
Giovanni Barallari: You cannot cross boundaries, right?
Giovanni Barallari: when you await for something,
Giovanni Barallari: when you suspend for something,
Giovanni Barallari: that's the loop,
Giovanni Barallari: the event loop you're running into.
Michael Kennedy: Which is a big limitation for servers.
Michael Kennedy: Yeah, and one is calling await
Michael Kennedy: and another is calling await
Michael Kennedy: or maybe doing some work,
Michael Kennedy: but if they were the same event loop,
Michael Kennedy: one thing could run
Michael Kennedy: because the other is awaiting,
Michael Kennedy: but they're actually separate altogether, right?
Giovanni Barallari: Yeah, and also you can still end up
Giovanni Barallari: in these weird conditions
Giovanni Barallari: in which maybe, I don't know,
Giovanni Barallari: 50% of your connection
Giovanni Barallari: we're bound to a specific event loop.
Giovanni Barallari: And so you also have like unbalancement
Giovanni Barallari: between like the different threads.
Giovanni Barallari: So you have like one thread
Giovanni Barallari: that receives the vast majority of things,
Giovanni Barallari: the other thread doing nothing.
Giovanni Barallari: Yeah.
Giovanni Barallari: Let's say like we have new opportunities.
Giovanni Barallari: We kind of lack some libraries,
Giovanni Barallari: like some libraries behavior
Giovanni Barallari: that can actually give us like
Giovanni Barallari: all the actual meat here.
Michael Kennedy: Agreed.
Michael Kennedy: I want to talk about one area before we dive in, the Tone.io,
Michael Kennedy: and that's just asyncio event loops.
Michael Kennedy: And I know during your presentation,
Michael Kennedy: so you gave a talk on this at EuroPython this year,
Michael Kennedy: and I'll link to the topic right here in the moment.
Michael Kennedy: But there are people like, oh, well, we have uvloops,
Michael Kennedy: so doesn't that kind of solve it?
Michael Kennedy: And I think that's a really interesting thought
Michael Kennedy: because without calling out anybody, I didn't intend to call out anybody.
Michael Kennedy: I think it just highlights in the Python space,
Michael Kennedy: There's just not a lot of thinking about what concurrency means,
Michael Kennedy: why it matters, how you program for it.
Michael Kennedy: And that's going to be a challenge.
Michael Kennedy: I think that's part of the challenge of what you're talking about
Michael Kennedy: with the adoption of free-threaded Python.
Michael Kennedy: But I think also it is a challenge in the sense that
Michael Kennedy: thinking about making the event loop faster by, I don't know,
Michael Kennedy: 20% or whatever uvloop actually does, which is great,
Michael Kennedy: it doesn't really address the fact that you're still only on one thread.
Michael Kennedy: Your event loop can access, like, I just, against probably better judgment,
Michael Kennedy: I just bought a Mac Studio Max, which has 18 cores.
Michael Kennedy: If I write one thread, that's about like 5% of the capacity of that machine.
Michael Kennedy: So what does it matter if it's 4.9% or 5.1% depending on which loop?
Michael Kennedy: I don't care.
Michael Kennedy: That is broken either way.
Michael Kennedy: I want 95% capacity.
Michael Kennedy: Yes.
Michael Kennedy: Right?
Michael Kennedy: And that's, I don't know.
Michael Kennedy: I thought it would be worthwhile to kind of like talk about uvloop a little bit.
Michael Kennedy: And you built our loop.
Michael Kennedy: And those things are great in their building blocks.
Michael Kennedy: Yeah.
Michael Kennedy: They're not the panacea.
Michael Kennedy: They're not the fix.
Giovanni Barallari: Yeah, and we also now have Marcelo Trzesitsky, the maintainer of UVCore and Starlet.
Giovanni Barallari: It has recently published Zoovloop, which is another event loop for Python relying on libUV, but it's written in Zig.
Giovanni Barallari: But yeah, as you said, all of these event loops,
Giovanni Barallari: yes, they can optimize some of the hot part of the cycle.
Giovanni Barallari: But basically, that's it.
Giovanni Barallari: Nothing really changed the shape of how things work.
Giovanni Barallari: And so, yes, for sure, you should actually install
Giovanni Barallari: uvloop or r loop or zoo v loop or whatever to to speed up like because that's performance you're
Giovanni Barallari: leaving on the table regardless right like so uh it's good to have this project because they also
Giovanni Barallari: like can light uh some of the inefficiencies of a sink io in my opinion um so i think it's still
Giovanni Barallari: good to have these projects and you should use them um but yeah they want like the best you can
Giovanni Barallari: GAT is probably like in the order of like 20% in, and we're talking about like row throughput
Giovanni Barallari: if you're just doing TCP and nothing else, which is nobody does like, like nothing does
Giovanni Barallari: nothing out there.
Giovanni Barallari: Right?
Giovanni Barallari: Like we do a bunch of stuff.
Giovanni Barallari: Yeah.
Michael Kennedy: If you construct an example where basically all you're doing is waiting very efficiently,
Michael Kennedy: then you start to see those, those deviate.
Michael Kennedy: And also if you've got, like, I've got 10 tasks that run over two seconds.
Michael Kennedy: It does zero.
Michael Kennedy: It doesn't matter.
Michael Kennedy: This only matters when you're doing very, very fine-grained work and tons of it,
Michael Kennedy: and there's lots of switching and that sort of thing, right?
Giovanni Barallari: Yes, yes.
Giovanni Barallari: And so, yes, I guess this was one of my realizations.
Giovanni Barallari: Because, again, I worked on ArtLoop mainly last year.
Giovanni Barallari: And working on ArtLoop made me realize two things.
Giovanni Barallari: The first thing is that asimkayo, it's overcomplicated sometimes.
Giovanni Barallari: It's so fun fact at the presentation I did about that loop in Python Italy 25.
Giovanni Barallari: I had a slide asking to the audience, what's the difference between a protocol and a transport in Async.io.
Giovanni Barallari: Because if you check the official documentation of Python and you get to that chapter, you will find out that they have like to try to explain you that difference.
Giovanni Barallari: they try to do that like in three different ways,
Giovanni Barallari: which to my experience,
Giovanni Barallari: like if you need three different ways
Giovanni Barallari: to explain the same thing,
Giovanni Barallari: something is deeply wrong.
Michael Kennedy: Definitely violates an Einstein core philosophy.
Giovanni Barallari: Yes.
Giovanni Barallari: Also because like, again,
Giovanni Barallari: if we think about the Zen of Python,
Giovanni Barallari: like simple is better than complex, right?
Giovanni Barallari: So that was my first realization, right?
Giovanni Barallari: Because, again, like you have a bunch of primitives, like you have events, futures.
Giovanni Barallari: Oh, by the way, every time they get spawned into the event loop, they get wrapped into a task.
Giovanni Barallari: What is a task? Nobody knows.
Giovanni Barallari: Oh, and by the way, when they actually run inside the event loop, they became handles.
Giovanni Barallari: So we have a bunch of this weird thing that they're not really exposed to you if you just write async code.
Giovanni Barallari: But if you need to debug something when something is wrong, then you need all of that to understand what's going on, right?
Giovanni Barallari: And the other realization, again, was, okay, I reached a point in which there's no other possible optimization in our book.
Giovanni Barallari: Because the vast majority of CPU time spent here is around AsyncIO primitives.
Giovanni Barallari: And I have one single thread.
Giovanni Barallari: And so, like, the only, when I came to realize this, I just said, okay, wait a second.
Giovanni Barallari: Is that, is really that hard to start like scratch whiteboard?
Giovanni Barallari: Like from the beginning, like let's just assume for a second, like asyncio never existed.
Giovanni Barallari: And I want to do like async stuff in Python.
Giovanni Barallari: What that look like?
Giovanni Barallari: Like what, what does it mean to make like an asynchronous runtime in Python?
Giovanni Barallari: Is that hard?
Giovanni Barallari: And I don't know, like, I guess three or four weeks after this, I just got like an asynchronous
Giovanni Barallari: runtime, a complete alternative
Giovanni Barallari: asynchronous runtime running on Python with
Giovanni Barallari: multiple threads.
Michael Kennedy: To be clear on free-threaded Python, right?
Giovanni Barallari: Yes, free-threaded Python only because
Giovanni Barallari: again, to have like real threads
Giovanni Barallari: I mean, the design is to have
Giovanni Barallari: real threads, so the moment you have
Giovanni Barallari: the gill, I say, no, no, no,
Giovanni Barallari: runtime error, change your
Michael Kennedy: interpreter because this is not good,
Michael Kennedy: right?
Michael Kennedy: This portion of Talk Python I May is brought to you by
Michael Kennedy: our AI tools. You know that
Michael Kennedy: thing where you ask an AI something about
Michael Kennedy: Python and it confidently tells you about a library version from 18 months ago? Well, we fixed that,
Michael Kennedy: at least for our shows. Talk Python and Python Bytes both have MCP servers now. Connect Talk Python
Michael Kennedy: and your AI can search over 550 episodes, full transcripts, every guest in the entire course
Michael Kennedy: catalog. Connect Python Bytes and you get almost 500 episodes of Python news going back to 2026,
Michael Kennedy: including every link we've ever put in the show notes. That means you can say things like,
Michael Kennedy: ask Talk Python what astral joining OpenAI means for uv or what has Python bytes said about uv
Michael Kennedy: and get real answers with real links, not hallucination. Name the show in your prompt
Michael Kennedy: and your AI knows exactly where to look. And if you live in the terminal, Talk Python also has a CLI
Michael Kennedy: too. One line, uv tool install talk-python-cli and then search episodes, transcripts, guests,
Michael Kennedy: courses without ever opening a browser. It's open source and it outputs text, JSON, and Markdown,
Michael Kennedy: so it feeds the AI tools that don't speak MCP yet. And here's the real reason I built it.
Michael Kennedy: Both shows cover around 10 years of Python history. The people, the decisions, the packages that took
Michael Kennedy: over, and the ones that quietly didn't. This enhanced access is free. No account, no API key,
Michael Kennedy: nothing to buy. This history should belong to all of us. Visit talkpython.fm and Python Bytes and
Michael Kennedy: click the MCP link in the nav bar. Connect them right now to your agents so that they'll be
Michael Kennedy: accessible anytime you need them in the future. And so yeah, that was like kind of the landscape
Giovanni Barallari: in which I started building Tonio or Tonio. You can pronounce it like however you want. Like I'm
Michael Kennedy: Italian, so I say Tonio, of course. I think obviously, well, you have to do Tonio.
Michael Kennedy: So it's really good.
Michael Kennedy: But as it pairs to asyncio, tone IO also kind of like as a hat to that, right?
Michael Kennedy: Yeah.
Giovanni Barallari: But we have Trio.
Giovanni Barallari: So that's not Trio.
Michael Kennedy: Trio is living there a little bit as well.
Michael Kennedy: Yeah.
Michael Kennedy: So this is a really interesting project that you have.
Michael Kennedy: And it basically says, what if we actually had threads?
Michael Kennedy: One of the things that's endlessly frustrated me about Python and asyncio and consequently
Michael Kennedy: I think the language implementation of async await is it's really good.
Michael Kennedy: I think, you know,
Michael Kennedy: the way it sort of turns async code into what looks like structurally
Michael Kennedy: serializable code or serial code is really, really nice.
Michael Kennedy: But the,
Michael Kennedy: the fact that the developer has to juggle loops and which loop and that loop.
Michael Kennedy: No, that's not the right loop.
Michael Kennedy: Like so many times I've been, Oh, I want to do this request.
Michael Kennedy: Oh, are you using court or an async web framework? You,
Michael Kennedy: there is an async loop, but not that one.
Michael Kennedy: you need the one created by the web framework.
Michael Kennedy: Like, oh, did you initialize the async database connection
Michael Kennedy: before it ran the web thing?
Michael Kennedy: And like, nope, that's the wrong one.
Michael Kennedy: And there's all this weird juggling that's just so janky.
Michael Kennedy: And I'm pretty sure it's janky
Michael Kennedy: because we didn't have true threads.
Michael Kennedy: And the possibility, oh, what if you crisscross this?
Michael Kennedy: Everything sort of falls apart.
Michael Kennedy: And if you could just say, look, it's just multi-threaded.
Michael Kennedy: And there is a thing that called the loop
Michael Kennedy: and that's where stuff runs.
Michael Kennedy: And I don't care who started it.
Michael Kennedy: It's our loop.
Michael Kennedy: When I need a loop, the runtime Python itself has a loop for me and I'll use it.
Michael Kennedy: Right.
Michael Kennedy: And I feel like you sort of took that philosophy a little bit.
Michael Kennedy: Right.
Giovanni Barallari: Yeah.
Giovanni Barallari: I'd say like the number one inspiration for Sonio is Tokyo, which is the number one Rust
Giovanni Barallari: asynchronous runtime.
Giovanni Barallari: That's probably because like I spend like in Rust a bunch of time.
Giovanni Barallari: So yeah, like, I don't know, for example, like the weird thing to me is like, we still like,
Giovanni Barallari: if you just want to do like an asynchronous program in Python,
Giovanni Barallari: like a program, like let's say a script or, I don't know,
Giovanni Barallari: like a simple CLI, we still need to do like a synch.io run.
Giovanni Barallari: Like why?
Giovanni Barallari: Like the, yeah, the amount of things you need to know
Giovanni Barallari: and decide and stuff there is like completely different
Giovanni Barallari: from other languages.
Giovanni Barallari: Yeah.
Giovanni Barallari: Because again, like think about JavaScript.
Giovanni Barallari: You don't decide anything.
Giovanni Barallari: Like that's async in JavaScript.
Michael Kennedy: That's true.
Michael Kennedy: Well, I'll tell you a little bit why you can't just,
Michael Kennedy: why you still got to call async run
Michael Kennedy: because there's like a foundational layer
Michael Kennedy: that's not present.
Michael Kennedy: And it's your job to write the foundation
Michael Kennedy: on which asyncio executes, right?
Michael Kennedy: Like it's still your job to figure,
Michael Kennedy: okay, how do I actually create a loop?
Michael Kennedy: How do I run a loop?
Michael Kennedy: How do I, like, it's your job.
Michael Kennedy: You can't just create an async def method
Michael Kennedy: and call it because there's nowhere for it to go
Michael Kennedy: until you go create, you know what I mean?
Michael Kennedy: There's like, there's just,
Giovanni Barallari: But the foundation isn't quite there.
Giovanni Barallari: But again, it's an entry point, right?
Giovanni Barallari: So in Tonio, for example, yes, you have Tonio run.
Giovanni Barallari: You want to instruct everything and configure the runtime and do whatever you want.
Giovanni Barallari: Yes, you can do that.
Giovanni Barallari: You don't want to do that.
Giovanni Barallari: You have a single decorator, which is Tonio main.
Giovanni Barallari: You put it on your function, your entry point in your program, and it's done.
Michael Kennedy: Yeah. All right. Before we talk about that, before we get too much in the weeds of it,
Michael Kennedy: why don't you just give us like, talk us through writing a program in this. There's also two ways,
Michael Kennedy: like maybe you could, after you talk about this, you could like sort of get into the,
Michael Kennedy: what this concept of colored functions versus not, and sometimes call async code viral code. And like,
Michael Kennedy: let's just like talk through the differences here. Yeah. So, okay. Yes. Tonyo has two
Giovanni Barallari: supports two different syntax modes.
Giovanni Barallari: And that's because, again, when I designed this,
Giovanni Barallari: given that I just throw everything away
Giovanni Barallari: and started from scratch,
Giovanni Barallari: I ended up having a system
Giovanni Barallari: which didn't really require async await syntax
Giovanni Barallari: or a notation because at the end of the day,
Giovanni Barallari: behind async await notation,
Giovanni Barallari: those are generated, right?
Giovanni Barallari: And so given the effort to support like two different syntax was like minimal, writing everything from scratch, I ended up like leaving up to the final user to decide, hey, you dislike async await temptation?
Giovanni Barallari: There's still plenty of people that like, I don't know why, but they argue like all the time about, oh, you know, like I have to put async everywhere and a wait everywhere, whatever.
Giovanni Barallari: OK, you don't like that.
Giovanni Barallari: Guess what?
Giovanni Barallari: Tonya also have just a yield syntax.
Giovanni Barallari: So instead of await, you just yield from the next coroutine you want to suspend for or wait for.
Giovanni Barallari: And that's it.
Giovanni Barallari: You don't need to write async def everywhere.
Giovanni Barallari: To be here is still colored, right?
Giovanni Barallari: Because the moment you have a generator function, then whatever it calls it before has to be a generator.
Giovanni Barallari: as well. But I guess my point was mainly like, okay, to support the syntax doesn't really take
Giovanni Barallari: that much of a work. And once it was settled in, I mean, it's there and people can decide by,
Giovanni Barallari: hey, you dislike one notation? Sure, just use the other one. But yes, let's say for people
Giovanni Barallari: familiar with AsyncIO, the syntax, like the AsyncAwait syntax is very similar to AsyncIO.
Giovanni Barallari: So you basically have your coroutine, so your sync dev, whatever you want, and you await primitives or stuff.
Giovanni Barallari: So the main difference is that instead of importing stuff from a sync.io, so like, I don't know, sleep or timer or whatever, you import similar primitives from Tonio.
Giovanni Barallari: We, of course, have way less primitives because, again, like, as I said before, AsyncIO has too many primitives.
Giovanni Barallari: And the only big difference from AsyncIO, let's say, native people is that you have, like, spawn methods.
Giovanni Barallari: So instead of saying...
Giovanni Barallari: So in AsyncIO, when you want to make things,
Giovanni Barallari: like spawn several tasks
Giovanni Barallari: and then wait for all of them to complete,
Giovanni Barallari: you usually do...
Giovanni Barallari: You have different ways of doing this, right?
Giovanni Barallari: You can have a task set.
Giovanni Barallari: You can have scopes from Trio.
Giovanni Barallari: But I mean, you can use gather
Giovanni Barallari: so you can create tasks and then gather.
Giovanni Barallari: with SyncIO.
Giovanni Barallari: So Tonio is like,
Giovanni Barallari: to do this is,
Giovanni Barallari: you just have like two methods.
Giovanni Barallari: You either spawn
Giovanni Barallari: asynchronous stuff
Giovanni Barallari: or you spawn something
Giovanni Barallari: that is blocking
Giovanni Barallari: and then the primitive
Giovanni Barallari: is spawn blocking.
Giovanni Barallari: The other major difference
Giovanni Barallari: from a SyncIO
Giovanni Barallari: is that when you spawn something
Giovanni Barallari: that gets run immediately.
Giovanni Barallari: Whereas like in a SyncIO
Giovanni Barallari: this is true only
Giovanni Barallari: if you create a task.
Giovanni Barallari: Otherwise, everything else is eager.
Giovanni Barallari: So in order to run whatever you want to wait,
Giovanni Barallari: you need to await.
Giovanni Barallari: So in AsyncIO, the vast majority of operations
Giovanni Barallari: bound together the launching the operation
Giovanni Barallari: and waiting for the result.
Giovanni Barallari: Unless you create a task that starts immediately
Giovanni Barallari: and then you await later, right?
Giovanni Barallari: In Tonya, everything is wrapped around the spawn
Giovanni Barallari: because you can call spawn and forget about it
Giovanni Barallari: or you can await Tonya spawn to wait for the results, right?
Giovanni Barallari: Or you can park the result of the spawn, the join, and join later.
Giovanni Barallari: So that's, I don't know if, like, maybe it's more confusing than,
Giovanni Barallari: it's hard to explain it simply.
Michael Kennedy: Maybe, but one of the challenges I've seen with standard asyncIO
Michael Kennedy: is you want to create a bunch of work and let it run,
Michael Kennedy: and then you want to get the answers back.
Michael Kennedy: So a naive way would be, like, call a bunch of stuff,
Michael Kennedy: and then when you call await,
Michael Kennedy: It's like you've got to create them not started
Michael Kennedy: and then start all of them
Michael Kennedy: and then go through each one and await them.
Michael Kennedy: Whereas this way, you get a list back
Michael Kennedy: and you just await them in order
Michael Kennedy: or await one after another somehow.
Michael Kennedy: They're already started, right?
Michael Kennedy: And so there's like the skip of this like,
Michael Kennedy: okay, I've got all the things
Michael Kennedy: that are going to become tasks,
Michael Kennedy: but I got to turn them into tasks
Michael Kennedy: so then I can await them
Michael Kennedy: because if I regularly await them,
Michael Kennedy: it'll still fall back to serial
Michael Kennedy: just running on the event loop, you know?
Giovanni Barallari: Yeah.
Giovanni Barallari: And I mean, like in Tanya is the same.
Giovanni Barallari: Like if you await a coroutine,
Giovanni Barallari: it means like I want to wait
Giovanni Barallari: that to happen, right? If you don't want to
Giovanni Barallari: just spawn, park
Giovanni Barallari: the result of spawn into a
Giovanni Barallari: variable, await later. I think
Giovanni Barallari: there's an example
Giovanni Barallari: down below in the page
Giovanni Barallari: about
Giovanni Barallari: spawning something and awaiting later.
Giovanni Barallari: Somewhere.
Giovanni Barallari: There's a bunch of documentation.
Giovanni Barallari: Spawning there, yeah.
Giovanni Barallari: But yeah, the idea
Giovanni Barallari: is, and again, I didn't invent
Giovanni Barallari: anything because
Giovanni Barallari: the syntax. Yes, this is the example. So in this example, we compute like numbers,
Giovanni Barallari: like stupid example, but it is to give the point. So we start like two functions,
Giovanni Barallari: which computes numbers. Then we await for third function. So we immediately wait for the third
Giovanni Barallari: result. And then we wait for the first two results. So in the meantime, so when you do the first poem,
Giovanni Barallari: those two functions start already, like immediately at that point in your code,
Giovanni Barallari: which kind of makes sense if you think about it,
Giovanni Barallari: because it's like syntax-based, like you're invoking those coroutines, right?
Giovanni Barallari: In that moment, you just don't await for them.
Giovanni Barallari: And so at the end, like you just await for the parallel, actual parallel result.
Giovanni Barallari: Like everything here is concurrent, but the only point in which you have parallel code,
Giovanni Barallari: the actual parallel code is when you await for parallel, right?
Giovanni Barallari: So that's the major difference from a Synco and Tonio.
Giovanni Barallari: When you spawn stuff, that thing happened in parallel.
Giovanni Barallari: So by default, Tonio starts with the number of threads
Giovanni Barallari: equal to the number of your CPUs.
Giovanni Barallari: The blocking, Tonio also has a blocking pool for blocking stuff.
Giovanni Barallari: But that's separate.
Giovanni Barallari: Let's say the main work loop that runs your code,
Giovanni Barallari: by default, you have X threads per CPU cores.
Giovanni Barallari: So if you run this on your M3 Max, M3 Studio Max,
Giovanni Barallari: what was it?
Giovanni Barallari: You will end up having 18 threads running stuff.
Giovanni Barallari: Yeah.
Giovanni Barallari: Which is kind of what we want in general, right?
Giovanni Barallari: Like if I write a program-
Michael Kennedy: I'm sure you can configure it, right?
Michael Kennedy: You could configure the thread pool to say,
Michael Kennedy: like, look, this thing has to be a good citizen.
Michael Kennedy: Let's just take the number of CPUs,
Michael Kennedy: divide by two or something like that
Michael Kennedy: so I can still do other work.
Giovanni Barallari: Yeah, you can like, again,
Giovanni Barallari: that Tonyo main decorator
Giovanni Barallari: or the Tonyo run method
Giovanni Barallari: accepts some parameters
Giovanni Barallari: so you can configure like the size
Giovanni Barallari: of the standard thread pool,
Giovanni Barallari: the maximum amount of blocking threads
Giovanni Barallari: you want to spawn
Giovanni Barallari: because that does get spawned on demand.
Giovanni Barallari: you can configure if you want to have support for context bars because it's not that's another thing
Giovanni Barallari: about python right like we kind of went from thread locals to context bars uh but in thonio
Giovanni Barallari: that's a bit more complicated right because you have async code in multiple threads yeah because
Giovanni Barallari: they used to leverage the thread right yeah so if you want to actually use context bars
Giovanni Barallari: you have to tell to the runtime, right?
Giovanni Barallari: Because otherwise, like, some side effects might be weird
Giovanni Barallari: in that condition.
Michael Kennedy: Hold on.
Michael Kennedy: Nomenclature definition, please, here.
Michael Kennedy: What are context vars for people who don't know?
Michael Kennedy: Give us examples.
Michael Kennedy: Oh, yeah.
Giovanni Barallari: So context vars, so the interpreter has these,
Giovanni Barallari: every thread into the Python interpreter
Giovanni Barallari: has what it's called a context.
Giovanni Barallari: And so with a sync.io, so what was the problem?
Giovanni Barallari: So we used to have thread locals, which meant like if I have two threads and I have, for example, a request,
Giovanni Barallari: and I have to keep the request state global, like global between quotes in my code,
Giovanni Barallari: but I want to use the correct request in the code
Giovanni Barallari: and don't make them mix in the two different threads, states,
Giovanni Barallari: we use thread vocals because that's basically like a dictionary,
Giovanni Barallari: more or less, where you can store that data.
Giovanni Barallari: And that snapshot of data is for a single thread.
Giovanni Barallari: Context var are a similar concept, but for a same code,
Giovanni Barallari: which means you can store global,
Giovanni Barallari: again, between quotes,
Giovanni Barallari: global state from an asynchronous code,
Giovanni Barallari: suspend, and when you get back,
Giovanni Barallari: you have the correct object back
Giovanni Barallari: instead of mixing global state
Giovanni Barallari: between different coroutines.
Giovanni Barallari: Was my explanation good?
Michael Kennedy: Yeah, that's good.
Michael Kennedy: People are probably pretty common
Michael Kennedy: with flask.request.
Michael Kennedy: Yeah.
Michael Kennedy: Because you've got a view method
Michael Kennedy: or maybe deep down inside some lower part of your program,
Michael Kennedy: you're like, well, I need to know what the URL was.
Michael Kennedy: You just say Flask.request, you don't pass it around.
Michael Kennedy: Like very handy, probably architecturally a bad choice.
Michael Kennedy: You know, it's hard to like test it out, right?
Michael Kennedy: And you mock it.
Michael Kennedy: I don't know.
Giovanni Barallari: Emmet does the same.
Giovanni Barallari: It's the one thing I copied from Flask
Giovanni Barallari: because I really like it.
Giovanni Barallari: But I think we can do the same argument about database, right?
Giovanni Barallari: Like with a synchronous database,
Giovanni Barallari: like you have to start a context,
Giovanni Barallari: Like, async with database, whatever, and then you need to pass that, like, all through.
Giovanni Barallari: Like, a context bar is more handy.
Giovanni Barallari: I don't know.
Michael Kennedy: Yeah, yeah.
Michael Kennedy: It certainly unlocks some really interesting things.
Michael Kennedy: Some extensions do cool things with it.
Michael Kennedy: So that's what you're talking about.
Michael Kennedy: But because it's not all just tied to the thread and using asyncio context variables,
Michael Kennedy: now it's kind of shared in potential ways.
Michael Kennedy: It's a little bit, you got to opt into it.
Michael Kennedy: That's right?
Giovanni Barallari: Yeah, CSR.
Giovanni Barallari: Again, like, it's a Boolean when you want to start the runtime.
Giovanni Barallari: And I mean, it's an implementation detail.
Giovanni Barallari: So it is just to be like,
Giovanni Barallari: I think the big warning at the beginning
Giovanni Barallari: should have been like,
Giovanni Barallari: Tonyo is very alpha right now.
Giovanni Barallari: So maybe that decision will change in the future
Giovanni Barallari: because I think right now the default is false.
Giovanni Barallari: That might become true
Giovanni Barallari: as soon as I stabilize the API.
Giovanni Barallari: But yeah, the idea was
Giovanni Barallari: if you're testing Tonyo right now,
Giovanni Barallari: if you're using Tonyo to do some tests right now,
Giovanni Barallari: I want the developer to explicitly state, okay, I'm going to use context bars.
Giovanni Barallari: Because again, the fact you have multiple threads and stuff happening in parallel,
Giovanni Barallari: I just want for the developer to be sure if it's thinking model is correct
Giovanni Barallari: before trying to do some stuff.
Giovanni Barallari: Because again, Tony is multi-threaded.
Giovanni Barallari: multi-threaders is usually like not it's it's i don't know i think for humans multi-threading is
Giovanni Barallari: hard to get sometimes um so that's the trade-off right like uh yes we now have all of these
Giovanni Barallari: capabilities on the other end we need to think about the fact that the sync io always had this
Giovanni Barallari: uh hidden uh let's say a feature which is hey there's only one coroutine running at the time
Giovanni Barallari: Whereas Antonio can have like whatever number.
Michael Kennedy: Yep.
Michael Kennedy: Now you still had to manage stuff across await calls.
Michael Kennedy: So that was, I feel like people felt like the GIL saved them from all thread considerations,
Michael Kennedy: like locks and semaphores and so on.
Michael Kennedy: And I don't think it did.
Michael Kennedy: There's not a guarantee that like a thread couldn't interrupt you.
Michael Kennedy: It's just less likely to interrupt you, right?
Giovanni Barallari: So like the simple thing is that it did around other primitives.
Giovanni Barallari: So for example, in a SyncIO, it's really hard to deadlock yourself because you're using like a threading lock.
Giovanni Barallari: Because again, like the hidden feature of a SyncIO is you have only one thread working on that shit, right?
Michael Kennedy: Yeah, exactly.
Michael Kennedy: Like you can do all the locks you want.
Michael Kennedy: It's the same thread in the re-entrance.
Michael Kennedy: Exactly.
Michael Kennedy: It's effectively a no-op other than it costs CPU.
Giovanni Barallari: Yes, exactly.
Giovanni Barallari: Whereas in Tonio, like that's exactly where people usually make mistakes because now you have the Tonio locking because you have the asynchronous locks, but you also have thread locks, which are two different things.
Giovanni Barallari: And if you, and so like you can deadlock Tonio.
Giovanni Barallari: How?
Giovanni Barallari: Yeah.
Michael Kennedy: Welcome to multi-threading.
Giovanni Barallari: Yes.
Giovanni Barallari: Like you, you, you, you create, like you enter a threading lock and then you await a coroutine inside the threading lock.
Giovanni Barallari: Now you're deadlocked.
Giovanni Barallari: Yeah.
Giovanni Barallari: Because the two things doesn't speak each other.
Giovanni Barallari: But I guess my advice,
Giovanni Barallari: if people want to start working in multi-threaded Python,
Giovanni Barallari: my advice is just think about those two rules
Giovanni Barallari: and then multi-threading is not that hard.
Giovanni Barallari: Again, rule number one,
Giovanni Barallari: never await inside a threading lock.
Giovanni Barallari: That's a simple rule.
Giovanni Barallari: Also because in Python, you use width lock.
Giovanni Barallari: So that's super easy even to identify, right?
Giovanni Barallari: That's rule number one.
Giovanni Barallari: Rule number two, you have multiple threads.
Giovanni Barallari: So if you want to write into anything,
Giovanni Barallari: I mean, all the objects are thread safe in free thread of Python
Giovanni Barallari: because a dictionary is thread safe, a list is thread safe, whatever.
Giovanni Barallari: But that doesn't mean like you can screw up in using those.
Giovanni Barallari: Because if you write state anywhere,
Giovanni Barallari: You might have like race conditions and side effects because you expect to write something and then expect to read that value.
Giovanni Barallari: But in the meantime, you have another thread right into the same location.
Giovanni Barallari: So again, like my advice is rule number one, never use locks, threading locks, and then await.
Giovanni Barallari: If you want to have an async lock, then use an async lock.
Giovanni Barallari: So a Tonio lock for that.
Giovanni Barallari: Rule number two, watch out.
Giovanni Barallari: So you probably need locks when you want to be sure that, like, when you have a sequence of operation, right, on shared memory.
Giovanni Barallari: Those are the two rules.
Michael Kennedy: I think with those two rules, multithreading is not that hard.
Michael Kennedy: Yeah, agreed.
Michael Kennedy: So does Tonio come with its own dedicated lock and synchronization primitives?
Giovanni Barallari: Yes, there's an entire sync module.
Giovanni Barallari: So Tonio has different modules.
Giovanni Barallari: Tonya time, which contains time primitives, like timeouts, timers, etc.
Giovanni Barallari: It has async module, which contains all the synchronization primitives,
Giovanni Barallari: so logs, semaphore, barriers, etc.
Giovanni Barallari: It has the network module, which is one providing like sockets.
Giovanni Barallari: So that's quite a big difference from a sync.io.
Giovanni Barallari: So in a sync.io, we don't have like an async socket library.
Giovanni Barallari: So if you think about the standard lib socket module,
Giovanni Barallari: Tonio, AsyncIO needs you to use that
Giovanni Barallari: and then pass the sockets to the event loop
Giovanni Barallari: and then handle the socket through the event.
Giovanni Barallari: Whereas in Tonio, there's a network module
Giovanni Barallari: and inside that module, there's a socket module,
Giovanni Barallari: which has the same exact interface of the standard lib plus socket.
Giovanni Barallari: The only difference is, of course,
Giovanni Barallari: every async method is async in Tonio.
Giovanni Barallari: there's the
Giovanni Barallari: streams module
Giovanni Barallari: inside the network module which is the high level
Giovanni Barallari: trio like
Giovanni Barallari: interface to
Giovanni Barallari: make it easy to manage
Giovanni Barallari: network. It has a file
Giovanni Barallari: system module which
Giovanni Barallari: contains
Giovanni Barallari: all the standard
Giovanni Barallari: open kind of
Michael Kennedy: methods that they
Michael Kennedy: async with open
Michael Kennedy: tonio.files.open something like that
Giovanni Barallari: yeah.fs yes
Giovanni Barallari: and it also contains like
Giovanni Barallari: mirror of the
Giovanni Barallari: pathlib, standard lib
Giovanni Barallari: pathlib, so you can use like
Giovanni Barallari: frontoniofs import path and that path
Giovanni Barallari: has all the methods
Giovanni Barallari: that are required to be asynchronous
Giovanni Barallari: so that's
Giovanni Barallari: more or less like the
Giovanni Barallari: design
Giovanni Barallari: I don't think like
Giovanni Barallari: so right now I'm at
Giovanni Barallari: tonio 0.9.14
Giovanni Barallari: I guess
Giovanni Barallari: and I don't think
Giovanni Barallari: There's much left in terms of modules and primitives and features.
Giovanni Barallari: The big feature missing is Windows support.
Giovanni Barallari: More on that later.
Giovanni Barallari: But yeah, I'd say I'm close to stabilize the API.
Giovanni Barallari: So right now, again, this is all alpha.
Giovanni Barallari: That's mostly because there's only me working on this.
Giovanni Barallari: And I have Fable working on a bunch of other things,
Giovanni Barallari: which I guess like if I can digress for a second,
Giovanni Barallari: I think like I have a very peculiar and unique way of using AI
Giovanni Barallari: because right now I'm like,
Giovanni Barallari: and I guess like it's a good use case to advertise.
Giovanni Barallari: So the entirety of Tonio,
Giovanni Barallari: so Tonio has maybe 1% AI written code.
Giovanni Barallari: The only code that was written by Claude
Giovanni Barallari: was the pytest plugin.
Giovanni Barallari: Oh, by the way, we also have a pytest plugin.
Giovanni Barallari: so you can hide the smart tone.
Giovanni Barallari: But that's the only part that I let AI touch.
Giovanni Barallari: Everything else, like it's old school.
Giovanni Barallari: I written all of it like the old way, text editor,
Giovanni Barallari: not even any suggestion and everything.
Giovanni Barallari: What I used AI for, and it helped me a lot
Giovanni Barallari: into reaching a state in which I think Tonio is really stable now
Giovanni Barallari: was to use AI to build projects that were using Tonio
Giovanni Barallari: and stress test everything about Tonio.
Giovanni Barallari: So for example, I made a port of Pi,
Giovanni Barallari: the harness from Maria Zeckner.
Giovanni Barallari: So I made Claude rewrite the whole thing in Python
Giovanni Barallari: because Pi is written in TypeScript, regardless of the name.
Giovanni Barallari: So I made that entire harness with Claude saying,
Giovanni Barallari: okay, take five,
Giovanni Barallari: meter every behavior and just use Tonio to do everything.
Giovanni Barallari: And that like helped me like catch
Giovanni Barallari: like probably 95% of the bugs in Tonio.
Giovanni Barallari: And I kind of started doing the same for the ecosystem.
Giovanni Barallari: Maybe we can talk about it a bit later,
Giovanni Barallari: but yeah, that's also like a super,
Giovanni Barallari: it's super useful for me, right?
Giovanni Barallari: Like as a solo open source developer,
Giovanni Barallari: which, yeah, I want to focus on Tonio.
Giovanni Barallari: I don't have time to do all the other packages.
Giovanni Barallari: And so, yeah, that was nice.
Michael Kennedy: That's a very interesting way.
Michael Kennedy: I hadn't really considered that.
Michael Kennedy: It's just like, I need users before I have users.
Michael Kennedy: I need these three use cases covered.
Michael Kennedy: So give me a web app that uses an async database.
Michael Kennedy: Give me this terminal app and so on.
Michael Kennedy: And that's, yeah, that's really cool.
Michael Kennedy: Yeah.
Michael Kennedy: Okay.
Michael Kennedy: I agree.
Michael Kennedy: Ecosystem is interesting.
Michael Kennedy: I want to talk about it.
Michael Kennedy: But before that, I want to come back to blocking threads.
Michael Kennedy: Yes.
Michael Kennedy: So blogging threads are CPU bound generally type of things.
Michael Kennedy: Is that right?
Michael Kennedy: So I think Tonio is a bit peculiar in this regard
Giovanni Barallari: because it really depends what your program does.
Giovanni Barallari: Because if your program, whatever that is, has mixed load,
Giovanni Barallari: which means like you have both IO bound stuff,
Giovanni Barallari: like network, disk, terminal, whatever, and CPU bound stuff,
Giovanni Barallari: then the only way to be sure that everything keeps running smoothly,
Giovanni Barallari: like on the network part, the IO part,
Giovanni Barallari: is to spawn the CPU bound stuff on the blocking thread pool.
Giovanni Barallari: But if your program is just CPU bound, then who cares?
Giovanni Barallari: Just use the normal thread pool
Giovanni Barallari: because then you don't have anything to block.
Giovanni Barallari: like your CPU bound, your CPU limited.
Giovanni Barallari: So the standard configuration of Tonio
Giovanni Barallari: gives you exactly the perfect number of CPU cores to use.
Giovanni Barallari: On the other hand, if you just have like IO bound.
Giovanni Barallari: So again, like if you have just CPU bound work
Giovanni Barallari: or just IO bound work,
Giovanni Barallari: you can use like the standard pool,
Giovanni Barallari: nothing particular like this.
Giovanni Barallari: The blocking thread pool is useful
Giovanni Barallari: only when you have mixed workloads
Giovanni Barallari: and you need to balance them, right?
Michael Kennedy: Okay, how do I create such a thing?
Michael Kennedy: How do I start a task in one or the other?
Giovanni Barallari: So every await or yell destruction
Giovanni Barallari: or a tonio spawn destruction
Giovanni Barallari: runs on the standard thread pool.
Giovanni Barallari: To spawn something on the blocking thread pool
Giovanni Barallari: is just tonio spawn blocking.
Giovanni Barallari: Done.
Giovanni Barallari: You don't need to manage the size of the pool.
Giovanni Barallari: You don't need to create the pool.
Giovanni Barallari: If you want to control concurrency in the blocking threat pool,
Giovanni Barallari: you either use, like, barriers when you spawn stuff
Giovanni Barallari: or semaphores when you spawn stuff.
Giovanni Barallari: But, yeah, like, in general,
Giovanni Barallari: it's not different from spawning anything else.
Giovanni Barallari: Sure.
Michael Kennedy: So you can spawn blocking.
Michael Kennedy: Here's what I was thinking.
Michael Kennedy: Here's what I was getting at.
Michael Kennedy: That I think would be a sweet feature.
Michael Kennedy: You've got at tonio.main for the entry point, right?
Michael Kennedy: Yes.
Michael Kennedy: So that runs on tonio.run instead of just Python run or whatever.
Michael Kennedy: For functions that you know are computational,
Michael Kennedy: you would like to ensure that they run on a blocking thread
Michael Kennedy: or along those lines.
Michael Kennedy: You could put a decorator that just says tonio.cpu or whatever.
Michael Kennedy: I don't know.
Michael Kennedy: You come up with a name, but that way I don't even have to think.
Michael Kennedy: If I import another library also built on tonio,
Michael Kennedy: I don't know, oh, that function wants me to run it this way.
Michael Kennedy: No, I just call it.
Michael Kennedy: Antonio goes, ah, this is an async CPU one.
Michael Kennedy: So we'll scale it up, scaffold it up on that, basically.
Giovanni Barallari: That's a nice suggestion, okay?
Giovanni Barallari: All right.
Giovanni Barallari: I think it will land in Antonio 0.10, yes.
Giovanni Barallari: Awesome, okay, cool.
Michael Kennedy: I like that.
Michael Kennedy: When you're in the function, the locality of the information
Michael Kennedy: that, oh, this is computational and so on is right there.
Michael Kennedy: But when you're calling, and especially in a big app,
Michael Kennedy: you don't know, right?
Michael Kennedy: So I think that would be really cool.
Michael Kennedy: So I'm glad you like it.
Michael Kennedy: No, we'll work on that.
Michael Kennedy: Awesome.
Michael Kennedy: All right, we got time for two really quick things.
Michael Kennedy: So one thing that is nice about standard asyncio
Michael Kennedy: is everyone uses asyncio
Michael Kennedy: if they're writing async code at the moment,
Michael Kennedy: unless they do something like Trio
Michael Kennedy: or one of these other things.
Michael Kennedy: So for example, if I use HTTPX2 or HTTPX
Michael Kennedy: and I, with async, you know,
Michael Kennedy: async with create a client of it
Michael Kennedy: and I await its get,
Michael Kennedy: that runs on the same sort of deal.
Michael Kennedy: but it's probably not compatible with Tonio, is it?
Michael Kennedy: And if it's not, what do I do?
Giovanni Barallari: Yeah, it's not.
Giovanni Barallari: So I have one thing that is the current state,
Giovanni Barallari: and I also have the idea for the future.
Giovanni Barallari: So right now we have a package which is called TonioMonkey,
Giovanni Barallari: and you probably can guess what it means, what it does.
Giovanni Barallari: It basically like monkey patches popular,
Giovanni Barallari: Or I would either say, like, asyncio native libraries I thought about in the last few months.
Giovanni Barallari: That might be useful.
Giovanni Barallari: And so I guess today we have, like, TonyaMonkey can monkey patch async.
Giovanni Barallari: No, sorry.
Giovanni Barallari: PsychoPG.
Giovanni Barallari: It can patch HTTPX and HTTPX2.
Giovanni Barallari: It can patch Redis.
Giovanni Barallari: And I think that's most of it for the moment.
Giovanni Barallari: But I'm open for issues.
Giovanni Barallari: If anyone from the listeners want to try Tonio to an existing code base
Giovanni Barallari: and you have a package you would like to see monkey patched,
Giovanni Barallari: just open an issue in the TonioMonkey repo
Giovanni Barallari: or even in Tonio discussions, and I will look at it.
Giovanni Barallari: Because again, right now I need the vast majority of possible use cases
Giovanni Barallari: to see that I covered everything.
Giovanni Barallari: Ideally, as soon as I stabilize the API
Giovanni Barallari: and I say, okay, this is the thing,
Giovanni Barallari: my idea was to try to contact the NEIO maintainers
Giovanni Barallari: to see if we can have NEIO backend in NEIO,
Giovanni Barallari: which should be like a way easier way to deal with this.
Giovanni Barallari: I'm not sure how much it's feasible because again,
Giovanni Barallari: like the main problem for Tonio right now is that it doesn't support any of the
Giovanni Barallari: synchio primitives.
Giovanni Barallari: So if any code base like relies a ton on task or futures or whatever,
Giovanni Barallari: that's not in the runtime.
Giovanni Barallari: Yeah.
Michael Kennedy: Yeah.
Michael Kennedy: Okay.
Michael Kennedy: Interesting.
Michael Kennedy: But there are some choices.
Michael Kennedy: And are you also creating your own?
Michael Kennedy: I saw some custom HTTP or some other library or two.
Giovanni Barallari: I'm also trying to be a very contained ecosystem of libraries,
Giovanni Barallari: mainly on the web part.
Giovanni Barallari: So right now, I published a low-level HTTP library for Python
Giovanni Barallari: that is compatible both with Asyncio and Tonio.
Giovanni Barallari: It's called HTTPunk.
Giovanni Barallari: I published an eye-level client, HTTP client, on top of that, which is called Punk Rec.
Giovanni Barallari: So again, you can use that regardless of Tonio Asincaio, because the adaptation layer is inside the package.
Giovanni Barallari: I kind of published a very beta experiment of a Uvicorn port to work in Tonio,
Giovanni Barallari: Which I guess brings up a question like, hey, when will Granian support this?
Giovanni Barallari: Am I right?
Giovanni Barallari: Yeah, right.
Giovanni Barallari: So I have plans.
Giovanni Barallari: It's actually way bigger plans for Granian.
Giovanni Barallari: So as I said before, 2026 was a bit boring in Granian.
Giovanni Barallari: Like, no, a bunch of new features, not a bunch of that stuff.
Giovanni Barallari: But that's just because several months ago, I started designing two things for Granian.
Giovanni Barallari: So the first is this revision two of the ArchGee protocol,
Giovanni Barallari: which will be async independent.
Giovanni Barallari: So it will become like a callback protocol
Giovanni Barallari: because the other big feature I want to add in Granian
Giovanni Barallari: is to support a bunch of runtimes.
Giovanni Barallari: So my idea is not the Granian tree,
Giovanni Barallari: when it will land, no promises on the time here,
Giovanni Barallari: but like when it will land,
Giovanni Barallari: Ideally, it will support Asyncio, Trio, Tonio, gEvent, eventlet, and a bunch of stuff.
Giovanni Barallari: So that's the idea, is to isolate, let's say, the protocol implementation and the Python runtime implementation.
Giovanni Barallari: So it will happen one day.
Giovanni Barallari: In the meantime, I wanted to have a test server to use with Tonio and see what happens.
Giovanni Barallari: So that's why.
Michael Kennedy: Yeah, using something like
Michael Kennedy: Cord or FastAPI or something like that.
Michael Kennedy: If you were able to run it in Granian
Michael Kennedy: with the Tonio, Tonio
Michael Kennedy: backend, the async
Michael Kennedy: endpoints you write would be
Michael Kennedy: running on Tonio, yeah?
Michael Kennedy: Yeah, that's the plan.
Giovanni Barallari: In TonioMonkey, there are also patches for FastAPI,
Giovanni Barallari: by the way. And I'm working
Giovanni Barallari: on a one on Django.
Giovanni Barallari: I need to ping
Giovanni Barallari: Carleton on that
Giovanni Barallari: because we met this year
Giovanni Barallari: at this year, PyCon Italy,
Giovanni Barallari: and we talk about it.
Giovanni Barallari: So maybe in a month or so,
Michael Kennedy: we will also have like a patch for Django.
Michael Kennedy: Sweet.
Michael Kennedy: Yeah, I just had Carlton on to talk about
Michael Kennedy: basically all the async work in Django 6 and 6.0 and so on.
Giovanni Barallari: So that was fun.
Giovanni Barallari: I watched the episode and I was like,
Giovanni Barallari: huh, sounds familiar, huh, huh.
Michael Kennedy: Yeah, we've talked about that.
Michael Kennedy: I see.
Michael Kennedy: Interesting.
Michael Kennedy: All right.
Michael Kennedy: Well, I got one final main topic for us.
Michael Kennedy: Yep.
Michael Kennedy: Oh, yeah.
Michael Kennedy: What about windows?
Michael Kennedy: So.
Michael Kennedy: And I'm not putting pressure on you to do it.
Michael Kennedy: No, no, no.
Michael Kennedy: I'm just rounding out the conversation.
Michael Kennedy: Okay.
Giovanni Barallari: So if you ask me like a few months ago, my answer would probably be like that short video
Giovanni Barallari: extract from a series like where you had the actor.
Giovanni Barallari: Whatever.
Giovanni Barallari: um you know i'm gonna not gonna not gonna swear on the podcast but uh uh you get what i mean
Giovanni Barallari: uh so i i'm not so first of all like the usual problem so supporting windows in granian
Giovanni Barallari: it's a pain man like a real pain like i'm not joking right because it has like all these
Giovanni Barallari: quirk behaviors not just in python not just in terms of threads like do you know that win that
Giovanni Barallari: that windows have as like a bug from i think it was like nt4 uh that like if you if you share a
Giovanni Barallari: socket it becomes blocking and so you cannot use it like anywhere um so windows for start like
Giovanni Barallari: windows is a pain and is a very weird operating system second i don't have like a windows environment
Giovanni Barallari: because finally in 2026,
Giovanni Barallari: I was able to finally have just macOS and Linux
Giovanni Barallari: on all my machines, also for gaming.
Giovanni Barallari: So I'm so happy.
Giovanni Barallari: So those are, like I say,
Giovanni Barallari: the two main preambles on Windows support.
Giovanni Barallari: But also because implementing the library
Giovanni Barallari: I use Antonio to manage the Polar,
Giovanni Barallari: the actual event loop,
Giovanni Barallari: It supports Windows, but you know, weird way.
Giovanni Barallari: So, months ago I was like almost a hundred percent convinced now,
Giovanni Barallari: never windows, never now, thanks to fable by chatting with fable.
Giovanni Barallari: I think we found a way to hack into, into meal, this library to, to fake
Giovanni Barallari: some stuff about windows.
Giovanni Barallari: So it will interpret some stuff as TCP sockets.
Giovanni Barallari: even if they are like file descriptors or anything.
Giovanni Barallari: So I won't make a promise here
Giovanni Barallari: because then I have to do it.
Giovanni Barallari: But ideally, end of the year,
Giovanni Barallari: we might see partial Windows support in Tom.
Giovanni Barallari: Sweet.
Giovanni Barallari: So that's the idea right now.
Giovanni Barallari: I still hate Microsoft, to be clear here.
Giovanni Barallari: Like, man, I just like Windows.
Giovanni Barallari: So if any of the listeners,
Giovanni Barallari: like if you're programming in Windows
Giovanni Barallari: and not using Weasel,
Giovanni Barallari: please put down in the comments why.
Giovanni Barallari: Like, why are you self-inflicting this to you?
Giovanni Barallari: Like, explain me the rationale
Giovanni Barallari: into dealing with all the BS
Giovanni Barallari: that Windows 11 is nowadays.
Giovanni Barallari: So yeah, but anyways,
Giovanni Barallari: I will try end of the year
Giovanni Barallari: to have some form of Windows support in time.
Michael Kennedy: I can tell, I can sense your excitement.
Michael Kennedy: My Windows computer over there is Windows 10, by the way.
Michael Kennedy: But I do think for people listening,
Michael Kennedy: Windows Subsystem for Linux is an escape hatch
Michael Kennedy: that you can do, right?
Michael Kennedy: If you had a project, you really want to use this here,
Michael Kennedy: like set up Windows Subsystem for Linux
Michael Kennedy: and run it there, right?
Giovanni Barallari: To be here, like the only reason I want to,
Giovanni Barallari: like I want to try to add Windows support in Tonio
Giovanni Barallari: is not for developers,
Giovanni Barallari: is actually to provide developers a way to say,
Giovanni Barallari: okay, I want to build a program in Python
Giovanni Barallari: with Tonio that has to work like everywhere.
Giovanni Barallari: Because right now, again,
Giovanni Barallari: like if you code anything in Tonio,
Giovanni Barallari: it works only on POSIX systems,
Giovanni Barallari: so only Linux and macOS.
Giovanni Barallari: So that's the reason why I want to have
Giovanni Barallari: at least some form of Windows support
Giovanni Barallari: because, I mean, it's not about developers.
Giovanni Barallari: It's about like where the software runs
Giovanni Barallari: at the end of the day.
Giovanni Barallari: Right, right.
Michael Kennedy: It's the deployment targets, yeah.
Giovanni Barallari: Yeah.
Michael Kennedy: All right, Joe, final call to action.
Michael Kennedy: People have been listening
Michael Kennedy: and they're like, this sounds pretty excellent.
Michael Kennedy: I want to try it.
Michael Kennedy: What do you tell them?
Giovanni Barallari: I mean, like, again, I think we're living in the perfect moment to try stuff.
Giovanni Barallari: We've given with this big opportunity, big new opportunity of free-threaded Python.
Giovanni Barallari: We have AI agents.
Giovanni Barallari: And by the way, I was surprised, but like pointing any agent, any model,
Giovanni Barallari: frontier model to a project and say, okay, implement this in Tonio.
Giovanni Barallari: I was surprised.
Giovanni Barallari: They got all the API correctly most of the times,
Giovanni Barallari: which is amazing.
Giovanni Barallari: There's no training data about Tonio.
Giovanni Barallari: And regardless, it was able to drive through stuff.
Giovanni Barallari: So I guess it's the perfect moment to try stuff.
Giovanni Barallari: I'd say if for any reason you're not happy with Asyncio,
Giovanni Barallari: if for any reason you experience any of the pain points we talked about,
Giovanni Barallari: I think it's like the perfect moment to try new stuff.
Giovanni Barallari: And if you try Tonio and you have like a use case
Giovanni Barallari: where it's not working or the API can be improved,
Giovanni Barallari: like open an issue, open a discussion,
Giovanni Barallari: ping me, DM me on Twitter.
Giovanni Barallari: Oh, sorry, X the everything up.
Giovanni Barallari: I will call it.
Giovanni Barallari: Ping me and we'll figure out.
Giovanni Barallari: Yeah, I think that's my message.
Michael Kennedy: Yeah, awesome.
Michael Kennedy: Well, it looks like a very ambitious project
Michael Kennedy: and I think you've done a lot of interesting things.
Michael Kennedy: So thanks for coming on and sharing it.
Michael Kennedy: Tell people where they can stay in touch with you as well.
Giovanni Barallari: Yes, so my GitHub handle is G-I-0-B-A-R-O.
Michael Kennedy: You can find me with the same handle
Giovanni Barallari: Twitter. I have a blog, even if I don't write a ton, but you can find my blog at blog.baro.dev.
Giovanni Barallari: And if you want to join me and Marcelo Trilesinski, again, author of Uvicorn, Starlet, and a bunch of
Giovanni Barallari: stuff he's making with TokenMaxing, we recently started a podcast available on YouTube.
Giovanni Barallari: at the www pod.
Michael Kennedy: Nice.
Michael Kennedy: So people, check them out.
Michael Kennedy: Check out the pod.
Michael Kennedy: That sounds fun.
Michael Kennedy: I'll give it a look as well.
Michael Kennedy: Joe, thanks for coming on the show.
Michael Kennedy: Nice to catch up with you.
Michael Kennedy: Thank you for having me.
Michael Kennedy: It was super good.
Michael Kennedy: This has been another episode of Talk Python To Me.
Michael Kennedy: Thank you to our sponsors.
Michael Kennedy: Be sure to check out what they're offering.
Michael Kennedy: It really helps support the show.
Michael Kennedy: This episode is sponsored by Sentry's Seer.
Michael Kennedy: If you're tired of debugging in the dark, give Seer a try.
Michael Kennedy: There are plenty of AI tools that help you write code,
Michael Kennedy: but Sentry's seer is built to help you fix it when it breaks.
Michael Kennedy: Visit talkpython.fm/sentry and use the code talkpython26,
Michael Kennedy: all one word, no spaces, for $100 in Sentry credits.
Michael Kennedy: And it's brought to you by us.
Michael Kennedy: Talk Python and Python Bytes both now have MCP servers.
Michael Kennedy: Point your AI at 10 plus years of Python episodes,
Michael Kennedy: transcripts, and show notes free.
Michael Kennedy: Click MCP in the nav at talkpython.fm and at Python Bytes.
Michael Kennedy: If you or your team needs to learn Python,
Michael Kennedy: We have over 270 hours of beginner and advanced courses on topics ranging from complete beginners
Michael Kennedy: to async code, Flask, Django, HTMX, and even LLMs.
Michael Kennedy: Best of all, there's no subscription in sight.
Michael Kennedy: Browse the catalog at talkpython.fm.
Michael Kennedy: And if you're not already subscribed to the show on your favorite podcast player, what
Michael Kennedy: are you waiting for?
Michael Kennedy: Just search for Python in your podcast player.
Michael Kennedy: We should be right at the top.
Michael Kennedy: If you enjoy that geeky rap song, you can download the full track.
Michael Kennedy: The link is actually in your podcast blur show notes.
Michael Kennedy: This is your host, Michael Kennedy.
Michael Kennedy: Thank you so much for listening.
Michael Kennedy: I really appreciate it.
Michael Kennedy: I'll see you next time.
I'm me.
Get me ready to roll.
Upgrade the code.
No fear of getting old.
We tapped into that modern vibe
over Kenny's storm.
Продолжение следует...