Running Local LLMs With Ollama and Connecting With Python | Real Python Podcast #284
Key Takeaways
The video discusses running local LLMs with Ollama and connecting with Python, covering topics such as setting up Ollama, installing LLM models, and generating text and code from Python using a chat interface.
Full Transcript
Welcome to the Real Python podcast. This is episode 284. Would you like to learn how to work with LLMs locally on your own computer? How to integrate your Python projects with a local model? Christopher Trudeau is back on the show this week bringing another batch of Pyoders Weekly articles and projects. We cover a recent Real Python step-by-step tutorial on installing local LLMs with Olama and connecting them to Python. The piece starts by outlining the advantages the strategy offers, including reducing costs, improving privacy, and enabling offline capable AI powered apps. We talk through the steps of setting things up, generating text and code, and calling tools. We also share several other articles and projects from the Python community, including the Python developer survey 2026, creating callable instances with Python's Dunder call method, creating maps and projections with GeoPandas, ending 15 years of subprocess polling, discussing backseat software, a retry library that classifies errors, and a project for peer-to-peer encrypted CLI chat. If you support web apps in production, you don't need junk logs. You need intelligent logging with real-time error alerts, automatic dduping, and actionable context. Honeybadger filters out the noise and transforms your Python logs into contextrich issues so you can find and fix errors before your users notice. Sign up for your free developer account at honeybadger.io. That's honeybadger.io. All right, let's get started. [music] The Real Python podcast is a weekly conversation about using Python in the real world. My name is Christopher Bailey, your host. Each week we feature interviews with experts in the community and discussions about the topics, articles, and courses found at realpython.com. After the podcast, join us and learn real world Python skills with a community of experts at realpython.com. Hey Chris, welcome back. >> Hey there. >> All right, so we have just one little bit of news, our usual topics. We got a discussion which we'll see how far we go through it to today and a couple projects. So a typical rundown. You ready to go? Let's do it. All right. What do we got for news? Well, just the one quick item this week. The annual Python developer survey has started. We'll link to it in the show notes. So, go fill it in if that's your thing. I like seeing the resulting data, so I try to remember to take the survey myself cuz if nobody did, we wouldn't have that data. So, yeah, go take the survey. >> Make sure you mention your favorite podcast is uh in there. [laughter] >> Yes, go take a survey and check the box that says you love us. [laughter] All right. So, first topic here, actually got a bunch of real Python stuff this week, which I'm excited to share with everybody. My first is a recent step-by-step project. This is a tutorial by our real Python friend and frequent featured author Leodonis Boor Ramos. It's titled How to Integrate Local LLMs with Olama and Python. I'll just read from the beginning of it. Olama is an open- source platform that makes it straightforward to run modern LLMs locally on your machine. Once you've set up Olama and pull the models you want to use, you can connect them from Python using the Olama library, which is a Python library, which I'll mention. And Lama seems to be the main tool that I hear about people are using to do this. I like the tutorial. It's a rather quick one for just getting you a taste of what you can do with it and how to connect Python to it. Step one, you're setting up O Lama, adding models and getting the Python SDK. So, installing was straightforward on my Mac. The typical download link, uh, opening up a DMG file and dragging and dropping into the applications folder. And then you get into installing the two models, which the tool does for you. In this case, you're installing Llama 3.2 colon latest and then code llama col. There are lots of other models. Those are the ones that he shows off. one is like a general purpose LLM and the other being more specific for writing code. You use a pull command to have it download it to your local machine. Llama 3.2 is 2 gigabyte, so kind of large. You got to look for some space on your machine. Code Llama is actually much bigger. It's 3.8 GB. I was wondering, and you may be wondering, well, where do these models get stored? I couldn't find them right away, and it's in a hidden directory in your home directory. So, you got to make sure that you go ahead and use the commands on your computer to show hidden directories if that's not always on. But, yep, there they were in your home directory. And to run a model from the terminal, you type o lama run and then the model name. And then it pops up a three greater than prompt style thing. And you can actually use it like a chat bot right directly in it. And he shows that off. And this is where you would maybe say, okay, well then how can I make it work with my programs? And this is where the rest of the tutorial goes. Uh instead of just asking questions directly of it, how can you use Python? And so you install the Olama Python SDK which is available from Pippi. I built a virtual environment using UV and then I used UV to install it. Step two is about generating text and code from Python and takes you through a chat interface. He uses the ripple the readaluate print loop here. That's what you get when you just type Python. He shows you how to create this sort of minimal chat example. Type from Lama import chat and then you create what are called messages. Messages is a list of dictionaries because the chat interface is built for a sort of multi-turn conversation and you build up context as you go. Each message is represented as a Python dictionary which has a role and a content key with the corresponding values. All the code is in the article. You can follow along with it or you can download it if you'd like. He creates a couple of examples based around sort of asking questions about Python itself, like explain to me what Python is in one sentence and then goes into some more example type of stuff like define a list comprehension in a sentence and then providing a short practical example. Again, the idea of like building up context. The next is using this text generation interface instead of a chat. This is one that's more geared toward like a oneshot prompt on the target model and he has it doing a response to like a common code interview question you might have. In this case the the fsbuzz question that a lot of people may have seen before. Step three is the last step getting into more advanced ideas. How could you build tools to interact with this chat interface? Literally tool calling also known as function calling enables a model to call Python functions and use the result as a context to provide better responses. This technique can be used along with retrieval augmented generation or rag which can help you obtain a lot more accurate or up-to-date or on topic responses. The example has you build a script which you'll then run instead of working directly back and forth in the ripple. I'll wrap up with this highlevel flow that he's designated here. One, define relevant tools as Python functions. Two, pass the tool along with the prompt. Three, execute the selected tools in your code. And then four, append the tool result as a RO equals tool message. And then finally, you generate a final answer that uses the tools result. So, kind of a little bit of a workflow in this last section. It's a nice step-by-step tour into Olama and running these LLM models locally on your machine. There are options to run from the cloud if you want, but then you're back to the issue of having to pay like a monthly fee and and things like that. Thanks for the step-by-step tour, Leon. If you support web apps in production, you don't need junk logs. You need intelligent logging that helps you find and fix errors before your users notice them. Honeybadger filters out the noise and transforms your Python logs into contextrich issues so you can put out fires faster. Real-time error alerts accelerate your reaction times. Automatic dduping boosts signal to noise ratio and advanced search and query tools help you dig deep into issues. Find and fix errors faster for free. Visit honeybadger.io to sign up for your free developer account. That's honeybadger.io. IO. >> What's your first one here? >> I'm also starting with some real Python. I've got a video course named create callable instances with Python's dunder call by Joseph Per. And there's a written tutorial that goes along with it, which is also leodonis. So if you've ever used a function of Python, you've used something that is a callable. Everything in Python is an object. Uh there it is. Even the functions, if you don't put the parenthesis on the end of a function, you get the object, or more accurately, a reference to an object. Functions aren't the only things you can call, though. Those same parentheses on other kinds of objects will also call them. Maybe uh in fact, if you go through the built-ins part of the standard library, some of those things that you thought were functions actually aren't. They might be callable classes or objects. So, how does all this work? Well, like with a lot of the magic things in Python, this is achieved through a dunder method. That's one of those special methods that have a name beginning and ending with double underscores. The dunder call method is what gets called when you invoke an object with parenthesis. Not everything is callable, and those things that aren't are not because, well, they didn't implement dunder call, which is the default. So, let's say you have a function named greet that prints out hello world. If you run the built-in dur on greet, you'll see that your function object has a dunder call method. If you invoke that dunder call with parenthesis calling the method essentially, you'll get the same thing that happens when you invoke the function itself. And that's because that's what Python is doing for you under the covers when you call a function. It's invoking the callable of the function object. Since looking for a dunder call method is a little messy, Python also has a built-in function that will tell you if an object is callable or not. They did a good job picking its name. It's callable. And so if I invoke callable, passing in a reference to my greet function from before, I'd get back true because all functions are callable. Note that true only means that the method is defined. If my dunder call does nothing but say raise an exception, it isn't really very callable, but it will still return true. The beauty of this design is that you can create your own callables simply by defining a dunder call method on your class. The tutorial and course both run you through several examples of writing a dunder call method and what you might do with them. So, one of the more common uses is something called a strategy design pattern. This is a coding pattern where you need a family of algorithms which are interchangeable at runtime. Say your code needs to support serializing data in both JSON and YAML and you have a whole bunch of functions that need to use that serializer. Rather than having two copies of each function, you know, function JSON function YAML, uh you would build the serializer helpers that are callable and then your functions could just take that object instance. Then the functions themselves would invoke the serializer, not caring which kind got passed into it. So there's lots of good stuff here in both the course and tutorial. Whether you want to watch or read about dunder call, the content's worth your time. Yeah, I'm excited to share another tutorial by Joseph. He's doing great work here. All right. Well, my next one is another Real Python one, and this one is by a new Real Python author, Ari Lamstein, and it's titled GeoPandas Basics: Maps, Projections, and Spatial Joins. Are you looking to do geospatial tasks in Python? Want a library with a pandas-like API? Then Geopandas is an excellent choice. That's from the intro there. You start by installing Geopandas from Pippi. This is another library like we've discussed before where there are options for the installation. Ari has you install with the square bracket all option which ensures that you have everything you're going to need for reading data, transferring coordinate systems, and creating plots. But you can always learn more by reading the documentation if you want a lighter version. So now you're ready to read in some data. Geospatial data comes in geojson or shape file formats. He shows an example using a data set that is actually included in that all install I mentioned earlier. It's the New York City burough boundaries data set. It's a common one I see as an example using these geo spatial libraries. Once you've read in the data, you use map plot lib to create the static map. He then uh takes you through turning it into a cororopath which is a map that colors areas based upon the values in a column. The next section is about creating interactive maps, building on top of what you've learned so far. It uses the Folium library, which I think we've mentioned on the show a couple times in the past. It's a very popular library out there. And again, it's uh installed with the all features version. You create an interactive zoomable map using the expplore method and it generates this as an interactive then HTML map. The tutorial continues with digging into working with coordinate reference systems or CRS and projections. Every geo data frame includes a CRS or coordinate reference system and it explains how these coordinates map to real world locations. The example that he uses I think is a common one. You think of like a world map that's sort of focused on the countries laid out in a square format which actually isn't sort of geospatially correct. And so it talks about like well actually how does that actually align and what are the actual sizes of these countries and stuff like that more from like a globe type of look. Ara takes you through an example of how your choice of CRS will impact the way that your map's going to be rendered. Then leads you into how to perform spatial joins. These are combining information from two geod data frames based on how their geometries relate to each other. The tutorial wraps up with some advice and avoiding limitations and potential gotchas that might come along the way. The first is uh dependencies. I've mentioned this already when you go to install geopandas. It can be tricky as it depends on what libraries you want installed with it. It gives some examples uh geos, p oj and gd. If you look those up, they're in the articles links as far as you want to learn more about what those acronyms mean. If you run into problems installing with pip, there's also some information about well maybe you might look at alternatives that might be like if you're using Honda or something like that. Another potential gotcha is making sure to check to set that you're using CRS. And then the last is mapping limits. The built-in methods are good for quick maps. Again, kind of mapplot lib style stuff, but might need to have installed the elaborate version that includes Folium if you're looking for that advanced interactivity. He also includes a link to the real Python folium tutorial there also and there is a quiz which is included with most of our recent real Python tutorials. So thanks Ari. What's your next one here? My next article is a kind of deep dive on a very specific thing coming in Python 315. The title is from Python 33 to today ending 15 years of subprocess polling and it's by Jean Paulo Doddola. You're probably familiar with the subprocess module in Python. It's the one that allows you to call other programs on your computer. When you do call outside of your code, the subprocess call has to wait until the other program finishes. Up until recently, to do that, it would pull the OS to see if the program had exited or not. The code for that isn't really complicated. It's essentially a while loop that sleeps for a bit of time, wakes, checks if the process is done. If it is, it exits the loop, and if not, it repeats and waits some more. This is a busy weight loop and it's constant wake up and check is extra work on your CPU. The longer your subprocess runs, the more time wasted checking. Another issue with the approach is latency. If the process finishes right after subprocess checks it, then you have to wait for the next loop before finding out that it's done. So, both of these problems are even worse at scale because the more processes or the longer the processes, the worse the problem gets. In older operating systems, this busy weight was pretty much the only choice. Some OSS have call back or signaling mechanisms so that you don't have to pull. So, for example, in 2019, Linux 53 added a new SIS call named PF FD open. They're great at naming stuff there. Uh, [laughter] which allows you to get at a process ID and treat it like a file handle. That might seem weird, but there are already mechanisms in PZIX operating systems to signal events connected to file handles. So this allows you to use those tools in connection to a process ID. Mac OS and BSD have something called KQ, which is sort of similar to those file handle systems that I was talking about before, but specialized for process IDs. So a PR has now been submitted for Python 315, which switches the busy loop polling mechanism in Linux, Mac OS, and BSD to use these system calls, which means no more busy loop anymore. Interestingly, Windows never had this problem. It used event signaling from the get-go. And this this just breaks my brain. This is so very backwards about how this usually works. >> Yeah, but that probably says more about my Unix bias than anything else. >> The busy loop code is still there in case you're running subprocess on an older PixUS or any other that doesn't support these kinds of signals. John Paulo's article goes on to include some benchmarks to show you just the kind of difference that not having busy loop polling makes. I like this kind of under the covers addition to Python. It makes everyone's code a little bit better and doesn't make us have to learn new syntax or a new library call. It just kind of free performance improvements. So, uh, good work, John. [music] It's time to shine a spotlight on another real Python video course. Would you like to learn more about agentic coding, but you want to work inside a familiar interface of an IDE? Well, this course has you covered. It's titled tips for using the AI coding editor Cursor and it's a video course presented by Martin. Cursor is an AI powered integrated development environment based on the Visual Studio Code codebase. It comes with a multi- aent interface and the composer model for fast agentic coding while keeping a familiar editor workflow with a project aware chat code completion and inline edits. Through the course, you'll learn how to use different modes and models in cursor, how to run multiple agents at a time. You'll learn how to run your project and practice the commands and working with the built-in terminal. And you'll learn how to resolve a merge conflict. Like most the video courses on real Python, this course is broken into easily consumable sections. Each lesson includes a transcript including closed captions and where needed, you'll have access to code samples for the technique shown. If you're ready for a tour of working within cursor, check out the video course. You can find a link in the episode show notes or you can find it using the search tool on realpython.com. [music] Well, the aforementions discussion this week is titled Backseat Software. It's by Mike Swanson on his blog. I heard some other podcasters talking about this and decided it might work as a discussion. Mr. Trudeau is here to act as the devil, I mean devil's advocate, uh, you know, lawyers. [laughter] All right, this is from the introduction. I'll just read it. What if your car worked like so many apps? You're driving somewhere important, maybe running a little bit late. A few minutes into the drive, your car pulls over to the side of the road and asks, "How are you enjoying your drive so far?" Annoyed by the interruption and even more behind schedule, you dismiss the prompt and merge back into traffic. A minute later, it does it again. Did you know I have a new feature? Tap here to learn more. It blocks your speedometer with an overlay tutorial about the turn signal. It highlights the wiper controls and refuses to go away until you demonstrate mastery. Ridiculous, of course. And yet this is how a lot of modern software behaves. Not because it's broken, but because we've normalized an interruption model that would be unacceptable almost anywhere else. I've started to think of this as backseat software. The slow shift from software as a tool you operate to software as a channel that operates on you. Once a product learns it can talk back, it's remarkably [laughter] hard to keep it quiet. The piece then takes you through several points that he'd like to make across it, kind of giving a bit of a history lesson. Hey, software kids used to come on discs. Of course, that meant it was very hard to push updates, meaning literally you'd have to push them into an envelope and send them through the actual physical mail. always being online. Great now for updating, but that it became this back channel which has allowed for the software to provide information like crash reports from your machine back, but also continuous update checks, licensing, and working against piracy. Sort of this nice feedback loop. But now everything gets measured once software could send data home. The next natural thought was, well, can we understand how people actually use this? And then the piece goes on to raise concerns across a bunch of these little topics here. Guidance everywhere. Sort of this pointing out of new features which you mentioned there in his example. This idea of experimenting in production just push notifications in general. Not all notifications are evil though some are. How builders of the software tend to hate this. Again we'll get a rebuttal here. tools are supposed to get out of the way and kind of a tour of how we got here with timeline of events up to our like modern phones which are probably some of the worst examples of it and applications that are on it and of course the modern web which is really really struggling to survive and needs ways to make sure that you are engaged and signed up for the full plan and so forth. He gives some advice at the tail of it about designing for quiet. Anyway, I'll let you start. [laughter] So, I I have a bunch of issues with this article, but most [clears throat] of it isn't the article. It feels to me a little Yeah, it's a blog post. It's a rant, right? But it feels to me like it's been taken out of the context of reality. So, as a developer or as a user of one of these pieces of software, there isn't much here that I disagree with, but it kind of reminds me of airlines, right? Everybody says they want more leg room. But everybody chooses their flight based on the cheapest ticket. Well, you know what? How you get the cheapest tickets? By smooshing the most smooshing the most number of people into a plane, which means less leg room, right? So, >> not if you're my wife. [laughter] Th this is yeah and I know there are exceptions and that's why people will buy premium or whatever but my point is sort of that this is driven not like nobody woke up someday and went let's make every user's life miserable. This is a side effect of things like how the app stores work, right? If if you don't ask for reviews, the only people who leave reviews are the people who are pissed at you. So, of course, then that means you have to ask for reviews because if only otherwise it looks like your app is problematic and nobody will take it, right? Like I I get what he's saying and this kind of goes along with doctors and shitification and all the rest of it, >> but I don't actually see the answer. I don't think consumers are going to wake up tomorrow and do the things that we think are air quotes right. So, to a certain extent, it feels a little old man yells at cloud to me. Yeah, >> I think there's a few points that the design type people in the world want to use this as a rallying cry of like why why is the huge BMF that is Apple using its platform when it said it it others can't to send notifications about things that I don't care about. you know, why is it automatically installing, you know, music on my phone or whatever it was that was, you know, these other times where there's this strange sort of overreach where, well, we say we are trying to limit this amount of like, you know, pestering you and then we ourselves do it, you know, it's it's kind of this weird creeping thing that happens. >> Yeah. That's the history of platforms though, right? Like it used to be notorious with Windows that you know the Microsoft Office software ran very very well cuz they weren't using the public APIs, they were using the private APIs. And so if you were non-Microsoft and you only were allowed to use the public APIs, you couldn't get the kind of performance they were right. Like this is just the nature of platforms. And yeah, if I had a magic wand, but I don't. Yeah, I think it's just the amount of hostility across the the web as far as this stuff goes. I I understand the need that a lot of these platforms have to survive, but I don't know if they ever really use their own product >> for sure >> and and get an idea of it. Um it's like surveys today are the one thing that kills me. Like I don't know why I need to do a survey after every single interaction I had with any other human being on the planet. Yep, for sure. Um, Radio Shack used to ask you for your address when you bought batteries with cash, right? Like it this isn't just this isn't just the web. [laughter] Like this is this is what happens when MBAs and marketing people get put in charge, but they're the ones who make the sales. So that's what happens, right? I think there's a little bit there's an old uh joke, analogy, whatever about a drunk guy looking for his keys under a street light and somebody comes along and says, "What are you doing? I'm trying to you know, I'm trying to find my keys." "Well, where did you lose them?" "Well, over there, but well then why are you looking under the light?" "Well, it's dark over there. I won't find them." And so, like, I think there's a bit of that that goes on in the business, right? As soon as you give them the ability to measure, we stop thinking about is there value in this measurement? Oh, we can measure it. We'll measure everything and then we'll we'll hopefully we'll make changes based on it. And sometimes those changes are good and sometimes they aren't. That's my I've heard it expressed a couple times and I I like to use the analogy of so many of the companies that I interact with today are driving around literally just staring at a dashboard and thinking, well, if I read all these instruments, I'll definitely know where we're going and how fast we're going. But in general, they're not looking at any of what's outside [laughter] that's actually happening in the world. And it just is frustrating to watch that sort of development and everybody kind of going down the same pathway. I don't know an answer. Yeah. Well, there is a blindness that comes with it. So, I had a client years ago who they noticed the pattern in their signup data that about like I can't remember what the number was. Let's just say it was 3/4 of the people in their sign up path dropped off when you asked for the credit card, >> right? >> And so their brilliant idea was free trials without asking for the credit card cuz formally you would take the free trial but you'd have to give them the credit card and that way when the free trial was over they could start charging you, right? >> Well, they were looking at well the drop off is there. It's asking for the credit card that's causing them to drop off so we just won't ask them for the credit card. Well, of course, when they implemented this, what ended up happening was people took the free trial and then dropped off anyway. So, that just cost us a whole bunch of money to run those servers because they weren't serious about it. And so, that they were misinterpreting the signal of asking for the credit card as oh that that means they're not interested to actually well maybe they're interested enough that they'll actually pay us for this. Right? So, some of it is also you have to be careful with what you're interpreting out of the measures. Right? I've witnessed AB arguments that are rounding errors and and they and knives come out because but this one's better and it's like yeah and you could run this experiment three more times and the noise will change the result but yeah I wonder if like not having enough time across that to to see how it actually is moving like the initial reaction between the AB test of like oh I measured it for like you know a month or whatever and so forth Earth, but the the amount of time that human beings have an amazing amount of tolerance. [laughter] >> Yeah. But they have breaking points. >> And I think that's kind of where a lot of this is coming from. Like as far as, you know, like you said, like the old man yells at cloud type of thing. It's just that and you come from a different background. I'm going to pick on you a little bit. Yes. Uh >> that's fine. Go right ahead. I'm I'm playing the devil. So, >> you're somebody who designed a slot machine software. [laughter] >> Sorry, bingo. Uh, maybe I I'll just exclaim that occasionally. [laughter] Bingo. >> Oh, no. We did slot machines as well. So, yes. Yeah. Yeah. No. [laughter] >> So, but but to your point though in that industry, we were doing it on purpose, >> right? >> Right. Like that was that you were the the entire gambling industry is based on we are trying to figure out the psychology of c causing this to happen. How do we keep you going? Yeah. >> And I think what's happened is that has been so social media is driven by attention. So everyone now thinks of what is what is the attention and we're measuring the attention. Well, I don't really need to measure your attention in my app. As long as you keep paying for it, then I don't care whether or not you know you use it, right? Or you know you if you if it's good enough, that's fine. Do I need you to nag you to use it? No. But yeah, I don't know. I The other aspect too, I'm always very conscious when we have these kinds of conversations that like I am two generations back in starting out in this field. Right. Right. >> Um so I'm very conscious of the fact that some of it is just this stuff has changed, right? Like when I was coming up, UX was a science that had almost nothing to do with UI, right? like it that we we measured things like how to make it easier so people could find stuff. And I can tell you right now that you know Apple was one of those that were were fantastic at it. And you know when I record videos sometimes I have to increase the size of the mouse pointer and I do this you know once every two or three months and it always takes me 3 or 4 minutes to figure out how to do it because is it under the it's in the settings. Is it under mouse? No, actually it's not. It's under accessibility. Okay, I kind of get that cuz that's what it's usually used for. So, you go into accessibility. Is it under accessibility and mouse? No, cuz that's about the physicality of how the mouse responds. It's under display. It's in the visual [laughter] section. And and like and I I remember that it's hard to find. But like and you know, again, I don't know whether that's because there's so many options. So, this is a challenging thing or whether it's people uh people in charge of this stuff don't care as much anymore. >> That is where a lot of these bloggers and other podcasters are coming at it because they've been very angry at Apple with their latest OSS. >> Yeah. >> And doing exactly what you're talking about of like, >> well, nobody uses this feature anymore. Well, you buried it 17, you know, layers down inside the interface and that's why nobody uses it anymore. It's like, well, don't they know they can go to the help menu and just type in the name of the thing they're looking for? And it's like, well, no, they don't. That, you know, we'll we'll stop everything they're trying to do right now and highlight the help menu and and force them to see it. And it's like, it's kind of a Yeah, it's a weird thing. And complexity is hard to deal with. [laughter] Y >> and so figuring out a way around it. But I think the scale of everything as far as like the amount of users that these companies are trying to maintain. It's no longer this minuscule AB test. It's like, okay, we're we're moving massive amounts of people back and forth and we have to like hold them. And they've studied gambling and they've studied all these different things to try to figure out how to maximize everything out of everything. And I just think I have never seen outcries as much about this. I mean, again, maybe I'm not looking at >> in our pocket [laughter] >> in our area, but it's just like generally like >> it's another area of like breaking point and just having this sort of like grace when I see something that is just like amazing and and or ser, you know, customer service is amazing, I will go out of my way to review it and and do that sort of stuff. But I'm I'm less to do it trigger happy right when you sent something to me. >> Yeah. >> You know, like I had a really good experience generally with the installation of my solar panels. And then I had a problem, you know, I'm like I don't know, four months in now >> and I'm like, "Okay, well, this is the time I'm finally going to actually like find out if they truly do customer service." Yeah. >> And so I call and I don't get a response. You know, like literally days go by and I figure it out myself. like my stupid system wasn't reporting. The micro inverters are not reporting to the main system and I'm like, "Okay, is that like kind of like its own little micro like Wi-Fi setup?" Then so I turn off its router and turn it back on and all reather and so I figured out how to do all that on my own and I fixed it, you know. But like I am guessing I I didn't get provided a manual for the micro inverters and all those kinds of things. I just know that yeah, you could turn it off and back on often and [laughter] hopefully read what the lights are telling me. But that was kind of a bummer as far as a service thing, you know, like, okay, well, that's like a star down from what I would have right rated them before. I I do wonder whether some of this is a shift in the bell curve, right? So again, like when we were coming up, the vast majority of the population was not comfortable with interfaces. >> Yeah. So we had to go out of our way to make sure that people who were not computer savvy could get an idea of how to use these things and things were trainable, right? So like I remember when I worked at the hospital, I was in my 20s. We got special dispensation from the unions to allow to leave games on the Windows boxes at the nurses stations cuz using a mouse was new to them and having solitire actually, you know, it gave them a little >> a little mental break, but it also gave them practice with the, you know, less of the fear about the computer. >> Well, that's completely shifted, right? The the the only generation left that didn't do this stuff are now in their 70s and 80s. All the design is happening from people who are in their 20s and 30s. They're not interacting with anybody that doesn't isn't comfortable with this. And so, you know, the idea that the three lines on top of each other means open menu is intuitive to them because they grew up with this. So, I do wonder whether there's been a a shift away. There's this just this assumption. I borrowed my nephew's phone a couple weeks back to try something and he's on Apple, I'm on Android. And he's like, "Well, swipe down and blah blah." And I'm like, "Okay." And I guess I swiped from the top instead of from the middle. And he thought this was hilarious because like, how do you not know how to do this? You've got degrees in computer engineering. I'm like, "I don't use your brand phone." And if you say swipe on my phone, I would do that from the top. Like, >> don't tell me it's intuitive. Right. So, I do wonder whether some of it is just because the people who are now in charge of designing these things no longer have to deal with people who didn't grow up with it and and are afraid of it. It's funny cuz you used the word bell curve a minute ago. I feel like our generation is unique for a lot of people. At least these are anecdotal things I hear where we were the ones teaching our parents how to set the VCR [laughter] so it didn't flash 12 anymore to you know using the web to you know all the different technology that was happening and what I hear I don't have any children but a lot of people that have kids that are our age range some of their kids are not interested in learning the technology at all. if they have a problem, they just hand it to their dad or mom or whatever. >> I don't, again, that's anecdotal, but like >> it just cracks me up. Are we gonna be the ones that were like, "We cared about interfaces, like, well, I just talk to everything now." And it's like, okay. [laughter] >> Yes. So, yeah. Anyway, [clears throat] it it's there is a hacker news uh thread that we'll attach to this that goes into some other typical hacker news like devolvement of stuff. But just to bring it full circle, there was one comment on hacker news that I thought that was kind of clever, which they were talking about the fact that you know the article starts with this analogy of your car's interface, right? >> And they basically went through and went, "Wait a second, he listed five things. My car does three of these. So it isn't just your phones and your apps. We're at the place where how do I turn my heater on? [laughter] >> Yeah. Yeah. I that that I I'm not a fan. Like I'd like physical controls for that stuff cuz >> Okay. You know, like [laughter] I'm just so uninterested in having a bricked car. >> Yeah. Well, there's there's starting to be backlash in the car design place at least and we're and we're seeing it increasingly that the buttons are coming back. So, at least we kind of woke up about that one. So, we'll see how it goes. >> Yeah, absolutely. All right. Well, that was fun. So, we got a few projects for us to dig into. And I've done this a couple times recently. I'm mentioning another timely project. This is titled cmd- chat. So, command chat. It's an encrypted terminal chat. No servers, no logs, RAM only. It's by the user Dior. They go by Dior Wave on GitHub. It's a peer-to-peer encrypted chat that runs in your terminal. You host it. You control it. Close the window. Everything's gone. Why? [laughter] Every secure messenger still stores metadata somewhere. This doesn't. It's just like two terminals talking over an encrypted tunnel. Nothing written to disk ever. The readme shows how it works. Using SRP authentication goes into that a little bit. Secure remote password. SRP. The password is never sent over the network. Both sides prove they know it via zero knowledge proof. Then derive identical session keys and then a couple flowcharts indicating how like end to end encrypted is set up along with how that SRP stuff is set up. It shows you how to install it. You're going to install it from GitHub. It's not on Pippi. Gives an example of how to use it and then starting the server and connecting. List of some extra features again RAM only RSA and AES key exchange and symmetric encryption. There's no central server so it's just direct peer-to-peer SRP O which we mentioned timely. The about box says my ISP tried to block this repo. A truly peer-to-peer endto-end encrypted CLI chat that leaves no logs. Perfect for dot dot dot sensitive discussions. Get it before it gets taken down. Anyway, so why I think it's interesting is not only is it timely and maybe you would have a use for a tool like this, but it's also all in Python and if you would like to learn more about creating peer-to-peer networks or encryption or encrypting a chat in particular, it uses a lot of modern technology and it's 100% Python, which is pretty cool. So, if you wanted to look at a project and how this is done, I think it's a cool one to research through. Speaking of feeling like an old man, I missed the days when crypto meant inc encryption, not banking fiascos. Anyways, >> that was the one joke that I laughed at in the new Naked Gun movie. They're poking fun at the crypto.com arena and they're calling it the Ponzi scheme arena. [laughter] You know, it's not even a smoking joke, but there was a couple of those where like, okay, I laugh at that. [laughter] It's fun to watch their uh virtual tulips uh slowly fade [laughter] in value as gold increases. Whatever. Who knows? This will come out in a week, so maybe things will change yet again. >> Yes, that's right. We'll all be wrong and they'll all be rich. Yes, that seems to be how it goes. >> Anyway, what's your project? >> My project this week is called Redress and it's by Joshua Sorl, who goes by Aonosus on GitHub. He even includes a handy little explanation of the Greek roots of his user handle on his page, but I'll let you look those up yourself. The libraries for dealing with retries. So that's redress as in remedy something, not redress as in my wife changing her outfit for the third time before going out. She doesn't listen. It's okay. Uh sometimes when coding something goes wrong, uh I mean doesn't listen to the podcast, but just to be clear. Uh sometimes when coding something goes wrong like a resource not being available, you may not want to bother the user with the information immediately. You want may want to try again. You can put the call in a little loop, but that gets painful if you have to do this a lot in your code. The approach that the redress library takes is it lets you define a failure handling policy. The policy includes things like retrying, circuit breakers, and other approaches. The retry itself can have rules that classify the kind of error. So for example, you could use different timeouts for different kinds of error codes and policies can be used as decorators or as context managers. So you can wrap a function or a code block and all of that gets that redress policy handling it. There are some handy little defaults. So for example, there's a retry decorator that uses the default error classifier and a retry limit of five times. So if all you need is the quick and dirty, it's there. I've mentioned tools like this a couple times before in the show, but this has got to be the most comprehensive one I've ever seen. If you need a complicated rule system to change your retry behavior, this library gives you a lot of choice about how to handle this situation. If you're dealing with remote machines or networking code or especially if you're writing for devices that are on unstable overtheair networks, redress really could be the answer you're looking for. Yeah, there's a lot of details there as far as like how you want this thing to operate, which I think is really cool. >> Well, yeah, there's a there's a lot of flexibility to to it. An awful lot of choice. Yeah. >> All right, Chris. Well, thanks for coming on the show again and sharing all these articles and projects this week. >> Cheers. [music] And don't forget, if you support [music] web apps in production, you don't need junk logs. You need intelligent logging with real-time [music] error alerts, automatic dduping, and actionable context. Honeybadger [music] filters out the noise and transforms your Python logs into contextrich issues so you could find and fix errors before your users notice. Sign up for your free developer account [music] at honeybadger.io. That's honeybadger.io. I want to say thanks [music] to Christopher Trudeau for coming on the show again this week and I want to thank you for [music] listening. If you like the episode, a great way to help us grow our audience is to share it with other Python users [music] who you think might enjoy it. You can also leave a rating or review on your podcast platform of choice. If you or your company [music] are interested in sponsoring the podcast, you can find all the information at [music] realpython.com/advertise. You can find show notes with [music] links to the topics we spoke about inside your podcast player or at realpython.com/mpodcast. And while you're there, you can leave us a question [music] or a topic idea. I've been your host, Christopher Bailey, and I look forward to talking to you soon.
Original Description
Would you like to learn how to work with LLMs locally on your own computer? How do you integrate your Python projects with a local model? Christopher Trudeau is back on the show this week with another batch of PyCoder's Weekly articles and projects.
👉 Links from the show: https://realpython.com/podcasts/rpp/284/
We cover a recent Real Python step-by-step tutorial on installing local LLMs with Ollama and connecting them to Python. It begins by outlining the advantages this strategy offers, including reducing costs, improving privacy, and enabling offline-capable AI-powered apps. We talk through the steps of setting things up, generating text and code, and calling tools.
We also share other articles and projects from the Python community, including the 2026 Python Developers Survey, creating callable instances with Python's `.__call__()`, creating maps and projections with GeoPandas, ending 15 years of `subprocess` polling, discussing backseat software, a retry library that classifies errors, and a peer-to-peer encrypted CLI chat project.
This episode is sponsored by Honeybadger.
Topics:
- 00:00:00 -- Introduction
- 00:02:37 -- Take the Python Developers Survey 2026
- 00:03:07 -- How to Integrate Local LLMs With Ollama and Python
- 00:08:15 -- Sponsor: Honeybadger
- 00:09:01 -- Create Callable Instances With Python's `.__call__()`
- 00:12:13 -- GeoPandas Basics: Maps, Projections, and Spatial Joins
- 00:16:03 -- Ending 15 Years of `subprocess` Polling
- 00:18:57 -- Video Course Spotlight
- 00:20:23 -- Backseat Software – Mike Swanson
- 00:39:06 -- cmd-chat: Peer-to-Peer Encrypted CLI Chat
- 00:41:58 -- redress: A Retry Library That Classifies Errors
- 00:43:56 -- Thanks and goodbye
👉 Links from the show: https://realpython.com/podcasts/rpp/284/
Download your free Python Cheat Sheet here: https://realpython.com/cheatsheet
Free Python Skill Test with instant level + learning plan: https://realpython.com/skill-test
Want to learn faster? Become a Python Expert w
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Real Python · Real Python · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A better Python REPL – bpython vs python interpreter
Real Python
Introducing large-type.com – A Utility Website
Real Python
Reading Hacker News Without Wasting Tons of Time
Real Python
Forward References and Python 3 Type Hints
Real Python
Using Sublime Text as your Git Editor
Real Python
Python Code Linting and Auto-Complete for Sublime Text
Real Python
Make your Python Code More Readable with Custom Exceptions
Real Python
Write Better Tests with Sublime Text's Split Layout Feature
Real Python
How to Use Sublime Text from the Command Line
Real Python
Rename Variables with Multiple Selection in Sublime Text
Real Python
Sublime Text Settings for Writing PEP 8 Python
Real Python
Write Cleaner Python with Sublime Text's Indent Guides
Real Python
Sublime Text Whitespace Settings for Python Development
Real Python
Function Argument Unpacking in Python
Real Python
Python Code Review: Debugging and Refactoring "Conway's Game of Life" + Automated Tests
Real Python
Using "get()" to Return a Default Value from a Python Dict
Real Python
A Python Shorthand for Swapping Two Variables
Real Python
Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Real Python
Click & Jump to Test Failures from the Command Line (iTerm2)
Real Python
Setting up Sublime Text for Python Developers
Real Python
Sublime Text + Python Guide Overview
Real Python
Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Real Python
Type-Checking Python Programs With Type Hints and mypy
Real Python
A Shorthand for Merging Dictionaries in Python 3.5+
Real Python
Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Real Python
My Python Code Looks Ugly and Confusing – Help!
Real Python
Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Real Python
Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Real Python
Programmer Portfolio – Example and Walkthrough
Real Python
How to Get Your 1st Speaking Gig at a Tech Conference
Real Python
How to Build Your Public Speaking Skills as a Developer
Real Python
The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
Real Python
Setting up Sublime Text for Python Developers – Lesson #1
Real Python
Cool New Features in Python 3.6
Real Python
"is" vs "==" in Python – What's the Difference? (And When to Use Each)
Real Python
Emulating switch/case Statements in Python with Dictionaries
Real Python
Python Function Argument Unpacking Tutorial (* and ** Operators)
Real Python
What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
Real Python
A Crazy Python Dictionary Expression ?!
Real Python
String Conversion in Python: When to Use __repr__ vs __str__
Real Python
Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Real Python
Optional Arguments in Python With *args and **kwargs
Real Python
Python Context Managers and the "with" Statement (__enter__ & __exit__)
Real Python
Installing Python Packages with pip and virtualenv / venv
Real Python
"For Each" Loops in Python with enumerate() and range()
Real Python
Python Code Review: LibreOffice Automation and the Python Standard Library
Real Python
Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Real Python
Python Tutorial: List Comprehensions Step-By-Step
Real Python
Leveraging Python's Implicit "return None" Statements
Real Python
What's the meaning of underscores (_ & __) in Python variable names?
Real Python
Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Real Python
Writing automated tests for Python command-line apps and scripts
Real Python
How to find great Python packages on PyPI, the Python Package Repository
Real Python
Immutable vs Mutable Objects in Python
Real Python
PyPI vs Warehouse, the Next-Generation Python Package Repository
Real Python
pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
Real Python
My Experience at PyCon 2017 in Portland
Real Python
Pylint Tutorial – How to Write Clean Python
Real Python
"Reverse a List in Python" Tutorial: Three Methods & How-to Demos
Real Python
Python Refactoring: "while True" Infinite Loops & The "input" Function
Real Python
More on: LLM Foundations
View skill →Related Reads
📰
📰
📰
📰
Optimizing RAG at Scale: Chunking, Retrieval, and the Bayesian Search That Cut Latency 40%
Dev.to AI
Building Production-Grade LLM Evaluation Pipelines: From Vibes to Metrics
Dev.to AI
How to Use Le Chat for Semantic Search Optimization in 2026
Dev.to · leosociall-seointent
Integrating Open-Weight LLMs via API: A Developer's Guide to Accessible AI
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI