Latest / Talk Python To Me / #508: Program Your Own Computer with Python
Transcript
- 0:00If you've heard the phrase, automate the boring things for Python, this episode starts with that idea and takes it to a whole nother level.
- 0:07We have Glyph back on the podcast to talk about programming your computer with Python.
- 0:12We dive into a bunch of tools and frameworks and especially spend some time on integrating with existing platform APIs.
- 0:19For example, macOS's browser kit in Windows, Calm object model, all of this to build desktop apps in Python that make you happier and more productive.
- 0:30Let's dive in. This is Talk Python To Me, episode 508, recorded May 6th, 2025.
- 0:37Are
- 0:37you ready for your host, please?
- 0:39You're listening to Michael Kennedy on Talk Python To Me.
- 0:42Live from Portland, Oregon, and this segment was made with Python.
- 0:49Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:52This is your host, Michael Kennedy.
- 0:54Follow 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 talkpython.fm/youtube and get notified about upcoming shows. This episode is sponsored by Posit and Posit Workbench.
- 1:23Posit Workbench allows data scientists to code in Python within their preferred environment without any additional strain on IT.
- 1:31It gives data scientists access to all the development environments they love, including Jupyter Notebooks, JupyterLab, Positron, and VS Code, and helps ensure reproducibility and consistency.
- 1:40If you work on a data science team where consistency matters, check out Posit Workbench.
- 1:45Visit talkpython.fm/workbench for details.
- 1:48And it's brought to you by Agency.
- 1:51Discover agentic AI with agency. Their layer lets agents find, connect, and work together, any stack, anywhere. Start building the internet of agents at talkpython.fm/agency, spelled A-G-N-T-C-Y. Bliff, welcome back to Talk Python To Me. Great to have you here.
- 2:07It's great to be back.
- 2:08Yes, indeed. We are going to bring it home for everyone. Personal computing right on their computer. Like we're going to program like it's 1997, but better.
- 2:18It's weird how you say that, and I totally know what you mean, but also, believe it or not, computers are way better than they were in 1997.
- 2:27Better than my Pentium? Are you serious?
- 2:30Not only are they better, there's just a lot more of them in front of you in a much smaller space.
- 2:34Yeah, I have a ridiculous number of computers in my office. It's almost out of control.
- 2:39What do you do with the old ones? You turn them into servers. Come on. Home servers.
- 2:42That's a topic for a different day.
- 2:44Yeah, it sure is. I'm super excited to talk about programming a computer. We're going to talk a little bit of Mac, a little bit of Linux, a little bit of Windows, and more broadly, other things. Most of it with Python, not 100% necessarily, but almost all of it. And it's going to be a great time. Now, before we dive into it, though, I'm sure there's some folks out there like, Cliff, that's the guy that just is so unique. He gets to go by a single name. How awesome is that? But who is he anyway? Who are you?
- 3:10Who
- 3:10am I? That's a good question. I've had a varied and eclectic career, I guess.
- 3:15Right now, I am an independent software developer. I do some consulting here and there. I do a bunch of open source development. I've got a Patreon for my own independent stuff. I'm sure we'll get into some of it because some of it is directly relevant to today's topic. I'm doing some Mac desktop app development. I've got some secret projects, which I hope that I will eventually actually finish and release.
- 3:38It's awesome you're here to announce those today.
- 3:41Unfortunately, I don't think we're going to be making any news just now.
- 3:45Yeah, so I do, and I do a bunch of open source project development.
- 3:48So my own Patreon and my own GitHub sponsors is mostly about kind of different stuff that I'm doing.
- 3:55And this talk that we're going to be discussing today that I did give a couple of years back, and I'm giving a refreshed version of at the upcoming PyCon, I did release a couple of packages when I first gave it, and that's the kind of stuff that I do with my personal backing that folks sign up for.
- 4:14But I'm also doing, I suppose I should say for any new listeners, I am the founder of the Twisted project, kind of precursor to AsyncIO in the standard library.
- 4:27And nowadays, now that AsyncIO is kind of standard in the standard library, it's a collection of protocol implementations and testing tools and whatnot for event-driven programming.
- 4:37And that is a member project of the PSF, which has its own GitHub sponsors.
- 4:42And I also am going to be doing some contract development to do maintenance on that.
- 4:48So we can actually make use of some of the funding that we've collected over the years, do some more fundraising.
- 4:52Just a couple hours ago, I was doing our first party WebSockets integration.
- 4:58So I do a lot of different things, is what I'm saying.
- 5:00It's just got a lot going on.
- 5:01That's awesome.
- 5:02I love it.
- 5:03How does one get their project to become a member project of the PSF?
- 5:07Technically speaking, Twisted is a, the PSF is the Twisted Project's fiscal sponsor.
- 5:13We got there via the circuitous route of really not wanting to make a nonprofit 501c3 25 years ago.
- 5:22And in the course of trying to avoid that, we signed up with the Software Freedom Conservancy.
- 5:28The SFC and Twisted weren't quite aligned because Twisted was like a really liberally licensed project that was mostly focused on infrastructure.
- 5:37And we were not particularly interested in like the free software movement-y aspects of things.
- 5:44And the SFC was largely about like GPL license enforcement, creating like a consistent legal environment under which the free software movement can operate.
- 5:53Make sure people copy left everything, that sort of thing.
- 5:56Let's try to get everybody to copy left everything, although they do do a little bit of that.
- 6:00And I'm sure they would certainly prefer it, but more about like enforcing it once you have.
- 6:03Yeah,
- 6:04that's what I mean.
- 6:04They have a
- 6:05number of projects like Inkscape.
- 6:06And I believe they, well, they do work with a bunch of different projects to kind of litigate and try to, you know, get people to obey the GPL.
- 6:15and so since we had a little bit of a you know differing goals and the psf is more interested in like promoting python as infrastructure we moved over our fiscal sponsorship to to the psf so mostly i think you know the way that you do it is you just ask but the psf is taking on a lot right now so you may be you may be in a long queue if you were to try to sign up now
- 6:36i'm sure it's a hard process and they filter a lot of stuff out that doesn't really fit obey the gpl i feel like that's a good conference shirt or maybe a hat.
- 6:46You know what I mean?
- 6:47Once again, a topic for a different day.
- 6:49I have enough feelings on that to fill a couple hours.
- 6:52Well, moving right along then.
- 6:54I first became aware of your talk sitting in the sunshine in San Francisco at PyBay two years ago, I suppose, coming up a year and a half, something like that, when you gave a variation of this talk, programming your computer with Python.
- 7:08That was a great talk.
- 7:09That's one of my favorites from the conference.
- 7:10Then I saw you're giving it again at PyCon.
- 7:13And so I thought, you know, you're still into this stuff.
- 7:15Let's talk about some more about it.
- 7:16What really inspired this talk in the first place, and it's pretty much, it's like as relevant now, I think, as it was back when I first thought to give it, was just like, Python is really popular in a bunch of different contexts.
- 7:31But particularly at PyBay, right?
- 7:32Like there's different audiences.
- 7:34And PyBay and PyCon, I think, have a kind of similar audience in that you get a lot of people doing the typical stuff with Python, which is to say backend development and web development.
- 7:44A
- 7:44lot of APIs, a lot of AIs, a lot of Jupyter.
- 7:46Jupyter
- 7:46is like starting to edge a little bit closer to what I'm talking about here, but it is still fundamentally kind of backend-y, like you kind of expect the code to run on a big cluster or something, and there's just not a ton of local compute, right?
- 8:03Like your typical data scientist is doing kind of batch stuff.
- 8:07It's not, Jupyter has little, and Jupyter is in a way like a microcosm of Python itself, in that there are interactive widgets in Jupyter.
- 8:15You could be programming stuff kind of quasi locally, right?
- 8:19Like you could be interacting with your own file system.
- 8:22You could be building stuff that you can directly manipulate the data, but like you probably aren't.
- 8:27You probably just, you know, loading up some data frames and, you know, some NumPy arrays or whatever, and then doing a bunch of batch computations on them.
- 8:35And so we build all these skills that about just generalized software development, like most of the skills that you build while working on Python do generalize. And then we kind of staple those general skills to this very specific, like a couple of very specific use cases when Python is like a super general tool.
- 8:54And there exist all these libraries and all these tools to help you put Python in all kinds of places to solve all kinds of problems.
- 9:01And then when we need to do like we solve some other problem, we end up just picking some other tool.
- 9:06And this is in a way, right?
- 9:08We're talking about this one talk that I've put together.
- 9:12I've delivered a few times and we'll be delivering again.
- 9:15But there's kind of a through line through a lot of my public speaking and a lot of the topics that I've covered that are different aspects of this.
- 9:22Right. We've got there's this one, which is like programming your own local computer.
- 9:25But there's also desktop development and there's also mobile development.
- 9:29And I've talked about front end. I gave a presentation.
- 9:32I don't even know when maybe PyCon 2009 or something about like using.
- 9:36But before there was PyScript, there was Pyjamas, right?
- 9:40PyJS, these like front end frameworks where you could build whole front ends with Python in the browser.
- 9:45And like, you know, because there's Python's the second best language for everything.
- 9:50That's really, really powerful.
- 9:52It's kind of better than being the best language for something.
- 9:55Because the best language for making a Mac app is Swift, right?
- 9:59Like you just get the first party thing from Apple and it's a really easy onboarding experience.
- 10:03But the problem with that is that it's the best language for Mac app development.
- 10:07So everything else is like a second class citizen in the Swift world.
- 10:11Or a complete foreigner where it doesn't work at all.
- 10:14I
- 10:14do say a second class citizen because there is a Swift backend ecosystem and you can kind of use it for that stuff.
- 10:19and there is a bunch of open source work, but it's very clearly deprioritized.
- 10:24Even as Apple itself invests resources into it, it's just clearly never going to be the thing because they have a strategic vision.
- 10:30They're all about moving miles and miles of capacitive touchscreen glass.
- 10:34And if you're not in the critical path of doing that, then fundamentally the market is just not going to prioritize that.
- 10:40Even within the Apple ecosystem, the Mac desktop is deprioritized compared to iOS.
- 10:46The
- 10:46Mac is doing very, very well right now, right?
- 10:49It's not a dire situation, but you can still tell.
- 10:53There's still hints there about how that kind of financial destiny shapes things.
- 10:58And in the Python world, people just kind of do stuff.
- 11:01And we don't have a roadmap or a set of priorities.
- 11:05There are certainly economic pressures.
- 11:07AI is certainly distorting the landscape a little bit right now in terms of what gets interest and hype.
- 11:13But if you're doing something cool with Python, like Blender has Python in it, And you can just use that.
- 11:20And it's been there for years and years.
- 11:21It's not going anywhere, right?
- 11:22Like it's not getting deprioritized.
- 11:24The people who put Python into Blender and do stuff with that have their reasons for doing it.
- 11:29And they're going to keep doing it.
- 11:31There's no email they're going to get from an executive that says, ah, never mind, you know, Python really needs to focus on AI now.
- 11:40So Blender's an LLM today, right?
- 11:41Like, no, they have their own stuff that they're working
- 11:43on.
- 11:43You probably get it to render the words LLM, but that's not what they mean.
- 11:48All that said, Python being the second best language for everything means that if you're going to do a desktop thing with Python, you still have access to all of those libraries and all those tools that you could bring with you.
- 11:59If you're going to do desktop automations in Python instead of like AppleScript, you've got all the libraries that come from the world of Python that allow you to have access to all of this power, all that expertise that you've built up over the course of your career doing back end stuff or data analysis that you can then just do on your own computer.
- 12:18And so there's a few aspects to this, which are there's like the kind of personal automation stuff.
- 12:24There's the user interface stuff.
- 12:25So yeah, so how would you like to approach this?
- 12:28What would you like to talk about?
- 12:29Let's start with riffing a bit on why local computing matters or maybe why it shouldn't be as overlooked as it is.
- 12:38I
- 12:38talked a lot about the library ecosystem and all these different tools and functionalities, whatever.
- 12:42But bring it back down to fundamentals.
- 12:45Your computer is probably really, really fast.
- 12:48Even if you don't have the best top-of-the-line machine, and a lot of us as developers do have a lot of privilege to have access to extremely powerful hardware, Like a laptop that you can get right now for kind of a middle of the road, affordable laptop price is like hundreds of times more powerful than the most powerful server from a couple of decades ago.
- 13:09Right. Like there's you have so much power at your fingertips.
- 13:12And not only that, but there's a latency issue, too.
- 13:15Right. Like even if your computer weren't that powerful, even a few years ago when computers didn't have as much CPU and as much RAM.
- 13:22And, you know, there's kind of a slope that goes upwards over time where there's always more of those things.
- 13:26So like anytime you go backwards a few years, you'll have less of it.
- 13:29But there's persistently throughout the history of computing, you pretty much always get better latency if you're doing something locally.
- 13:38And so if you are trying to, you know, get something done and you're, if you have a workflow that you're executing many, many times a day and you want to get it done quickly, your local computer is probably faster than any remote server you have access to just to like get the task kicked off, get all the data resident.
- 13:58I have an eight core server for all the infrastructure at Talk Python with the eight core, 16 gigs or something like that. It's plenty. I'm pretty sure my M4 Mac mini on a single core operation is faster than it. It's
- 14:10interesting how you phrase that, right? Like you don't even know, right? You're not even sure how much compute you have locally because you're not, you're not stressing it, right? Like you're not using it up. Not to mention the fact that those Talk Python infrastructure, you know, running the most popular podcast in the Python space. I'm sure that it's all very heavily loaded, right? There's stuff happening to it all the time. Every time you post anything on the Fediverse, it's got to be fetched, you know, a hundred million times or whatever the hug of death is these days.
- 14:37It's like a DDoS that you do to yourself every time you post something.
- 14:40You have all of your local compute is also, in addition to being probably way more powerful than you initially would give it credit for, because you think of it as like a desktop or a mobile device as opposed to like a really powerful computer. In addition to being super low latency, it's also probably just idle all the time, right? Like it's not doing anything. And if you're plugged in and you're at a desk, right? Like if you're not literally mobile on battery all the time, that's free real estate, right? Like you can just use it for whatever you need. You got lots of RAM, you got lots of disk, you got lots of CPU overhead. To some extent, this is also kind of my secret motivation for doing this. Over the years in the industry, and you can kind of see this with that push towards iOS and iPads and mobile devices and web front ends. There's always this push for the industry as overall to say, maybe you don't need so much power locally. Maybe we should take that away and put it in the cloud. Wouldn't it be more convenient if it was all in the cloud?
- 15:33And there's no nefarious individual or group that's doing this, but it's just a constant economic pressure. And my personal feeling is like, no, no, give it to me. You put all the compute locally.
- 15:43I want to have it. I don't know what you're doing with it. I don't want it multi-tenanted in the cloud where I have like fewer security guarantees and fewer privacy guarantees and if I want things to be fast I have to like move them away to be like less secure I want it to be local so I want people to do things that require it to be local and so I want to encourage them
- 16:01and I'm with you and there's a lot of interesting technologies these days that make that possible from local LLMs to Docker to a bunch of things this portion of talk Python to Me is brought to you by the folks at Posit Posit has made a huge investment in the Python community lately, known originally for RStudio, they've been building down a suite of tools and services for Team Python. Have you ever thought of all the things that go into a Python data science project? You need your notebook or IDE, sure. Also a server or cloud environment to run it, a version of Python, packages, access to your databases, and internal APIs. That's a lot of setup.
- 16:41And if you change any of these things, when you return to your projects a month down the road, you might get different results. Wouldn't it be nice to have all of this set up for you in one easy to access place whenever you want to get work done? That's the goal of Posit Workbench.
- 16:56Posit Workbench allows data scientists to code in Python within their preferred environment without an additional strain on IT. It gives data scientists access to all the development environments they love, including Jupyter Notebooks, JupyterLab, Positron, and VS Code.
- 17:11and yet it helps ensure reproducibility.
- 17:14Here's how it works.
- 17:15You or your IT team set up Posit Workbench on a powerful, dedicated server within your organization or on the same cloud service that is hosting your most important data sources, such as AWS, SageMaker, Azure, GCP, Kubernetes, or pretty much anywhere.
- 17:31There, you create dedicated, pre-configured environments to run your code and notebooks.
- 17:35And importantly, you also configure access to proprietary databases and internal APIs.
- 17:41When it's time to onboard a new data scientist or start a new project, you just fire it up in Workbench and it's fully configured and ready to go, including on the infrastructure side of things.
- 17:50All of this is securely administered by your organization.
- 17:54If you work on a data science team where consistency matters, you owe it to you and your org to check out Posit Workbench.
- 18:00Visit talkpython.fm/workbench today and get a three-month free trial to see if it's a good fit.
- 18:06That's talkpython.fm/workbench.
- 18:08The link is in your podcast player's show notes.
- 18:11thank you deposit for supporting talk python to me i don't know how you feel about it it sounds like we might be on the same page to me it's also a bit of agency just i don't want the only place that my code can run is on a bespoke cloud from one of the hyperscalers i want to be able to at maximum complexity say docker compose up and then run my code at more likely just run my code there's
- 18:34a scaling issue there too if you try to make sure that you can run we'll get to like uis and interactivity in a bit, but even if you're just running your backend batch code, if you can run your full deployed cloud-based web application on your local computer, and you can have an equivalent environment that you can bring up with Docker Compose or whatever, or I forget what the tiny Kubernetes is, the K some number.
- 19:04Kube control.
- 19:04There's also like a, there's K7S, I think.
- 19:08There's some tool that like, you know, scales everything down for you.
- 19:11If you can run it on your laptop, then you can run it on an alternate host, right?
- 19:16Like speaking now, now kind of stepping out of my weird hippie activist, individual activism frame of reference and into my, I'm actually a consultant that does business for, you know, corporations kind of role.
- 19:28They're actually pretty aligned value wise, because you, if the only place that you can run your cloud application is in a hyperscaler's cloud, then you have no price pressure driving the competitive landscape in a way that benefits you as the application developer. I won't say a brand name, but your cloud provider will ratchet up your costs and then you'll just have to pay more costs.
- 19:56There's no way that you have any leverage against them to say, well, because you can't credibly say, I'll move somewhere else because moving somewhere else becomes this huge migration cost.
- 20:04Now, there's limits to that, right?
- 20:06Like there are applications that you really can't run just fully on a laptop.
- 20:10But like there's a way larger proportion of our listeners today who can totally just do that than think they can, right?
- 20:19Like there are most applications can actually just run on a laptop.
- 20:23I don't know what number you'd put on it.
- 20:24I would say it's got to at least be 95%.
- 20:27It's
- 20:27tough to put like a number on it like that, but it is also the kind of thing where if it's not 95%, there's also like a lot of the ones that really can't because they're architected around like cloud native or, you know, branded technologies that have like these very specific APIs.
- 20:42It's not clear to me that that's bringing a lot of benefits in a lot of cases, right?
- 20:45Like, you know, having it, especially because like whenever you're running something locally, you also have, especially if you can like make sure that it's easy to be portable, right?
- 20:55Like, and you can run it locally on your Mac, locally on your, in WSL, right?
- 21:00Not just in Docker, but like kind of in the same environment that your dev tools live.
- 21:04If you can maintain that level of portability, the increase in operational costs that you have when you have to go and do complicated stuff to get the reliability and the elasticity that your cloud provider might give you, you actually get a huge amount in just like, you can run a debugger on it.
- 21:22You can single step through the code.
- 21:24The ability
- 21:25to do that is really overlooked.
- 21:27And that's not to denigrate debugging and production, using tools like Honeycomb that can give you traces and help you really understand what's happening at scale.
- 21:37There's a lot of logical abstractions which you don't need to scale up to understand what's going on with them.
- 21:41And single-stepping and debugging and being able to run in a kind of in-vitro environment is really, really a useful feature that it doesn't seem like you're giving up anything, but you are when you don't have that ability to run it locally.
- 21:54Absolutely. And if you can run it locally or in Docker, the chances that you can just say, you know what, I don't want to be in this cloud anymore. Some new opportunities opened up. Hetzner has a new local data center. DigitalOcean has something amazing and it's a fifth the price and just as fast or faster. Let's just move. You know what I mean? And if it's, well, we move our dockers and docker containers and our little system just goes over. That's one thing. If you got to rework serverless and queuing and all, like all of a sudden it's like, yeah, yeah, but no.
- 22:23You
- 22:23can still make use of technologies like serverless, right?
- 22:26Like if you develop all your code as if it's a library that you're just like, and most of your logic is in kind of a neutral form factor where you can use it from a desktop app or a Docker container or a serverless container.
- 22:39That's the, I like, it may not be worth investing that much in making that possible if that's not really your core competency and you don't need it, but it's not worth nothing.
- 22:49And it's worth investing a little bit.
- 22:50And often one of the points that I try to make in the talk is it's not actually that hard.
- 22:57It seems really, really challenging.
- 22:59But a lot of the times it's just because the desktop tools and the local development tools are not quite as well documented.
- 23:07It's not as easy to Google for something and get immediate result for an error message just because not as many people are using them.
- 23:15So there's a collective action thing here.
- 23:17It's a call to action to get more folks involved in doing things locally because it makes the whole process easier for everybody else.
- 23:24I 100% agree.
- 23:25Before we jump too far from this whole server aspect you were talking about, are you familiar with Coolify?
- 23:30I am not.
- 23:31This is the first I'm hearing of it.
- 23:32This is a pretty interesting open source project that is basically, I'll use their H2, an open source and self-hostable Heroku Netlify Vercel alternative.
- 23:43So basically it's like some kind of Docker compose up sort of thing, but then it gives you the platform to git push into and host all your things, kind of like those places I named.
- 23:53Oh, I might have to check that out.
- 23:54Yeah, it looks pretty interesting.
- 23:56And, you know, if you're thinking, well, we have more requirements, we got like we need continuous deployment and all these things.
- 24:02Like look around.
- 24:03I think there's a lot of interesting options.
- 24:05And then this could go on EC2 or it could go on Hetzner or it could go on DigitalOcean or Linode or whatever, right?
- 24:09There's a lot of interesting options here.
- 24:11Just
- 24:11one more thing on the whole local compute power part of this, which is that, because all of these alternatives that they're talking about have famously had drama with their free tiers and with the amount of compute that you get.
- 24:23One of the other things, one of the examples I bring up in the talk is Twisted's test suite and just how much faster it can be if you run it locally.
- 24:32And this is particularly of interest to the open source part of the Python community.
- 24:36And the reason I'm raising it here is because free tiers are one of the places that you see this, right?
- 24:43Like if you actually go all in in a kind of server-first workflow and you have a for-profit company and you're developing software that you have customers for, the local compute power argument does start to fall apart a little bit because it's like, well, you really can get like very, very powerful servers that can run your CI really, really fast.
- 25:02But also you're not getting those for free in the GitHub Actions tier that open source projects have access to.
- 25:08And particularly if you need to test on macOS and Windows, you're going to be paying for that.
- 25:14If you are trying to subsist on free resources, you will often find they're very slow and heavily contended with a lot of other projects.
- 25:23And so having the ability to run your tests locally to decrease the pressure on your free tier trial test host or your free tier GitHub Actions or CircleCI or whatever, The difference in speed there is huge because you're like way, way over provisioned in your local compute. And these providers who would really like you to pay a pretty penny for like the really fast stuff, a lot of us just like open source projects for logistical reasons often have to, even if the project does have some resources, we still need to stay in the like free tier of these things.
- 25:59because like if your, you know, library has a big budget for CI, but all of your downstreams that are actually using it have to use the GitHub Actions free tier, you really want to be living there anyway, even if you could afford to live elsewhere.
- 26:12Right. Otherwise it gets out of sync and things don't work. So yeah. Yeah. Cool. All right. Well, let's talk, let's talk desktop apps a bit. So give us some of the benefits of desktop first development. I mean, hotkeys, notifications, What else?
- 26:26Those
- 26:26are the big ones.
- 26:28And there are, well, okay.
- 26:30And there are other things.
- 26:32Hotkeys, notifications, sounds.
- 26:34Geolocation.
- 26:35Geolocation, HUD overlays, right?
- 26:37The ability to like put a window onto the screen.
- 26:41The fact that you can do all of those things, right?
- 26:43Like the presence of any one of those features, the ability to like pop up a window or whatever, like many of these things can kind of be emulated in web apps, right?
- 26:53The browser is a really powerful deployment platform these days.
- 26:56But the way that you develop something, if it is running locally, like case in point.
- 27:02So there's this app that I'm developing called Pomodoro Boros, which I'm running right now.
- 27:09It is a Pomodoro timer, and it puts a big old HUD overlay over your whole screen so that you do not get distracted.
- 27:15Because I have ADHD, and if it's not in my visual field, it might as well not exist.
- 27:20And so an app like that, not only can it remain running in the background, which like if you quit your browser, you close browser tab, it can go away.
- 27:30And there's like no, you can summon it back if you intentionally want to.
- 27:34If you as the user remember to relaunch that tab and repin it and put it in the right place and everything, like you can do it.
- 27:42But first of all, speaking as a person of ADHD, I don't want to be doing that all the time.
- 27:46And I physically can't sometimes.
- 27:48But also just like even for, you know, neurotypical people with plenty of executive function, that's the computer's job.
- 27:54Like the computer's job is to remember to run stuff, right?
- 27:57Like, and you can have the app relaunch itself.
- 28:00It can launch it login, right?
- 28:02Like having a browser launch it login is a whole rigmarole.
- 28:04It's like not impossible, but it requires lots of weird little hacks and it tends to be kind of fragile.
- 28:11Whereas, you know, you can make an app that doesn't have a command Q or like Alt F4 quit, right?
- 28:17Like you can have it go into the background and run by itself.
- 28:20It can schedule cron jobs.
- 28:22It can just generally keep itself running and automating away in such a way that if it needs to grab your attention again via a notification, via a geolocation hook, right?
- 28:33Like you can not just do geolocation to geofence yourself, but also to like schedule your app to launch when crossing a geolocation fence.
- 28:42That's a little trickier, but like it is definitely a thing you can do.
- 28:45all of those things make it so that you can have code that runs when it needs to run and that you can interact with immediately right like you can have a cloud service like send you a push notification and like or a text message or whatever and try to remind you that you should do something but with a desktop app with something that's running locally even if it's running locally in your terminal right like one of the other things that i i have um i have a different app called PinPal, which is all about helping you memorize new passwords.
- 29:17PinPal can actually run, I'm working on the desktop app version, but the other thing it can do is you just set it up in your PS1 so that if it's time to rehearse your passwords, it puts a little badge in your command prompt.
- 29:29And so even if you're not going for the full high-touch desktop API integration, just the fact that it's running in my local shell on every time it displays the prompt, that allows it to be like much more present and something that I'm not going to forget.
- 29:46And certainly for things that involve my development workflow, I'm not going to forget something that can be sensitive to what my working directory is, right?
- 29:54Like it can activate things and deactivate things and make it so that like anything that I need to do, the local computation has already happened, right?
- 30:01Like it's already done by the time I as the user am thinking that I need it.
- 30:06This portion of Talk Python To Me is brought to you by Agency.
- 30:09The agency, spelled A-G-N-T-C-Y, is an open source collective building the internet of agents.
- 30:16We're all very familiar with AI and LLMs these days, but if you have not yet experienced the massive leap that agentic AI brings, you're in for a treat. Agentic AI takes LLMs from the world's smartest search engines to truly collaborative software. That's where agency comes in. Agency is a collaboration layer where AI agents can discover, connect, and work across frameworks. For developers, this means standardized agent discovery tools, seamless protocols for interagent communication, and modular components to compose and scale multi-agent workflows. Agency allows AI agents to discover each other and work together regardless of how they're built, who built them, or where they run. And they just announced several key updates, including interoperability with Anthropics, Model Context Protocol, MCP, a new observability data schema enriched with concepts specific to multi-agent systems, as well as new extensions to the OpenAgentic Schema Framework, OASF.
- 31:18So are you ready to build the internet of agents? Get started with agency and join Crew AI, LangChain, Llama Index, BrowserBase, Cisco, and dozens more. Visit talkpython.fm/agency to get started today. That's talkpython.fm/agency. The link is in your podcast player's show notes and on the episode page. Thank you to the agency for supporting Talk Python To Me. And you can probably do automation accessibility things. Like you could have it run on a schedule or something when you're in your email or something like that. Like, hey, you're in your email. Remember that these two things need to be done now, but not, you know, not hassle you at seven or 8 a.m. or whenever you said to hassle you, but like when you're already doing the thing, right?
- 32:00That's another thing you can do. I'm not even sure if I mentioned this one in the talk, but there are two things that the word notifications means in the macOS world, at least. There's a UN user notification center, which is where you send notifications to the user. But there's also notifications, which are, or NS notification center, which is like, just stuff is happening on the computer. Is your battery empty, like past a certain threshold?
- 32:26Like you said, you're in your email, right?
- 32:29You can ask the operating system, not just what's the front most window, but tell me when the front most window changes, right?
- 32:35Like, send me an event.
- 32:37And there are different operating systems.
- 32:41Unfortunately, a lot of this kind of breaks down on Windows because Windows is, and
- 32:45I say
- 32:45this as unbiasedly as I can, kind of a misery.
- 32:48Like there's so many just terrible APIs on Windows.
- 32:51Everything's possible, but nothing is easy.
- 32:53And so, unfortunately, some of the talk that can very quickly show these rapid examples on Mac and Linux is like, and then on Windows, here's this 900-page book that was published 20 years ago.
- 33:03It's probably the way you have to go learn how to do it.
- 33:06Calm in particular is really a challenge.
- 33:07Let
- 33:07me introduce you to the Win32 API and D column, and you're going to have a good time.
- 33:12You
- 33:12keep thinking like, oh, didn't they get rid of all that when they upgraded to the WinRT API?
- 33:19It's like, nope, Windows is a sedimentary operating system.
- 33:23There's just
- 33:23layers, one on top of another.
- 33:27Layers are formed.
- 33:28They are not removed.
- 33:29I don't want this to be like a trash-talking Windows thing because there's definitely ways to do a lot of this on Windows too.
- 33:33There's message pumps that you can get from like, you open an HWIN in a foreign executable and you can kind of tell what it's doing.
- 33:41Yeah,
- 33:41you can hook into some interesting things there to like track other applications and so on.
- 33:46You know, just to, I don't know if this will appease folks or not, to put a good word out there for Windows.
- 33:53You know, you won't program your own stuff.
- 33:54Like VB6 and some of these rapid GUI tools were ridiculous back in the day, even though they're not, I'm sure you could still build with them.
- 34:02They're just like, I need a button here, a text box there.
- 34:04And when I click this, I need that to become a web browser.
- 34:07Click,
- 34:07you know, and that's like two, two, three minutes and you're good to go.
- 34:10Honestly, a lot of the stuff that is good about the Windows API, you end up kind of going through that portal back in time where you're like, how would I have done this in VB6?
- 34:19And then you like, and unfortunately, as I'm not a heavy Windows user, one of the problems is that like the really good automation targets for Windows are frequently the things like Excel and Word.
- 34:33And I don't have Excel or Word.
- 34:35I got Steam and, you know, Windows Mail and a couple of, you know, open source applications in my Windows install.
- 34:41But if you have, you know, there's also things like Excel wings and like, you know, people who are like heavy Windows users who have more concrete automation use cases for doing things locally.
- 34:51There are a ton of ways that you can get really deep into a really rich API in a lot of the Microsoft first party applications.
- 34:58Which again, this is one of those places where they're kind of like they're pushing people to kind of the web based Office 365 stuff.
- 35:04And like they still have a big investment local desktop platform.
- 35:08But a lot of people are kind of not using it as much.
- 35:11If you get in there and you build a lot of workflows around that desktop stuff, Microsoft will notice.
- 35:16They will want to support you in doing that.
- 35:18And so, yeah, there are lots of tools there for getting what you need to do done.
- 35:24The problem with Windows is really it's not as generalized.
- 35:27Everything has its own API on Windows.
- 35:29So you have to, on the Mac, I can tell you, there's a general way you can learn about an application.
- 35:34And many applications have kind of a half-hearted implementation of it.
- 35:36On Windows, it's much harder for a talk like mine to go and give a cursory level of like, hey, look at this Wonderland.
- 35:44You can kind of get into lots of different things.
- 35:46And here's some brief examples.
- 35:47It's more like, no, no, on Windows, you have to kind of know what you want to do.
- 35:49Once you know and you're willing to dig in really hard on a specific automation target, there's lots there, but it may be somewhat different from system to system.
- 35:59Yeah, I haven't tried it, but a lot of the stuff that you would reach out and interact with for that stuff is in the com bunch of com objects component object model which are tremendously hard to build and get right but once they're there you can i think you can use them pretty easily you can probably use that from python pretty easily and then just look at the documentation for that thing this
- 36:18is the tricky thing this is one of the things i'm enhancing for the next iteration of the talk is that is i dug in a little deeper on those tools there's a tool called called olay view which is an ancient tool if you bring that up and you start digging around in your local system, you can find a lot of these APIs. Win32.com is the, like, from PyWin32, gives you direct access to all that legacy stuff. And this is actually a kind of a great way of illustrating the Python's the second best language for everything. You know, like, older, if you're doing stuff with C# these days, like the modern Microsoft tool chain, they push you really hard towards WinRT and, like, the new way of doing things. And it's really difficult to get into the older, you know, com stuff because they're like, ah, that's deprecated.
- 37:03It's not really, you know, it's not something you're using with.NET.
- 37:06Like, you know, forget about that.
- 37:07Whereas in Python, you can pip install WinRT, pip install PyWin32 right next to each other and be calling both different kinds of APIs.
- 37:16And it's, you know, perfectly easy.
- 37:17Yeah, yeah.
- 37:18Again,
- 37:19because nobody's setting out a roadmap for the Python community.
- 37:21You know, those, and this is kind of what the, why I like giving talks about stuff like this.
- 37:26If you're going to a conference and taking a tutorial, you could learn a whole new thing.
- 37:30You can do a ton of learning in a three-hour tutorial.
- 37:35If you're going to a conference talk, you're getting the...
- 37:39Also, okay, can folks see this screen on the live stream, by the way?
- 37:42On the live stream, they can't, not on the recording.
- 37:44I do have to mention that Michael just brought up the Pi Win 32 page, and there are three maintainers, and the top one is me.
- 37:52Because as much as I'm not a Windows guy, I'm on that list, actually, because when at the advent of binary wheels, I was the one who kind of went in and said, like, PyWin32 has got to have, like, downloadable wheels for every version of Python.
- 38:06I built my own, like, fork of it because I couldn't get access for a while called PyPIWin32.
- 38:11It was just, like, no code changes, just it's built and it has a bunch of hacks to get the paths right so that you could just import it without, like, changing your Windows path or manually opening DLLs.
- 38:22So, yeah.
- 38:22So I've been doing this for a long time.
- 38:24That definitely does this calm stuff.
- 38:26as well. So that's super cool. The
- 38:28reason that I like giving talks about stuff like this is that you can give these pointers out to things where people have been toiling away, building all of this stuff for you in Python for years and years. There's PyWid32. There's Py, I think it's called, is it? Now I'm forgetting which one's the current one, but there's WinRT, the WinRT module on PyPI.
- 38:50There's the Python D-Bus. There's like all of these different tools that people have built integrations for your desktop and your operating system and they're almost all like pretty recently maintained pyg object right like if you want to build new applications with the native toolkit for gnome pyobjc maybe yep pyobjective c and the pyobjective c is also a great example of like there are if you go if you search pypi for pyobjc dash framework you will find a zillion frameworks that are like all the things that have been wrapped so
- 39:28that... Did I search the right thing?
- 39:30Pi OBJC? Pi
- 39:31OBJC.
- 39:32Yeah, you dropped
- 39:34the C.
- 39:34Autonomous driving.
- 39:37If you add a C to the end of the search, you will...
- 39:40Yeah, and if you scroll down, there's like a ton of... Pi
- 39:43OBJC core, mass shortcut, CF network. These are the accounts, these are the important subsystems of macOS, for example, right?
- 39:52Right, and there are...
- 39:54Dozens and dozens of them, right?
- 39:56Yeah, like just scroll and scroll and scroll.
- 39:58We're only to the Bs now.
- 40:01Go with the 14 pages, let's go.
- 40:02There's
- 40:02tons and tons of stuff, like this whole universe that's available to you in Python.
- 40:07And this is why this is like a kind of a, as much as we were talking about very generalized, like, oh, you know, local compute is really powerful and everything, like there's a general aspect to this, but there's a really Python specific aspect to this, which is there's all these libraries and tools that were not just developed as a proof of concept, but are consistently maintained and used pretty heavily in some niche areas where people really are using them in production, but they're not really talking about them all that much because they don't think they're of interest to the broader community.
- 40:40They're not getting out there as much.
- 40:42Nobody's excited about Browser Engine Kit, which is just that thing built into macOS.
- 40:46And then, oh, I'm talking to it from Python.
- 40:48Oh, okay, good for you.
- 40:50It's not like I invented a new async web framework or anything, right?
- 40:52Or
- 40:53like here's my new system for integrating AI, you know, LLMs with cloud image generation and, you know, to defraud parking attendants or whatever the most recent, you know, hot startup is.
- 41:08Or super high scale, you know, numerical computing or GP, it's not even called GP, GPU anymore.
- 41:16It's just like parallel compute.
- 41:19Not all these things make great individualized demos, but the infrastructure, there is a rich soil for you to plant all kinds of different applications in.
- 41:31And actually, this is something that I have not brought up in the talk, but that is something that I would love to kind of get out there as an idea, which is I said like some of these tools, you use them, you get these weird error messages, and you kind of get stuck.
- 41:44And a lot of people get stuck and bounce off attempting to use desktop stuff or local compute stuff because it's not as popular, so there's not as many resources, so people can't easily figure out how to use them.
- 41:57But quite often it's worth doing that little extra bit of work to dig in and figure out what the problem is.
- 42:04Because as frustrating and confusing as it can be to kind of trace through a traceback in somebody else's library that was like supposed to work and just isn't for some reason, doing that debugging and maybe contributing a little bit upstream to some open source thing that's a wrapper for the thing that you want to use is often not nearly as hard as like, oh, well, there's a really good Rust library for this.
- 42:23Let me just switch the whole project over to Rust.
- 42:26They're like, oh, this is really a Unity thing that I'm trying to do, so I'll just report all of my code to C#.
- 42:33It's straightforward because there's tutorials for how to do that, and you don't have to go off by yourself to do this investigation.
- 42:41But it ends up being a lot harder in many cases to go into a completely new ecosystem, redo all of the work that you've had to do, understanding the problem domain, debugging, getting some high quality code to do whatever your primary thing is just to access some new like binding to some library that is available somewhere else.
- 43:02Yeah, those are definitely fraught with the danger.
- 43:05I don't know if you've heard the big rewrite by Dylan Beatty, but I'll put it in the show notes.
- 43:11It's a To the American Pie parody, which is like a six minute song.
- 43:15And he goes through all the generations of rewriting.
- 43:17It's incredible.
- 43:19So just I'll put that as a warning to folks.
- 43:21I haven't heard it, but I've
- 43:22experienced it.
- 43:23Yeah.
- 43:23Then this song will connect with.
- 43:24You know, one of the things when I'm looking at this PyPI listing here, it seems to me that as you're venturing out into these new areas that you're not super experienced with, like I know to do Python, but Objective-C, like didn't even macOS stop doing that?
- 43:40I thought they did Swift, right?
- 43:42There's still routes down to the same stuff, I'm pretty sure.
- 43:45But you could go to your favorite chat coding assistant and say, how would I accomplish this thing accomplish in straight Swift.
- 43:55It can give you the answers using some of these APIs.
- 43:58And then you can say, now imagine there's a compatibility layer, rewrite it in Python.
- 44:02I bet you would be pretty darn close, right?
- 44:04As opposed to if you ask how to do it in Python, it might just go
- 44:07haywire,
- 44:07make up some crazy wrapper, right?
- 44:10This is a place, so I personally have had just a series, like I am an, I guess, an AI skeptic.
- 44:16One of my, the most popular articles on my blog is the grand unified theory of the AI hype cycle.
- 44:23and there are i have concerns about the you know the energy use and the training data provenance the copyright issues and all kinds of you know social stuff like that but fundamentally i am trying to educate myself about these technologies i am trying to use them and like learn what they're good at i see some folks like simon willison having great success
- 44:42yeah he's leading the way for sure stuff
- 44:44and i try to do some of this stuff and they just face plant for me really hard all the time. I have never had an LLM successfully do something that I want to do, possibly because the stuff that the LLMs are good at, I can do in my sleep. And so I just like, I've already typed all the code the LLM would type for me faster than it could get it out.
- 45:04And then I hit a problem like, oh, how do I do a business chat integration on macOS with, you know, PyOpC framework business chat. And it has no idea because there's no example code. It LLM is really good at doing a particular kind of thing with code.
- 45:23Like if you're getting a lot of really solid, like quick, accurate, correct implementations, that probably means that there's just a ton of open source code that already does what you need.
- 45:36Right.
- 45:36And libraries and examples.
- 45:37Yeah.
- 45:38Right.
- 45:38You'd probably be better off just using a library that did that.
- 45:41And not to say that there's no cases where it can integrate two things, but it can integrate two things that are already kind of speaking the same language that are largely in the same area of the token vector space in the model, right?
- 45:53Like there's overlap between the way that these things are expressed and being off the beaten path with some of these libraries that are less frequently used and that do require you to like know the Objective-C API, know the C# API, know the translation rule, and then express the thing in terms of the translation rule.
- 46:14Like, yeah, it can be really, like you're definitely much better off in terms of both if you're using LLMs, using LLMs.
- 46:20But also, even if you're just looking for reference material, learn the translation rules because they're often quite simple.
- 46:26And then look for the example in the other language, even if you don't know the other language.
- 46:31Like, I don't really know Objective-C.
- 46:33I don't really, like, I mean, I know C and I, like, can kind of read it.
- 46:37There's not actually all that much to Objective-C.
- 46:39I definitely don't know C#.
- 46:41And I've gone from, and C# definitely has some syntax.
- 46:44Like, there's at signs and square brackets all over the place.
- 46:47Yeah, a lot of symbols.
- 46:47I
- 46:48don't really know what this means, but it is nevertheless pretty straightforward to look up an example.
- 46:53Because most of the examples for demos of doing the thing that you need to do with an API are going to be a flat sequence of method calls.
- 47:03Or just do this, then do this, then do this, then do this.
- 47:05And you're like, okay, well, I know it's dash greater, greater question mark for some reason.
- 47:10I don't know why they're doing that, but that's the symbol in this language.
- 47:13But I know that when I see that, that means I have to use two pairs of parentheses in Python or whatever.
- 47:20That is a made-up example from a fake language, but there are lots of very straightforward translation rules.
- 47:24And just as an example, there's pyobjective-c uses the objective-c runtime, which Swift also has its own stuff that isn't necessarily always exposed to this.
- 47:34But the core of the frameworks is all exposed via the objective-c runtime to Swift in the same way that it's exposed to Python.
- 47:41If you look at a method name, there's a rule, you replace all the colons with underscores, and then that's kind of the method name that you would use.
- 47:49Rubicon, which is a different Objective-C bridge that works on iOS, has a similar set of rules.
- 47:54They're not exactly the same, but once you know what they are, you can just apply them over and over again.
- 48:00And if you can find an example of the C version, you can work out the Python version for yourself pretty straightforwardly.
- 48:08Yeah, and I agree with you about the farther afield you go, the harder it gets, which is why I imagine like you try to get it to do it in the one language and you try to get it to help you convert that quick.
- 48:18You know what I mean?
- 48:19It's going to have a better chance than some super niche thing, I imagine.
- 48:22Although
- 48:22ironically, there, well, and, you know, in the PyJC docs, you get the same kind of like click on this tab for Python, this tab for Objective-C as you get in Apple's official docs where it's click on this tab for Objective-C, this tab for Swift.
- 48:35It's a similar type of translation.
- 48:36That's pretty handy, yeah.
- 48:37But
- 48:37when you have one of the things, so like at first it seems like, oh, this must be such a pain in Python.
- 48:44You're constantly having to jump back and forth and do all this mental translation.
- 48:47And while that is true, there's also the fact that if you're like writing a Swift app, like I've done relatively little of this type of development.
- 48:55But like I have run through the kind of like Swift tutorials and whatnot.
- 48:58So I understand I use Xcode.
- 49:00I've done a bunch of stuff with code signing and like reverse engineering how to do that.
- 49:04sometimes involves watching what Xcode would do and then trying to figure out what happened.
- 49:08So I have done the kind of happy path version. And the thing is, you don't get a REPL with Objective-C or with Swift or C#, right? And the fact that you can, even though you do have to do this tedious translation sometimes for these types of APIs, it's almost the same thing as like, if you're just doing regular web development and you're reading a JSON API and the SDK is in JavaScript, right? You don't typically think of that as being like a laborious, difficult translation step. You just look at the JavaScript and if the JavaScript is not telling you what you need, you go and you just look at the HTTP underlying it, right? Like, and you know how to parse JSON and you know how to deal with HTTP resources. And it's the same kind of mental translation. This is a pretty straightforward thing that programmers do all the time without even thinking about it. And one of the things that makes Python a lovely language to do that, if you're working in a web context, is you, Python-M async.io or you run Python as a REPL and you just start fiddling around with some example data. You load it up and you start calling the APIs. And for a lot of these APIs, the difficulty of the extra translation step, the absence of a specific tutorial, is easily eclipsed and then some from the fact that you can do all of this development kind of iteratively and interactively in not necessarily even just a REPL, but also like a Jupyter Notebook.
- 50:32Like a lot of these things, open up a Jupyter Notebook, start calling the APIs that you need to call, you know, record the output, have a look at what the OS is telling you.
- 50:40There are exceptions to that.
- 50:42In particular, in like, if you're doing like full-on desktop app development, sometimes you get into these weird places where like you really need like an app bundle on the Mac or you need like some registry keys set on Windows that point at a particular executable.
- 50:55And so you do sometimes get into these places where like, okay, you kind of need to participate as if you're, living in the native developer ecosystem.
- 51:02But even then, you can write yourself a little, you know, like write a Jupyter kernel that like you can connect to that just has that little stub executable on the side or has the app bundle that you can connect to.
- 51:15And because there's lots of ways to programmatically create a REPL in Python, or even just if you don't even want to get that fancy, just a text field that'll eval some Python to interactively discover whatever it is that you need to learn about the API.
- 51:29So you got a lot of powerful tools.
- 51:32But again, once you've kind of determined like, okay, I'm just going to use Python for this.
- 51:36I have this problem that I want to solve locally on my computer.
- 51:39You can bring all of, you have to kind of bridge these gaps to do some things that would be a little bit easier if you were using the native tools.
- 51:48But what you get for paying that cost is you get to bring all of your Python tools along with you and do all of this cool stuff that you already know how to do.
- 51:55And on top of talking about the different ways to check it out, We've got really nice IDEs, right?
- 52:01Especially PyCharm and VS Code and 100 variants of that thing.
- 52:06You have really nice debuggers to go through and understand stuff on top of it.
- 52:10And sometimes you do in other places, but sometimes you don't.
- 52:13And maybe they cost money and you don't have that thing.
- 52:16And
- 52:16that process of having to learn a whole new debugger and a whole new way of getting your code to run, not to mention learning a new programming language, that's a big cost.
- 52:27And it may not feel like it Again, it's straightforward.
- 52:30It doesn't involve a lot of hard thinking to do all those tutorials.
- 52:34But it does mean that, you know, you don't get to bring your superpowers with you.
- 52:37Well, there's also a Node.js type of argument to make.
- 52:40And that is, if you can write your desktop app in Python, and it happens to be talking to services you own, you can keep it in the same language.
- 52:49Maybe not the same frameworks, because you're talking NS object sort of deals.
- 52:53But still, it's closer to one unified programming language.
- 52:57And
- 52:57you can do it as much as makes sense, right?
- 52:59Like you can have your, maybe it makes sense to use Positron, right?
- 53:05Which is the Beware browser-based tool.
- 53:09It's like Electron, but it uses Python instead of like the Chromium electron shell.
- 53:17And so what that means is that you can say, well, I'm going to write like a Django app and I'm going to do everything kind of a plain vanilla backend way.
- 53:24But I want this one thing from a local desktop app.
- 53:27and so I'll write it mostly that way and then I'll use Positron and now I've got all the power of Python in addition to all the power of the web stuff that I was using and you can move that seamlessly from the back end to the local compute as you need it it's really that agility, that portability of you're not going to tell me where I can run my code that's the spirit that I would like to inculcate in anybody who hears this talk Because like, if you can run Python anywhere, nobody can tell you no.
- 54:02I'm trying to think of the conference hat or t-shirt slogan for that one.
- 54:06We're going to put down our Obey the GPO.
- 54:08I'm going to put that one on.
- 54:09Let's take just a couple of moments and talk about maybe three quick libraries that we could use.
- 54:15And then I want to talk about LLMs actually just a little bit.
- 54:18But let's talk about NotifyPy and then your two projects, QuickMac Hotkey and QuickMac App.
- 54:24I'm not as familiar with Notify.py.
- 54:27I've played with it a tiny bit.
- 54:30I actually recently added, because macOS has some weird restrictions on the way notifications work, I actually just added a bunch of stuff to QuickMac app relatively recently to do notifications there.
- 54:43But yeah, Notify.py, if what you need is a background notification, Notify.py is a much better place to start.
- 54:48Yeah,
- 54:48so it looks like a pretty simple API.
- 54:50I haven't really done much with it either.
- 54:51The one that I've used, which I had on the screen for a minute, but we never got to it is Rump's ridiculously uncomplicated macOS Python status bar apps that just live.
- 55:00I've got one running right up in the status bar of my app right now.
- 55:03And I love it.
- 55:03Cool.
- 55:04What does it do?
- 55:04I find myself very often having to take things like, you know, over on Talk Python or for course recordings or whatever, like I have to take this title, developer trends in 2025 or whatever it is, and then turn it into kind of this, the slug that you might have up here, like lowercase, no symbol.
- 55:24Something could be a file or a URL or something like that.
- 55:27So it does a bunch of operations around that.
- 55:28Like it'll, whatever is in the clipboard, it'll trim it, lowercase it, uppercase it, turn it to this slug type thing, or even make it pastable into Excel if it comes out of HTML, stuff like that.
- 55:38That is exactly the kind of thing, like you just rattled off like nine different things that you need to do.
- 55:43And it's such a simple thing.
- 55:45I'm sure you did it probably a thousand times.
- 55:48Oh, yeah.
- 55:50It's so brutal to type it out.
- 55:51And I'm like, oh, are you serious again?
- 55:53You put that little status bar app in there and it just takes a whole element of pain out of your day.
- 55:59Absolutely.
- 55:59It uses rumps and it uses Piperclip and that's it.
- 56:03And it's, but it's, it's not that advanced what it does.
- 56:05I mean, some of them are literally one line return, string lower, string upper, string trim, but it's so good.
- 56:11And you get to express it in a language you already know, right?
- 56:14Like string lower, string upper, string trim, string, you know, title case, whatever.
- 56:17Like there's so many things you can do in Python that are just one method that you just already know how to do, so it seems trivial.
- 56:23But the number of keystrokes and motions on your keyboard and mouse movements to replicate that incredibly simple thing is like a lot, especially if you're doing it all the time.
- 56:31So yeah, I guess Rumps would be a competitor to QuickMac app, probably.
- 56:35It's really, really limited.
- 56:36I think yours is more capable.
- 56:38It's good if that's what you want, but you cannot ask much of it.
- 56:42I mean.
- 56:42One of the things that I'm doing, this is kind of veering off into a different talk and like other stuff that I'm doing, but I have also been trying really hard to do more of this stuff for real in a way to ship to other users.
- 56:54This talk is more, what I'm going to be talking about at PyCon is more about doing exactly the kind of thing that you just said, like solving problems for yourself, using your local compute resources for you.
- 57:05But I am simultaneously trying to productionize this stuff to provide examples of like, and you can take it further.
- 57:12And because there are examples out there, like Dropbox was a Python app for 15
- 57:15years.
- 57:16And so clearly, if you want to, you can make pretty successful Python desktop apps.
- 57:22But there are so few examples, and they're so far between, and they're so specialized that nobody's talking about the Python-ness of Dropbox.
- 57:33That's not like a
- 57:33talking point.
- 57:34You may have the only desktop talk at PyCon, for example.
- 57:38Not true.
- 57:39But the one other that I'm sure is there is Russell, who's in the slot right against me.
- 57:44That one time, I guess, is the desktop time.
- 57:48But there is so much code out there.
- 57:51I maintain hardly any of these libraries.
- 57:53I have my two things, which are wrappers around other things that already exist.
- 57:58All my stuff is higher level.
- 58:00And I think you've probably used the phrase dark matter developers in the past.
- 58:04Yes, I haven't thought about that for a while.
- 58:06But yes, I love that phrase so much.
- 58:08One
- 58:08kind of dark matter developer are just the folks doing kind of workaday stuff in banks that don't go to, and insurance companies are not blogging or tweeting or xing or whatever about it, right?
- 58:19They're just doing a job with some code and we never hear from them.
- 58:22And they're like most Python programmers.
- 58:24Case in point, right?
- 58:25Like most of them use Windows.
- 58:27But there's another version of that, which is like, there's a huge part of the open source community that's maintaining all kinds of packages to do all kinds of esoteric things with Python that we also don't, that aren't like plugged into the core development ecosystem that we don't necessarily see at conferences.
- 58:41And those folks who are doing more specialized open source infrastructure deserve more celebration.
- 58:48And desktop apps or desktop integrations are one part of that.
- 58:51But there's lots of other signal processing things and other esoteric areas that not everybody needs.
- 58:58And so they just have less of an audience.
- 59:01But again, the fact that Python is the second best language for everything means that anytime you need to do two things at once, it's the best language.
- 59:08And it's all those second tier folks that are out there doing the specialized libraries.
- 59:13Like the generalized libraries, the, you know, Django's and Flasks and SQL alchemies of the world, like that stuff is super important.
- 59:22And the language would absolutely not be what it is without that.
- 59:25But we're all kind of aware of that stuff.
- 59:27And it's that second tier that really makes Python like turbocharged powerful.
- 59:31Right. You come to it in your little weird space of the world.
- 59:34They already have libraries for that.
- 59:36And we've all got something like that, right?
- 59:38Like no matter what industry you work in, you're using some set of libraries for doing that stuff.
- 59:42Even if you're working in like mass market social media or whatever, you're still probably using some cluster management tools or something that like not everybody is using.
- 59:51That is that type of more specialized open source that's like still super important.
- 59:56Let me riff on one more thing here real quick and see what you think about this.
- 59:58So I'll tell you about an app that I wrote last week.
- 1:00:01I think it was last week.
- 1:00:02It must have been the beginning of last week.
- 1:00:04It's been a little while.
- 1:00:05is I want a program that when I'm working in a project in a Git repository, I can ask an LLM, do a better job than Michael's four words to summarize the commit I'm about to make to Git.
- 1:00:20I want to say updated dependencies or more error checking, right?
- 1:00:25But not what I did, why I did it, right?
- 1:00:28I should do better, but I find in real life I don't.
- 1:00:31And so I said, well, okay, what can I do?
- 1:00:33well, I'm going to use this thing called LM Studio, which is cool because it lets you download stuff from Hugging Face, like most of the models that you know about, the llamas and the mistrals and so on, right?
- 1:00:44But it also, the second tab that looks like a terminal, it runs a OpenAI compatible server on your local machine.
- 1:00:53I have my Mac Mini that has the most RAM.
- 1:00:55I just leave it running there.
- 1:00:57And then anywhere on my local network, I can just use it to run code against.
- 1:01:01And so I wrote maybe 100 lines of code that'll go through a git diff, take all those pieces, put a good prompt in front of it and send it over there and then get it back in a structured way that has like a title, but then a description below it.
- 1:01:13If you go into detail, like GitHub supports and so on and cost nothing.
- 1:01:18It doesn't really hurt the environment very much because it's just running for like four seconds on my local machine.
- 1:01:23And my iStats menu says it uses seven watts for four seconds, which is like a LED light bulb for four seconds.
- 1:01:30It's not nothing, but it's not melting the earth level of GPU usage.
- 1:01:34You know what I mean?
- 1:01:35So, and it's also local, so it's not sharing your data, right?
- 1:01:38So I think that this, for people who are like, I want to build something local, but it kind of needs an LLM.
- 1:01:43I think this is a pretty neat thing.
- 1:01:44Whatever models you have installed, if you ask for them, it'll load them up and just answer your question with it.
- 1:01:48It's pretty neat.
- 1:01:49I do feel like there's still a pretty big, like one of the things that has stopped me from doing more stuff like that is really the, and this is really frustrating, attempting to like search around on Hug and Face, Because I feel like there are no what Simon termed vegan models that I can find.
- 1:02:05The ones that are like all the data was collected consensually.
- 1:02:10But if we could square that circle, and I think some people are working on that.
- 1:02:16Again, like you said, seven watts for a few seconds.
- 1:02:20That level of power utilization, not only is it less, but also you can know if you're, for example, I've got solar.
- 1:02:27And so I know when it's basically free in terms of environmental impact.
- 1:02:32Yeah.
- 1:02:32And
- 1:02:33I can run it at those times.
- 1:02:35There's also the fact that if we could square the training data problem, you get the privacy concerns because it's not actually...
- 1:02:43A lot of the privacy concerns with LLMs are just, it's a server.
- 1:02:46Nothing to do with LLMs, right?
- 1:02:48You're giving this data to another place and who knows.
- 1:02:52You are giving it to Sam Altman, personally.
- 1:02:54You can do what he wants with it.
- 1:02:56The other part that's bad about LLMs is they could turn around and be turned into training data, which then gets turned as a result.
- 1:03:03Not just they have it, but it might become the way that the thing speaks to others, which is even worse.
- 1:03:08By doing local compute, you still have to worry about the training data.
- 1:03:11You still have to worry a little bit about the environmental usage, but you can keep your own eye on it.
- 1:03:15You can measure it and decide whether it's useful.
- 1:03:20You're probably doing transparency effects on your desktop.
- 1:03:24Yeah, just give people a sense.
- 1:03:25Right now I'm doing a live stream.
- 1:03:27So I'm doing screen sharing and you and I are talking and it's running at 17 watts on my Mac Mini.
- 1:03:33So yeah, it's pretty mellow.
- 1:03:35I think this solves two of the three problems, Glyph.
- 1:03:37I think it solves or avoids pretty much the environmental effect, at least from running the questions, not training the models in the first place.
- 1:03:45And it solves the privacy.
- 1:03:47It certainly doesn't address what I generally consider to be more or less copyright theft that these things constitute.
- 1:03:54but they already exist.
- 1:03:55And you're saying like, I dislike that.
- 1:03:58It's not going to make it go away.
- 1:03:59It just means you're somewhat disadvantaged, which is a tough place to be, I think, honestly.
- 1:04:04Another thing that I find LLMs often teach us this interesting lesson and this local models can actually make it clearer because they're worse, like because they're quantized down to be less powerful.
- 1:04:16You can see this a little bit more, which is like that generating the commit message thing.
- 1:04:20Like if that is being useful to you, than no shade or anything.
- 1:04:24I think that's definitely better than just typing TK, TK, TK or whatever, which is probably what I'd do.
- 1:04:30Just the letter A.
- 1:04:32But it does also kind of highlight, well, the thing you really want to do in a commit message is you really want to say why, not what.
- 1:04:39Because the what, the thing that the LLM can extract from the summary is always the less interesting thing.
- 1:04:46And so quite often when you're asking an LLM to do something, that's a good hint that the interesting part is somewhere else.
- 1:04:52and so it's useful to take a step back and on the commit message thing just say like why am I doing this?
- 1:04:58Yes, absolutely.
- 1:04:59So you know if I don't use the result when I ask the question it might at least remind me what I did with great detail so I can write a better message.
- 1:05:08Sometimes it goes because we were no longer checking for the user possibly not being logged in which would have caused a crash I'm like dang, it figured that out.
- 1:05:17Brilliant, that's the commit message you know what I mean?
- 1:05:19But it's still, it's an interesting tool in the toolbox And being local, I think it counts as part of this story.
- 1:05:25So I just thought I'd throw that out there because I've had a lot of success with that lately.
- 1:05:28If we do figure out the training data thing, which again, there are people working on that, we will still need the local compute part of the story to have like a fully, like if we solve the training data thing and somebody does like a good fully consensual, like everybody's on board with the training data model, and then it's just running remotely and it's still a cloud service and you're still sending all your training data to it.
- 1:05:47But like, well, so yeah, so having that, the power to run these things locally and leverage the power of local compute.
- 1:05:53And as you said, right, like hook it in with an automation that you wrote again in Python, it having that agency and that power at your fingertips is super useful and a super important part of the puzzle, not just for like, like, and a lot of the complaints about LLMs are really just complaints about like automation and some of the problems with the computing industry and the internet more broadly and bringing your compute local and taking full control over and responsibility for it can really address a lot of those problems.
- 1:06:23And I think it's something that we need to be thinking about all the time, right?
- 1:06:26In the same way that when you're talking about, you know, a lot of the stuff we started off talking about with cloud compute, right?
- 1:06:31Like, do you need to have, you know, all this, these esoteric services?
- 1:06:35Do you need to have so many resources deployed if you're not even getting particularly good latency?
- 1:06:40Could it
- 1:06:40just
- 1:06:41be in Funk Tools LRU cache decorator instead of a whole other service, right?
- 1:06:45Could you just do it locally?
- 1:06:46Could you do it radically more simply?
- 1:06:48What if it was just a Python module?
- 1:06:51Could you just make it a Python module?
- 1:06:53And there's so many places, not everywhere, but there are so many places where the answer to that is yes, it could.
- 1:06:58And in those cases where you can answer yes, you
- 1:07:00should totally do it.
- 1:07:01Well, very inspiring talk.
- 1:07:03I will give a two-part call to action at the end of this, maybe three.
- 1:07:09One, if you catch this on the YouTube live stream, go see Glyph's talk at PyCon.
- 1:07:14That'd be great.
- 1:07:15If you listen to this in the recorded version, edited and shipped to the podcast players, PyCon will be in the rearview mirror.
- 1:07:21So look for the recording of his talk coming down to PyCon.
- 1:07:25Or worst case scenario, check out the PyBay one.
- 1:07:28What do you want to add?
- 1:07:28People want to program their own computers.
- 1:07:29You've been very inspirational.
- 1:07:31They should follow me, glyph at mastodon.social, where I'm constantly talking about programming my own computer and all of the misery that comes along with it. And I also do some streaming.
- 1:07:40You mean character
- 1:07:41building?
- 1:07:42Yes, yes. Character building. Learning. We're all, we're learning and growing. That's what we're doing. And yeah, I've got a couple of libraries. You mentioned QuickMac Hotkey, QuickMac App.
- 1:07:52I've got a tool called Encrust, which is for code signing Mac
- 1:07:55applications.
- 1:07:56That is not to be underestimated. That is a huge roadblock to going from programming my computer to programming other people's computer.
- 1:08:03I am using it in real life.
- 1:08:06Speaking of, you know, we were talking earlier about people who like other folks in niche areas who are doing things with Python that you may not hear about as much.
- 1:08:14One of my favorite things about Incrust is that Just Van Rossum uses it to ship some kind of app that has something to do, I'm pretty sure, with fonts.
- 1:08:23That's about as much as I know about it.
- 1:08:25But he is like actually shipping an app to users and I am using Incrust to ship a couple different apps.
- 1:08:31They're still kind of alpha quality, but they're the sort of alpha quality that does like, and Crust also nowadays not only does the Mac App Store, or no, sorry, not Mac App Store.
- 1:08:40So it still has yet to do the App Store stuff.
- 1:08:42It does Mac notarization and it does code signing, but it also does Sparkle, which if you're not
- 1:08:48familiar.
- 1:08:48Oh, yeah.
- 1:08:49This app has an update.
- 1:08:50Would you like to install it?
- 1:08:51Click enter to restart and install.
- 1:08:52It
- 1:08:52will generate and publish those.
- 1:08:55Like it integrates the tooling to set that up for you.
- 1:08:58And I did all the testing to make sure that you can ship an actual Python app and it installs properly and all that stuff.
- 1:09:04And crusty, you don't say.
- 1:09:05Sounds very cool.
- 1:09:06Okay.
- 1:09:06I've
- 1:09:06been very Mac focused lately just because that's the platform that I use, but there's stuff in the works for Linux for some of those apps as well.
- 1:09:14So yeah, I will hopefully have more to say and make it easier for folks to publish on their platform of choice.
- 1:09:22But as much as I would love to point people at the one great project, once again, it kind of depends what you want to do.
- 1:09:28You got to find that weird niche in the Python world, weird niche in the world that you care about the most, and then find the folks making it happen in Python because there's probably at least a few of them.
- 1:09:40Get together, upgrade some of these tools, get them totally working.
- 1:09:42Yep.
- 1:09:43Then encrust your apps and ship them out.
- 1:09:44Please do.
- 1:09:45And let me know if there are bugs because there almost certainly are.
- 1:09:47Thanks for being here as always.
- 1:09:48Awesome to have you back.
- 1:09:49Thank you so much for having me.
- 1:09:50Bye.
- 1:09:51This has been another episode of Talk Python To Me.
- 1:09:54Thank you to our sponsors.
- 1:09:56Be sure to check out what they're offering.
- 1:09:57It really helps support the show.
- 1:09:59This episode is sponsored by Posit and Posit Workbench.
- 1:10:03Posit Workbench allows data scientists to code in Python within their preferred environment without any additional strain on IT.
- 1:10:11It gives data scientists access to all the development environments they love, including Jupyter Notebooks, JupyterLab, Positron, and VS Code, and helps ensure reproducibility and consistency.
- 1:10:21If you work on a data science team where consistency matters, check out Posit Workbench, Visit talkpython.fm/workbench for details.
- 1:10:29And it's brought to you by Agency.
- 1:10:31Discover agentic AI with Agency.
- 1:10:34Their layer lets agents find, connect, and work together, any stack, anywhere.
- 1:10:38Start building the internet of agents at talkpython.fm/agency, spelled A-G-N-T-C-Y.
- 1:10:45Want to level up your Python?
- 1:10:47We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:10:51Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:10:56And best of all, there's not a subscription in sight.
- 1:10:58Check it out for yourself at training.talkpython.fm.
- 1:11:02Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
- 1:11:06We should be right at the top.
- 1:11:08You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
- 1:11:17We're live streaming most of our recordings these days.
- 1:11:20If 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.
- 1:11:28This is your host, Michael Kennedy.
- 1:11:30Thanks so much for listening.
- 1:11:31I really appreciate it.
- 1:11:32Now get out there and write some Python code.