- Podcasts
- Talk Python To Me
- #515: Durable Python Execution with Temporal
#515: Durable Python Execution with Temporal
Talk Python To Me
- August 11, 2025
- 1 h 11 min
- Episode 515
About this episodeSee the full show notes for this episode on the website at talkpython.fm/515
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#515: Durable Python Execution with Temporal
The Temporal server executes units of application logic called workflows in a resilient manner that automatically handles intermittent failures and retries failed operations. We have Mason Egger from Temporal on to dive into durable execution in Python. This is Talk Python To Me, episode 515, recorded June 19th, 2025. Welcome to Talk Python To Me, a weekly podcast on Python.
This is your host, Michael Kennedy. Follow me on Mastodon where I'm @mkennedy and follow the podcast using @talkpython, both accounts over at fosstodon.org and keep up with the show and listen to over nine years of episodes at talkpython.fm. If you want to be part of our live episodes, you can find the live streams over on YouTube. Subscribe to our YouTube channel over at Talk Python.fm slash YouTube and get notified about upcoming shows. This episode is sponsored by Posit Connect from the makers of Shiny. Publish, share, and deploy all of your data projects that
you're creating using Python. Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs. Posit Connect supports all of them. Try Posit Connect for free by going to talkpython.fm/posit, P-O-S-I-T. The PyBay Conference is returning to the UCSF Mission Bay Conference Center in San Francisco, California on October 18th, 2025. Get your ticket and pick up a free conference course bundle from Talk Python. Get started at talkpython.fm/PyBay.
Just Enough Python for Data Scientists. Data scientists get things done in notebooks, but production quality work needs more than ad hoc scripts. Just Enough Python for Data scientist gives you the essential Python and software engineering habits to level up your analysis without drowning in theory. In a few focused hours, you'll tighten up your core Python, write clean and reasonable functions, organize code into importable modules, track work with Git and GitHub, debug confidently, and make your results reproducible with pinned environments and
Docker. You'll also see how modern agentic AI tools can accelerate data exploration, bug detection, refactoring, and documentation. The outcome is simple. You keep your notebook speed while gaining the reliability, collaboration, and professionalism your projects deserve. Just visit talkpython.fm and click on courses in the nav bar. The link to the course is also in your podcast player show notes. And if you'd rather focus purely on building with LLMs, check out Vincent Warmerdam's LLM building blocks for Python course we just recently released as well. Now on to that interview.
Exactly. Yes. I mean, the fastest speed limit in the United States is on the highway next to my house. It's 85 miles an hour and it's on the toll road next to my house because you're right. Like if you're trying to get from Austin to San Antonio, that's, I think it's about a hundred miles down. And like, if you're going 55, you'll get there in, you know, two and a half hours, but I can make it in an hour and a half hour and 15 minutes. If you just let me fly, I had no idea that the speed limit were that high.
No one knew what was coming. We were so innocent then. Yes. We really were. So we were planning that. And then, you know, the events that we know of happened and we kept chasing it. We kept pushing it back. I think a lot of conferences at that time kept pushing back thinking, Oh, we'll be out of this in two weeks. We'll be out of this in three months.
We ended up going virtual. And then in 2021, we made the conscious decision to just not have a conference. The virtual conference for us in 2020 wasn't overly successful. And we've, at that time, we were feeling there was just a lot of virtual conference fatigue and we didn't have a really good story on how to like make it work and dedicate the time. Everybody was also struggling to handle the world at that time. So being able to put more resources into it was difficult.
And we had 76 people return. But we knew that if we didn't come back, if we let this kind of like continue on, that the likelihood of getting the community to come back, that the memory is short, that if we didn't come back, we might lose it forever. And having run this for 18 years, we were concerned about losing it at that point. I think that's totally valid. A lot of this conference attending is it's habit. You form, you've gone a bunch of times. You really enjoy it. Like, yeah, of course I'm going to go. You don't even question like, well, when is it? I'm
And then, you know, every year prior after that, we, we continue to grow. it took us three years to get back to above, what, what I would consider pre-pandemic normals. and the, the fun fact about that is, and the thing that I think that really kind of helped us out is like, we didn't really start seeing the growth back in the conference attendance until us as the foundation turned our inwards local or sorry, our vision local or our site to start focusing on the local meetups, because the local meetup scene had not returned. And that was the vast majority of
our of our of our marketing was that we would send out these emails and stuff or the local meetups would promote us. And these are huge meetups. I mean, the Python, the some of the Python meetups are some of the oldest meetups that I know of. I mean, like they started in the early, in the late aughts in the early teens. Yeah, I would say they probably were not even called meetups when they started, right? The user groups or something. They predate meetup. Yeah, meetup.com and all that. Yeah, I think the PyHouston meetup group is called,
like their tag on meetup.com is Python-14. So I'm assuming it was the 14th Python meetup when it was created in the world on meetup.com. so, and you know, large groups, but these meetups had gone dormant. So what I did as, as foundation president at that time was I was like, okay, I'm going to spend all of my effort while my organizers are helping get the conference going.
I'm going to spend all of my effort finding organizers and rebuilding these meetups in these areas. so I would connect with people that I knew in the area. I would reach out to friends. I would put out all calls and after time of rebuilding the ecosystem, then we basically everything came back to life. And that's kind of where a little, you know, the things that I have learned is that if your, if your meetup ecosystem is not healthy, then your regional Python conference ecosystem will not be healthy because it has to feed up into it. Yeah. Yeah. I think it's,
I mean, you can do all the amazing mailing lists and announcements and everything, but you're speaking to your existing people that know about you and finding new ones is really interesting and this cultivating like user groups to sort of be the foundation. It's a very interesting idea. Definitely. User groups work. I think we also started the PyTexas meetup, which was a virtual meetup that we do monthly that we allow anyone to join. And we cultivated amongst our network of friends and social media and word of mouth. And then we all know what
happened with the social media situation, which really did not help. I mean, there was a lot of just a lot of things that have happened with like the dissolution of Twitter really did not help the conference and the tech ecosystem. Basically, we've all fractured now. We're all in like six different places. Like the move to Mastodon is not complete. Bluesky had its moment, but I honestly get less engagement on Bluesky than anything else. LinkedIn has surprisingly been our most successful social media platform. It seems like a lot of people have moved there for some reason or another.
But basically, it means that you just have to reapply your marketing strategies. And the fun thing that I've had the benefit of is that as my work as a developer advocate, all the roles that I have done, they tend to sit in marketing. Developer advocacy tends to either sit in product or marketing. All the roles that I have taken sit in marketing. And I've had the benefit of like, whenever this has started going weird, I can ask all of my marketing friends, hey, what would you do in this situation? How would you approach this? So I've got to learn through
I miss Twitter. I do too. And, you know, people like post weird comments on, like reviews like oh you know they said they don't like twitter so they must be whatever like no just that used to be so active and it's not so active like put put aside everything else it used to be like you could have great conversation you still can but it's so much less than it used to it's an easy it's an easy explanation the signal to noise ratio is completely messed up now yes it used to be such a much better place because everybody was posting there and there wasn't as much noise and now the signal to noise
ratio makes it almost unintelligible to be able to find anything of any use and that's the number one problem with it. And you pay for attention and there's six other places like you said. So anyway, so I found this post from, we'll work it backwards, from Pietro. It says, people aren't talking enough about how most of OpenAI's tech stack runs on Python, which I thought was a super cool post.
It comes from the Pragmatic Engineer newsletter and it talks about how most of the product's code is written in Python, uses FastAPI, C for certain parts. And then, so all that stuff made, I'm like, yep, yep. Temporal, use for asynchronous workflows. I'm like, what is Temporal? And then I think you sent me a message and said, hey, I would love to talk to you about Temporal. And I looked at him, yeah, this is super cool. So that's how I learned about you guys, which I thought was pretty neat.
And yeah, let's talk about it. What is Temporal? Yeah. So Temporal is essentially what we call a durable execution platform. And it's durable execution is kind of a new term or a new like, like field within the zeitgeist, as you would call it. And we're kind of going with like what we're calling crash proof execution. And the way that we kind of talk about it now is like, essentially, it handles the failure state of your of your applications and ensures that your code will continue execution regardless of the failures that it encounters. So say, for example, you have
What type of error did we receive? Now, what do we do? Do we back off and retry? Do we decide that this failure is non-retriable and we just don't do it? Like the difference between we're not authenticated versus a 404, those are completely different failure handling modes. And then, So there's all of this kind of logic that you have to build in to handle failure.
So Temporal maintains the application state of your application. And so say you have like a Python application that has 10 steps in it and you get through step five and then the python application were to crash for some reason out of memory uh maybe your kubernetes pod got descheduled something like this and production happens happens all the time this is as a former sre this was this was the life that i lived for years um yeah even hey there's a security patch for the Linux server that's the yeah running this and we got to restart
Because as we, I think we kind of alluded to it, but I'll state it outright. when that when you when that application crashes, and in a typical application, you have to start back over from the beginning. And you have to replay every you basically re execute everything you did unless you were have some like advanced sort of like event sourcing style model where you are keeping track of it. Temporal does this by default. So it maintains the event history and what's called an event history of your application. And what that does is every time a basically
it will basically retry until that comes back online. Now, if we were to reboot our service, say our service was running and we rebooted the container that contained it, it would basically, if we're in a Kubernetes system, the Kubernetes scheduler would probably reschedule it onto another node within the pod.
So the service maintains the history. So what will happen is whenever that new service comes online, or whenever the new execution comes online, we've rebooted it, it got rescheduled, it comes online, it will stream the old history from the service and then reconstruct it, basically going step by step through it.
You could say in order to create a user account, I have to first have them create and enter their username and email or their email and their password. And then I'm going to send them an email and they got to take an action based on that, right? That would be pretty common, like a long running type of thing you could consider. But for some of these systems, it's like, and prove who you are and upload a document.
And I'm talking about the metaphorical price, not the dollar price. someone still has to ensure that that database stays up essentially and that your things are still getting scheduled and that the network is up and all of these. So it's super complex to do that. And you can run it. So you can run the temporal service locally. You can run the temporal workers locally. Everything you run is still local. The pricing model for temporal is just the temporal service part, which is run in temporal cloud. So there's a weird misnomer around cloud, which is
So if we use the cloud, I could like reboot my local data center machine or even my local data center. I mean, my version of the cloud, you know, wherever digital ocean or whatever. And when it comes back it'll sort of resume along like you guys will see that it's back and then yeah start running work on something like that that's what i was getting at technically yes so fun fun fun fact about it temporal the again the architecture of this is so brilliant and we could get so touched in the weeds about the temporal service does not actually know about any of the
i found right why i moved into developer education um exactly there's fewer uh midnight calls in developer education that is the primary reason why i do this now is i i like there is a point when the p when pager duty goes off like one too many times and you become a developer advocate and i'm living proof of that you just know yeah you take it off a space style you just take it out put on some uh gangster music just exactly right exactly if you don't know the reference you need to make sure you put watching office space yeah the movie right i've driven by the list i've driven by the
area where it was filmed it was filmed out here in austin where i live was it incredible yes incredible okay so why did i sort of start in that path what i want to talk about is what is so you guys have a cloud version which obviously does stuff in massive scale you talk about a fleet of these things. And by the way, at the execution level, we're probably mostly talking Go and Rust, just so people know, it's kind of like fast, fast innards. But Rakesh asks, like, it seems to be resource insensitive. Is there a lightweight option? Like what is a, what is a minimal temporal
rather than a, you know, what Uber does or what, you know, ChatGPT does? Because those things, you just can't compare them, right? It's like, you're not Microsoft, you're not Google, you're not LinkedIn, you're not Netflix. Don't try to be them most. Yeah, it depends on what you're trying to accomplish. So I mean, like, I think when it comes to so there's, there's always there's the service and then there's the worker fleet. So let's talk. I'll talk about the service first, and then we'll talk about the workers. So the service comes in a handful of different flavored
SQLite is underappreciated. People see it as like a toy thing or like I can use this while I'm developing like a sample, but then I don't really like you can put millions of records in SQLite. You can go a very long way. Speaker 1: Oh yeah. Yeah, it is. Yeah, it is an amazing tool it's one of my favorite tools um and then there so in reality what the way that the temporal service is actually built is it's actually just a single binary um but the thing is there are the temporal service is a conglomerate when i say the service i mean like all of the things together it's a conglomerate of multiple microservices that when you put them together they they connect with they interact with each other and there's like four back-end services no three services and a front-end service then there's like a web UI and that's the service but but then you also have to build in a data storage. So for when you get to that point, that's when you either need MySQL, Postgres, or Cassandra. You could probably get away with SQLite on that one, but I've never actually tried it. But we recommend MySQL, Postgres, or Cassandra. And then you can add in other things like Elastic for visibility. You can add Prometheus and Grafana for being able to see. But this is when you're starting to scale up. So if you were doing this on small, itty-bitty scale, you could probably deploy it onto, say, a DigitalOcean droplet and be fine with a single binary. We have tutorials on our learn site on exactly how to do this. And then it scales. So like there's a Docker Compose file. So like once you want to see what all these microservices are doing, like in multiple areas, like you can see how we've deployed all of them and you can play it. There's multiple different Docker Compose files to be like, oh, I want it with this database and these options. And that allows you to kind of like tune it and tweak it to your liking. And then once you get to prod scale, we have Helm charts that we support and you can deploy it directly into Kubernetes. Now, if you're self-hosting in production, Kubernetes tends to be what we see in the wild as the most popular deployment. Now, again, these are single binaries. You can deploy it however you want. So it has a, from development to prod, it has a very nice scaling story. Or the other option is just go to Temporal Cloud. The thing is Temporal Cloud has a minimum pricing structure for it, which we're constantly updating. And that's really useful once you get to actual production use cases and you have people paying you use that money to pay for the temporal cloud. It's not a lot. The temporal cloud pricing is super, I think it's really super interestingly well done because it's based on what we call actions. So like anything that basically causes a right to that durable database, you get billed on like fractions of a penny. So it's consumption based. The main thing is making sure you have enough traffic to cover, basically there's a minimum support cost that you have to pay for like a minimum bill requirement and then you get billed on the actions and making sure you have enough traffic and workload to handle that. I know, and then you get a lot of other cool features in cloud that, I have to make sure I say this carefully, that you don't get on the open source version, but those are all deployment options. So when it comes to feature to feature option, as right now, it's a one-to-one comparison. What runs in open source is what is deployed in cloud. Like, if I built all of my stuff on the open source stuff, I deployed to cloud on occasion to test it, but I'm constantly building on the open source version And all of my stuff runs in cloud. What you get when you go to cloud is you get those production features. You get single sign-on. You get role-based access control. You get more advanced metrics and things of that nature. You get all of these things that really matter at a large-scale production, things that large enterprises care about. And there are ways you can get those in the open source as well, but they come as first-class citizens in the cloud product. Maybe you got to run your own single sign-on identity server or something like that yeah yeah um so over here if i go to the temporal GitHub repo there's docker which has got a docker compose think something yeah there's actually a docker repo repo yeah is there okay so i could even i think it would be like temporal and then doc like in the search i would just search or in the org i would search for docker compose yeah it might be there somewhere uh there we go are you right yeah i'll put that in the links as well i'm a huge fan of docker compose. I think it opens up a bunch of great options. And if you go in here, you can see that there's like the doctor compose my sequel to Docker compose postgres, and then just a bare bones one, right? So if you wanted to self host it, is this a pretty good way to go? Yeah, I think it's a great place to start. I think it always depends on your scale. Like if you if you are good at Docker compose, and you know, you think like, the thing with Docker compose is like, and I believe this is all going to deploy it on a single service. So is like our single server. So like we always talk about like, you know, depends on the level of reliability you need of the service because if the database of the service goes away, then your reliability goes away. Like, you know, but that's kind of like the truth here is with that database being the single source of truth, if that database magically disappears, you don't have it. Now you could, you know, what you could do like an RDS or like a digital ocean managed database and connect that in this. Yeah, run just basically set a room, an off server database connection. string. Yeah, exactly. Right. Of any form that's then, then it's matching the reliability of that database. Yeah, exactly. Yeah. Yeah. So another thing, whenever I hear durable, and actually I see a bit about this in the show notes as well, and you say retry, like if something goes wrong, which we tried and it'll probably resume. Like sometimes it won't. Sometimes there's a poison, what's called a poison message. Like it's cursed to always fail for whatever reason. Like it's trying to get to a service. The domain is gone or it's not coming back. Right. Yep. One of those sorts of things. Three months ago, it was there. Then you said sleep for three months and it woke up and said, wait, it's like Planet of the Apes. You're like, yeah, what have they done? You wake up, you're like, the world is not what I thought, right? How do you deal with that kind of stuff? Yeah. So in the retry policy, so the default retry policy, what is, is it, its default is just retry on a specific time limit forever until it's either canceled or it succeeds. Now, if you expect that something could happen like that. Essentially what you would do is there's something what's known or non-retriable error types. So certain HTTP error codes, you know, might, you might would be like, Hey, you know, this is just not going to come back. 500 is fine, but maybe 404 is like 404 might never come back, but 500 very likely could or cannot connect. I don't know. Is that 404? I don't think so. I think it does. I don't remember. Yeah. I remember, but there's probably a code that like i i can't connect to the server versus like i got there and it said not here yeah so there's non-retriable error codes and i mean like what we do with the core temporal primitives is more of like um i often tell people it's like yeah like things that can retry let them retry but like say i do a divide by zero error no amount of retries is going to change the laws of physics um you know it's like holding your breath until something changes you're just going to pass out um same thing with these retries so you have to have what are called non-retriable errors and you essentially say, hey, whenever you experience this error, you should just fail. And basically, you would bubble it up and then you have to let the next layer of execution handle it. So yeah, totally a good story for that. Okay. Yeah. But you kind of got to think a little bit about it, right? Just yes. Yes. You still have to think it doesn't take away all the thinking for when it comes to like, what potentially could go wrong, but at least like with all of like the weird, like, you know, okay, this service might go down DNS, someone messed with DNS. It's always DNS. I had I had an it's always DNS moment the other day. And I'm like, I need a sticker for my laptop says this because it got me again. I can't remember what took me out. I suffered something with that as well. And it wasn't even directly me, but it was something that I was subjected to. Yeah. It is always DNS. It's always DNS. Except for when it's the database. Yeah. Or except for when you accidentally deploy the walrus operator on Python 3.7 on the server. That also is not good. And it's not doing, which I took down Talk Python for 20 minutes. I'm like, what? Why won't it run? It was running perfect. Oh, this was like, you know, years ago when those things were like new, right? Yeah. Oh my goodness. So one thing I want to talk about here, let me get back to, that's the right spot. Let's talk about the programming execution model. Let's see, is there a quick start? Let's maybe, let's talk through the quick start. And I think there's just some super interesting modern Python ideas that you got here, right? So maybe talk us through like, how do we get started bringing this in? Does it have to be a from scratch? Or can I take some part of my application, like a particular API endpoint and go, this thing needs, needs some help. And Temporal can help it. Let's just plug it in on this one bit. That's actually how we recommend a lot of people get started with Temporal is like, we don't, we never tell people like do like a whole ground up rewrite of like everything you have. We, I've often told people find something that, like find, find a service that annoys you, that pages you because it's constantly going down because it's unreliable and maybe do a like it's a small service and do a small rewrite of that in temporal and just see how your life makes uh makes a difference so the way that you do it with temporal is like you have to use the temporal sdks so the way that you build temporal applications is you build them using sdks um typically with other workflow-esque engines or other durable execution engines um some of the more modern durable execution engines have kind of followed suit with us but some of the earlier ones didn't we're code-based um we're not dag based we're not yaml based we don't have our own structured DSL, we are 100% code based. And there's a lot of advantages to that. So not XML based. No, no XML. So yeah, so we build you build basically what's called a workflow. Workflow is you can kind of think of a workflow is like your application. It's it's the it's the blueprint of your entire application. And what we'd say about workflows is that they have to be deterministic, like the code within a workflow must be deterministic, and you execute it line by line going down. And then anything within your workflow that potentially could be non-deterministic or could potentially fail. So calling out to a microservice is both of those. It's non-deterministic because you don't know what you're going to get back. And it's potentially going to fail because the service could be down. That goes in what's called an activity. An activity is that thing that automatically gets the retries. Now you implement activities as functions or as methods in Python. You can actually do them as both. And as you were saying in the readme, yeah, we use a lot of Python tooling. So that's actually something that I think that our SDK engineers, we have an entire team whose entire job is to build and maintain our SDKs. They're super proud of. It's one of the things I love talking about. Temporal is not built off of what you would say like an open API spec for a good reason. So it's built basically, I mean, Temporal itself is built in Go. So as you can imagine, everything's built in protobufs. There is a spec on what we build off of, but open API specs generate stuck stub client libraries. And like I've worked with a handful of them. They don't, they're not very idiomatic to the language. Like it kind of looks like someone bolted a C library on top of Python. Like it works, but it doesn't feel like Python. Our SDK engineers spend months studying the programming language, learning out what is idiomatic of the language, what actually makes sense. And then they build into it. So the interesting thing about this is like, you can see here when we define our decorate, our workflows, we define them by decorating classes. And then we the entry point by decorating it with an at workflow.run. So that's how we know where the entry point is. We're using asyncio inside of this to do it. Our activities, when you want to turn a method into an activity, you are a function in an activity, you just decorate it at activity.defin. And now you have an activity. We've done a lot of those kinds of things. We're using context managers very, very a lot or, you know, rigorously within the code base. The really interesting thing is, and I can only talk a teensy bit about this because it's super complex, but there's a really great talk track from it at the PyTexas conference from this year. We built a custom async event loop for this. This runs in a durable asynchronous event loop. And the SDK engineer who built it gave a talk at PyTexas this year, and it's on the PyTexas 2025 website. And I can provide a link to that later. And it's really neat because essentially we had to build a custom event loop to handle all of the way that we expect Temporal to work. And I don't think that building a custom event loop is a very common thing for people to do. So there's a lot of lessons learned there. I think there should be more of it though. I think it's a really interesting story. Yeah, I'll put this in the show notes. Yeah, that's Chad's talk. It's amazing. So like he talks about all the things that he had to do when he was building out a custom event loop for Temporal's AsyncIO event loop. Yeah, so for people for whom this is super new, this idea. You need places in your code to execute to say, okay, we can stop, maybe save some state. And then you talked about like replaying behaviors and so on. So you can write code like await sleep a day, you know, asyncio dot sleep one day. And that goes into this, as you said, durable asyncio execution. So instead of just saying, well, we're going to let the thread do other stuff. It's like, no, save it and then resume it. Right. That's pretty wild. It's pretty great actually. Yeah. And I mean, those, those, and that's one of the great things about the workflows and like that, those you'd have to definitely write as workflows, but yeah. And it takes up no, no energy or it doesn't jam up a CPU thread by sleeping. Like it's usually if you sleep something, that thread is kind of sitting there and it's stuck. this a hundred percent because it's all event sourced under the hood, essentially. the event, basically the timer started event gets recorded into the service and then it gets descheduled. And then that worker, that, that executor can continue performing other tasks. And then once that timer fires, the next task for it to continue execution gets put on the task queue. The worker consumes it, knows, oh, I need to resume. And it resumes. And that can happen whenever. That can happen, you know, a day from now, three days from now, three months from now. It doesn't matter. Eventually it gets put on the queue and it gets executed as if nothing happened. Yeah, that's wild. So interesting question out of the audience. If people went with your cloud option, where does that run? Is that AWS? Is that DigitalOcean? Currently it's in AWS and GCP. Okay. So those are the two clouds. Pick different availability zones. Like if I were in Virginia, US East one or whatever, I could say I want to use that one. Exactly. There's different availability zones and we even have multi-region failover. So if you needed multi-region availability for super, super high availability, which we do have definitely have large customers who need that level of availability. And you can totally do that. Cool. And that doesn't mean you got to be in AWS. No, no. We have people who are running on their own private, they were running on their own infrastructure on their on-prem and they're calling into it. So that's the niftiest thing about temporal cloud is like the security model is super simple because temporal cloud or the temporal service. It doesn't have to be temporal cloud. It's the service, whether you self-host it or whether it's on the cloud. It never connects to you. The workers always do an outbound connection into the temporal service. So if you're using temporal cloud, the only firewall rule you have to allow is a single outbound connection off of a single port. That's it. So it's really awesome. Yeah, I'm impressed with a lot of this. So let's sort of kind of get into that. And I want to maybe close out with two topics, testing and what's next, or like sort of also maybe multi-language stuff we should touch on as well. But let's talk testing first. So there's a couple of interesting challenges here. Like first, if I write code like this and I want to have a unit test, no longer am I like, well, this is complicated. I just have to use pytestAsyncIO. It's like more than that, right? So what's the testing story? Yeah, so the cool thing about the testing story with this is it is technically still pytestAsyncIO. because we're code-based, this is one of the things that I always have to harp, to, to remind people on my courses and everyone's always like, oh, that's so cool. you, because we're code, you have to give up none of your tooling. You don't have to get like, how do you like to package it? Are you a poetry person? Are you a B person? Are you a Pippin person? Whatever you want to use, use it for your testing. Do you want to use a Po the poet? Are you a pie test person? Like, what are you using? Use it. It doesn't matter. Temporal does provide, obviously because these are more complex workflows and stuff. they require a little bit. Every single temporal SDK does provide a testing framework that is built into it. And these integrate natively with all of your testing frameworks. So you can use, you use pytest. I use pytest. Now you could use something else, but all of our courses, I think the temporal 102 course, yeah, I wrote that one, has a whole chapter on testing temporal workflows and activities and mocking activities because you have to be able to call them independently because you, Otherwise that's an integration test. It's not a unit test. It is important. I always feel bad about mocking the code. It doesn't seem nice, but you got to. Yeah, it's super easy. It's so nice. The you you basically just read you basically redefine the activity and I just put it in the mocking story in Python is so nice. But you just use our testing framework. And what that does is it basically the testing framework will automatically spin up a temporal service and a worker for you. So because as you can imagine, like the execution part of this is like, you have to have a service running, you have to have a worker and then you have to send like basically use a client to send a request to execute the workflow and it will be executed. The temporal testing service does all of that for you. And it also has basically time skipping. So what you can do is, you know, if I have to test, if I have to test something that sleeps for 30 days, I would actually prefer it to not actually sleep for 30 days. So I can test it. Well, I see I take so long. Yeah. So time skipping is in there and there's a lot of other really neat features in the testing. So every single temporal Python or sorry, sorry, every single temporal SDK has a testing framework built into it that really well enables testing. And it all works natively with the tools that you are already used to using as a developer of whatever language you're already using. Yeah, that sounds great. And you can say things like run this and wait for a week and then resume. And you can just say, and now a week has resumed. You know, a week has passed. Now I see what's happened, right? Like it'll just zip right ahead. Yep. Skips right ahead. Doesn't even, doesn't even worry about it. That's always a fun testing trick. So the other one I want to talk about is when I'm over here, into the GitHub repo, I can scroll down. If I look at the repositories, it's Java SDK, Python SDK, Go SDK,.NET SDK, Ruby SDK, et cetera, et cetera. There's a bunch of interesting things here. Like I can write part of my app in Java, part of the workflow in Java or the workflow items in Java, the queues, and I can do part of it in Python or.NET. And the other part I think is interesting is Python,.NET, Ruby, et cetera, all share a common Rust base. And so it's kind of like they all go in lockstep. Yeah. Yeah. Yeah. So yeah, two great topics there. So the first one I'll start off with is the is the polyglot stuff, because I think it's one of my favorite things. And we don't I don't I don't ever get to talk about it enough. So I'm glad you asked. Underneath the hood, the way that all of this communication happens is it's happening via essentially protobuffs across task cubes to the temporal service back and forth. One of the things that you'll find if you dig into temporal is that we require your input, the inputs and outputs of your functions to be serializable to basically protobufs. Now, if you have something that's not serializable, we obviously, because it's code, we provide you the way to extend the serializer. So as long as you can serialize it, again, it's code, you can do whatever you want with it. But because of that, because everything speaks protobuf, all of these languages can natively speak to each other. So you're right, I can write workflows written in Python and call and have three different activities in that workflow, one written in TypeScript, one written in Java and one written in.NET. And I can call them seamlessly, like basically just by calling execute activity, giving it the name of the function. And then I could actually still then pass in a data class of the data that I have as that parameter, because it's still getting serialized down into a protobuf. It will get deserialized into the other language, execute it and pass back data that I can resume. And then I could call it technically from a client that's written in Go. So this enables Polyglot across all of these languages. And it's amazing. So if you have legacy systems or you have stuff where like you really need something to be written in a whole bunch of different languages, it just gives you this out of the box for free. And I think it's one of the neatest features. And one of the other part that it really does need about this is it's not just like the fact that it can call it, but it also preserves the stack traces as well. So one of the other courses that I developed are Crafting the handling strategy course. There's a demo in there where I am showing like basically that exact workflow, a Go client that's calling a Java workflow that's calling a Python activity. So three different languages. And then I intentionally throw an error in the Python activity and I tell it, do not handle it, do not retry it, let it bubble up. And when I get back to the Go client, I can see the different stack traces in the different languages all the way through. So I get a go basically panic that contains a Java stack trace that contains a, that contains a Python stack trace. And I can, I can, I can see all of this across the line. So not, and, and also the thing, and just to do it for fun, because I like showing off, I have all of these workers running on different machines. So I am, I am running on different, I am crossing process boundaries. I'm crossing literally across the network IP boundaries, and then I'm crossing language boundaries and it happens seamlessly and you'd never know that it happened. So the orchestration layer is the wildest thing ever. And then you asked about the Rust SDK. That's a fun one. So that kind of goes back into the history a little bit of how Temporal was built. And for a crash course in this within two minutes or less, essentially our founders started at AWS together and built out what would become, they built the foundations for SQS and what would become simple workflow service. Then one of the founders left, went to Azure and helped build the Azure Durable Task Framework at Microsoft. They met up back together at Uber and built Uber's Cadence. Cadence was then basically like battle tested for four years, open sourced, and then they got permission to fork it and build Temporal. So Temporal, the company is six years old, but it was a four year old open source project prior. So it's a 10 year old open source project, essentially. But because of that, what happened at Cadence was I think they wrote the Go and the Java SDKs there. So those are very uniquely themselves because they were written independently. And then the PHP SDK is its own story. Someone wrote that in the community because they really wanted it. And it kind of follows its own rules. But when they started building the temporal SDKs, TypeScript was the first one and then Python, if I remember correctly. They wanted a common core, like basically re-implementing this. Because in these SDKs, there are very complex state machines that maintain all of this state of what's going on. And they did not want to keep re-implementing this every single time. So they built a Rust core SDK, or it's not even an SDK. It's not an SDK. It's just the core. And all of the, so the TypeScript, the.NET, the Python, and the Ruby SDKs all have a upper level SDK that wraps this core Rust SDK and call into it. So they share a common theme. So there definitely will sometimes be features or like things that happen in the Go or the Java SDK that you're like, that's a little different because those are not based on Rust core. But yeah, that's how they all call in. So like their PIO3 is basically being used here. We're calling into pot with PIO3 into a rust binding. and that's like a Pydantic and others. Yeah, exactly. Yeah. So, and it's, it's really cool. And that, that makes, adding new SDKs a lot easier because really, and truly the hardest part of building the SDKs is, was like those state machines used to take a long time. And once they got it figured out on the rust core side, it made adding new languages easier. the Ruby SDK is in public preview and will be going generally available here soon. Um, And there may be one or two more SDKs coming out within the future. If you guessed really hard, you could figure out what it is. There's an SDK. There's a core that doesn't have an SDK. There's no secret. There's no secret about that. Yeah, of course. People have been begging for that for years and it's obvious. So yeah, may involve crates. Okay. So what's, what is the, what's the future? Like anything that's worth giving a shout out that's coming or that kind of stuff? Yeah. I mean, I think that like a lot of times people often ask me like, what is Temporal used for? And I would say Temporal is used for anything that like you don't want your code to fail. It like it's it's really interesting to help educate people and work on a product that really does affect nearly every single part of the application of the software development lifecycle and every single part of it, of, of, of the industry. You know, I was used to working on other products that like, yeah, like I worked at a synthetic data company for a little bit. And that had a very niche area. And then I worked at DigitalOcean, which was cloud products, which is still awesome, but like doesn't affect everything. Temporal really does like, are you doing finance? Temporal is great for long running transactions. Are you doing food delivery? Like, are you a fast food industry? Are you doing groceries? Are you doing, what are you doing? Temporal can benefit from it. So there's a lot of really cool things. You can use it for anything. And what we're seeing right now, specifically, and this kind of alludes back to your OpenAI thing earlier, is that we're seeing a lot of AI companies of value out of this because like when it becomes time to take your agents to production, there's a handful of decent production stories out there, but it turns out these are AI agents in production. This is microservices in production with a fancy label on top of it. These are just distributed systems. Not only are they microservices, they're very slow, long running microservices, which make it harder. Yeah. Yeah. That's exactly what Temporal's model is. Do you have a slow running microservice that can sometimes fail. Great. We have a product that makes all those problems go away. So, you know, like I'll, I'm working on a lot of content right now around showing the benefit of temporal in AI. and we have, we have a handful of customers, who I can't talk about, that are, using us for lots of different AI related things. but there, I mean, you can look on our blog or anything. You can see tons of people that are using it. and it's a really cool thing. So I would definitely say like, if you're, if you're trying to take AI to production, you should be looking into temporal. it's not an AI tool, you know, like we're not, we're not going to like, we're not going to do the thing that every company did is we're not going to suddenly pivot and become an AI tool. because we're not, we just, yeah, we solve everything. And AI is one of the great things we solve. So that's awesome. Yeah. You're not going to vibe code with temporal. Maybe you vibe code, temporal code, but not with temporal. No, I've, I've, I've actually vibe coded a handful of temporal things. And it's interesting because like i'm super picky uh about what what people's temporal code looks like as because i've been teaching people best practices for three years almost three years now and i i'm like no vibe coding that's no claude that's wrong like no no no cursor that's wrong like you can't do that so and the interesting thing about that is the way that i'm looking at it's like oh i need to make more content about this because yes because the llms are not like it's actually funny every now and then the llms spit out some of my content um and i can tell when it's my content because i know So I write comments in a very particular way. And I'm like, oh, okay. So what that ends up telling me is, oh, I need to make more content around this because we're still not vibe coding at 100% capacity. Yeah. Yeah. Yeah. That's a whole discussion we could go down. You know, I was totally wrong when we started. I said we could talk for two hours. I think it's three to four. Yeah. We got so much more we could talk about, but there's only so much time we can dedicate to each episode. So let's go ahead and call it. I say, you know, thanks for being here. The more I looked into this, this is a super interesting product. And there's a lot of neat Python integrations like you program it with async and await rather than some funky SDK bolt-on thing. So people should definitely check it out. Final call to action. They're interested. What do you tell them? Check out, just check out the website. Check out temporal.io or the learn site, learn.temporal.io. It's a great place to get started. You can install Temporal by just running brew install temporal on your Mac, or there's commands for Windows and Linux as well. Curl commands for that. Or Docker compose up. Or Docker compose up. If you want to do that, totally can do that. Just try it out, build a workflow. And then what I tell people is try to break it. Like start a workflow, kill the worker, bring it back online. Like I think it's really magical when you first actually try to like actually break the software and stuff. We've had multiple people that have taken jobs here who have said, I started playing with it. I tried to break it. And when I couldn't, I decided to apply for a job here. So try to break it. See what you can do. And you'll be amazed by it. Just a personal anecdote. I remember when I applied here, I was reading through their docs. And I told myself, I was like, if they can do half of the things they claim they can do in the docs, this is revolutionary. I've never seen anything like this. And it turns out we do all the things we say in our docs. It's probably the most interesting tech product I've ever worked with in my career. And I know that I will be working with it probably for the rest of my career. It fascinates me and I love playing with it. Like I build temporal applications at home for fun just because it's like, oh, look, I don't have to worry about someone's API going down anymore. Yay. Yeah. It's awesome. So I hope you enjoy it as much as I do. I'm pretty impressed. All right. Well, thanks for being on the show. Thanks for coming on and sharing everything. Yeah, it was great. Great to talk with you. Yeah, you as well. Bye bye. This has been another episode of Talk Python To Me. Thank you to our sponsors. Be sure to check out what they're offering. It really helps support the show. This episode is sponsored by Posit Connect from the makers of Shiny. Publish, share, and deploy all of your data projects that you're creating using Python. Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs. Posit Connect supports all of them. Try Posit Connect for free by going to talkpython.fm/posit, P-O-S-I-T. The PyBay Conference is returning to the UCSF Mission Bay Conference Center in San Francisco, California on October 18th, 2025. Get your ticket and pick up a free conference course bundle from Talk Python. Get started at talkpython.fm/pybay. Want to level up your Python? We have one of the largest catalogs of Python video courses over at Talk Python. Our content ranges from true beginners to deeply advanced topics like memory and async. And best of all, there's not a subscription in sight. Check it out for yourself at training.talkpython.fm. Be sure to subscribe to the show, open your favorite podcast app, and search for Python. We should be right at the top. You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm. We're live streaming most of our recordings these days. If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube. This is your host, Michael Kennedy. Thanks so much for listening. I really appreciate it. Now get out there and write some Python code.
