Podcast Lookup

#505 Introducing diskcache-oxide

Python Bytes

  • November 17, 2026
  • 40 min
  • Episode 505
Episode page
About this episodeTopics covered in this episode: tinyjobs: a SQLite job queue goes free-threaded funkycache: cache Python functions in SQLite Ghostman - a…
Topics covered in this episode:
Watch on YouTube

About the show

Sponsored by LongLink: pythonbytes.fm/longlink

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesday at 7am PT. Older video versions available there too.

Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it.

Michael #1: tinyjobs: a SQLite job queue goes free-threaded

tinyjobs is a Python job queue and cron scheduler that starts with a SQLite file and no dependencies. Switch the URL to Postgres or Redis without rewriting tasks. It runs async tasks natively, embeds workers in FastAPI, and plugs into Django 6's tasks framework. The creator's free-threading audit found four races hidden by the GIL.

  • Background jobs without deploying a broker, plus a concrete case study in what removing the GIL exposes.
  • The creator reports races in the task registry, codec cache, cross-thread flag and thread pool. hiredis can re-enable the GIL; the worker warns when it detects that.
  • On 3.14t, --loops N runs event loops in separate threads. The author's laptop benchmark hit 42,000 async jobs/s with eight loops and two Redis instances, close to eight processes. SQLite rejects loops above one.
  • Clock-skew lesson: two hosts 20 minutes apart duplicated 492 of 3,000 jobs on 0.7.0. Using Redis server time fixed that test, not the general exactly-once problem.
  • Author's SQLite measurements: about 572 jobs/s end-to-end; a 20,000-job burst drained in four seconds. Synthetic workloads and different harnesses, not interchangeable throughput claims.
  • At-least-once delivery still requires idempotent tasks. Python 3.12+; young project, with the README now listing v0.11.0 versus the email's v0.9.0. Docker setup:
services: web: build: . command: uvicorn main:api --host 0.0.0.0 volumes: [jobs:/data] worker: build: . command: tinyjobs worker --app tasks:app --shutdown-timeout 25 stop_grace_period: 40s volumes: [jobs:/data] volumes: jobs: external: true

Calvin #2: funkycache: cache Python functions in SQLite

  • Alex Chan's functools.cache-style decorator stores results in SQLite, so they survive after the process exits. He built it to speed up his static site build.
  • It's released on PyPI: funkycache 1.0.4, from November 15. The first release, 1.0.0, came out November 7. It needs Python 3.14+ and depends on pydantic and xxhash.
  • Usage: cache = FunkyCache(storage="sqlite"), then @cache.register(files=[...], values=[...]). A cache entry is invalidated when the function's source file changes or when any listed file or value changes, such as a library version.
  • Return values go through Pydantic's TypeAdapter, based on the return type hint, so it only works on typed code.
  • Generators get special handling. functools.cache hands every caller the same generator object. funkycache saves the output as a list and gives each caller a fresh iterator, up to a soft memory limit.
  • Cache keys are JSON hashed with XXH64. They're deliberately lossy, and that's fine because nothing reads the original arguments back out of a key.
  • The design notes are a good segment on their own: the author had used MD5 because they "conflated weak with fast," and in their limited testing JSON was faster than pickle and easier to debug.
  • With a warm cache the site builds in about half a second, and the library is only a few hundred lines including tests. It doesn't watch files on purpose, to stay small.

Calvin #3: Ghostman - a keyboard-driven terminal API client

  • A local-first Postman alternative that runs in the terminal, with no cloud account required. It's MIT licensed and was featured in PyCoder's Weekly #760.
  • It's released on PyPI: pip install ghostman, then run ghostman. The current version is 0.1.8, from November 3. The first release, 0.1.0, came out October 31. It needs Python 3.10+.
  • It's built on Textual, httpx and Rich, so it's pure Python under the hood.
  • It sends GET, POST, PUT, DELETE and PATCH requests, shows DNS and time-to-first-byte timing live, and colors JSON responses automatically.
  • A built-in webhook inspector: Ctrl+W starts a listener on port 9090. Captured payloads show headers and timestamps, and you can load one straight into the request editor.
  • Collections are plain JSON/YAML files you can commit to Git. The README gives two different folders for them (.ghostman/ and ~/.ghostman/).
  • It's fully keyboard-driven: Ctrl+S sends, Ctrl+K saves, Ctrl+N starts a new request, Ctrl+Q quits.
  • The author claims about 30MB of RAM and a cold start of about 150ms; I haven't checked either number. It's a young project, with 158 stars and 15 commits.

Michael #4: diskcache-oxide: A shared, durable disk cache

Michael's diskcache-oxide is a Rust-backed, SQLite-based cache for Python workers sharing one directory on the same machine. Entries survive process restarts without running a cache server. It keeps the familiar diskcache API, adds fork and free-threading safety, and uses msgpack or JSON by default instead of pickle.

  • Michael's item: a shared cache for multi-worker apps without deploying Redis or keeping a separate dict warm in every process.
  • Cache, FanoutCache sharding and transactions are available now. NullCache switches caching off without changing call sites; Caches manages named caches for an app.
  • Author's bench/gate.py, Linux container on Apple Silicon, CPython 3.14, 99:1 reads/writes: about 750k ops/s with one thread and 723k with eight; diskcache 5.6.3 falls to 44k. Not independently tested here.
  • Free-threading support is explicit: the Rust extension declares gil_used = false. A process-wide fork barrier protects SQLite state when workers fork.
  • Pickle is opt-in. Tagged serialization preserves types such as tuples, sets, datetimes and Decimals, with registration for custom types.
  • The docs come to about 70,000 words, the length of a typical novel. Of that, about 53,000 are the written story (guide, recipes and the home page), and the rest is API reference, the agent skill and code samples.
  • Early release, not full diskcache parity: string keys only; AsyncCache, memoize, tags, Deque and Index are still planned. The network cache server is a roadmap item too.
  • Python 3.14+; macOS and Linux wheels include SQLite. Windows support is planned. Migration changes the import and uses a new directory, not the old cache.db.

Extras

Calvin:

  • Django Software Foundation Board Nominations open until December 2nd Michael:
  • Startpage paid plans
  • Test driving Helium Browser
  • Tallyman got a big update, give it another try
    • Tallyman is my command-line tool for seeing the shape of a codebase, with line counts grouped by language and categories such as Code, Docs, and Specs. Version 0.4.3 bundles new controls and a long list of fixes.
      • I made a bunch of massive updates this week. If you tried Tallyman before and it didn't work for your project, give it another try.
      • Use --no-save to try setup choices without writing a config, and --exclude PATTERN for one-run file exclusions.
      • Lots of fixes to gitignore handling, nested configs, the setup TUI, encodings, and image export. First runs in CI or pipes no longer hang waiting for setup.
      • Optional exclusion of inline Rust test code, plus MATLAB and Solidity support, bringing the language count to 44.
      • Want another feature? Submit an idea through a GitHub issue.
  • Bunny.net fonts disappoint.
    • Root cause: Bunny Fonts began serving its font files from cdn.jsdelivr.net, which our CSP blocks - production had silently fallen back to system fonts.
  • Talk Python Meetup: SQLite Might Actually Be All You Need

Jokes:

Transcript

From the publisher

This transcript comes from the podcast’s own feed, shown as the publisher wrote it.

#505 Introducing diskcache-oxide

00:00—
  1. Calvin Hendryx-Parker

    Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 505, recorded on November 17th, 2026. I'm Calvin Hendrix-Parker.

  2. Michael Kennedy

    And I'm Michael Kennedy.

  3. Calvin Hendryx-Parker

    Happy to have you here. This episode is sponsored by Longlink. There'll be more about that in the break in between. But if you want to connect with Michael and I online, you can find us on Mastodon Bluesky X and LinkedIn. And if you want to find the show, check us out on Mastodon Bluesky X. Join us live if you want to experience this in real time at pythonbytes.fm/live. You can be part of the audience. Usually we're recording Tuesdays at 7 a.m., but another older versions of the videos are there as well. And finally, if you want an artisanal handcrafted digest of each week's show notes in email form, go and join our friends of the show list and we will send it over to you. Michael done a good job of making that happen. Speaking of making things happening, what about job cues?

  4. Michael Kennedy

    I have such an interesting project to come up here. So let's switch over. Perfect. Called Tiny Jobs. So this one comes to us from Pier Giuseppe. So Pier Giuseppe, this is his project, send it over. And I'm going to have to just apologize in advance. I am on a SQLite mission. I'm a believer, Calvin. And so this is amongst that, but it is.

  5. Calvin Hendryx-Parker

    I leaned into it. I've also added a SQLite topic today too.

  6. Michael Kennedy

    Incredible. So people are just going to have to accept like a couple of weeks of SQLite amazingness because it is, I honestly think it's really coming into its own. What do you think?

  7. Calvin Hendryx-Parker

    It's always been there. It's an interesting project, right?

  8. Michael Kennedy

    It is. You know, I think it's, I think the wall stuff, honestly, the right ahead log has made the durability sort of much stronger and sort of brought it into like, you can actually use it now, you know? Anyway, like I said, this is only deposit one, I guess, on that story. So maybe there'll be more. I mean, I know there'll be more, but this is part one. Anyway, Tiny Jobs. So Tiny Jobs is built around fundamentally SQLite, though it can do Postgres and Redis. And what it is, is a background job and cron system for Python. So imagine I want background jobs like sending email or rebuilding search indexes or, you know, updating Parquet files or parsing Parquet files and moving them into some kind of analytical database.

  9. Calvin Hendryx-Parker

    Kick off an agent to do something.

  10. Michael Kennedy

    Yeah, that is definitely the 2026 version, isn't it?

  11. Calvin Hendryx-Parker

    Yeah.

  12. Michael Kennedy

    So you can do all of that with maybe no server or maybe a server, depending on how you want to run it. This one, it kind of is most likely you would run it as a local separate Docker container as part of your thing. So when you say Docker Compose up, like your app starts and this thing starts, but you can run it in process on things that are async, like FastAPI and so on. So how does it work? Well, you just come down and create a tiny job thing. You give it, by default, a SQLite file. So your connection string is just a file path as it is. And then you just put app.task or jobs.task, whatever you want to do, onto functions. Like the examples are generate PDF or transcode this video. Given a video ID, you know it's going to go to the database, pull it up, that sort of thing. But it has sort of a tenacity, stamina sort of thing as well, like five max attempts, timed out for, you know, 300 seconds, right? Because how long is your video? I could tell you, you might want to up that if you're doing a lot of video work. I've run those overnight. But anyway, the point is there, you know?

  13. Calvin Hendryx-Parker

    It's really, really elegant. I really like this. I had not seen this before. And now I'm like, how does this not escape my like purview? It's amazing. I know.

  14. Michael Kennedy

    It's so good. we've got you can give it a cron the task instead of just call it you give it a cron one of those what do you call this cron like signature how about that yeah okay and you give it a time zone and it just runs like you can say 30 space two place star star star and it just runs on its own it has guaranteed operation like it'll guarantee that it will handle the jobs even though it's sqlite does not guarantee they won't run twice if like for some reason you pull the power halfway through, it might go, okay, that didn't finish. I'm going to start over. If you run it in process, then it will basically, if something is running and it's running in process, it will hold back the shutdown until it sort of drains its jobs, which depending on the kind of jobs you got, it might be awesome. It might be not awesome. If you're sending email, probably fine. If you're transcoding a video, probably not fine. You know what I mean? So think about what you're doing, I'm guessing here.

  15. Calvin Hendryx-Parker

    Yeah, exactly.

  16. Michael Kennedy

    It comes with a Django tasks backend for the Django, what is that, 6.1 when that came out?

  17. Calvin Hendryx-Parker

    Also, again, super elegant, super cool. This is a really, really nice.

  18. Michael Kennedy

    Yeah, Django has this tasks thing, but it doesn't really have an implementation that comes with it. And so here's like, I don't want a server. I just want a file. You know what I mean? I want a thing to manage.

  19. Calvin Hendryx-Parker

    Simplicity is the feature here.

  20. Michael Kennedy

    Yeah, absolutely. So a lot of cool stuff that you can do here. And I had, this is really neat. This is absolutely on the case. So I've warned people about SQLite. They also will have to be warned about free-threaded Python.

  21. Calvin Hendryx-Parker

    Lots of news.

  22. Michael Kennedy

    Because these are things that are intersecting for me on stuff that I'm working on right now. Part of my mission. So anyway.

  23. Calvin Hendryx-Parker

    For listeners who don't know, Michael's on a terror to make free-threading available to the world.

  24. Michael Kennedy

    That's my mission. Yeah, like last week was Gilgard, right? G-I-O, Gilgard. This week I have something way bigger. Anyway, so free-threaded Python. I talked to Leppie and said, what's the story with free-threading? I'm on this. He's like, you know what? You're right. Let me make sure it works. And so the gil stays off on Python 3.14t and dash loops and runs several event loops in one process. I imagine because I have been juggling this very hard. It is not easy. Usually what I'm thinking is happening is each dedicated free-thread gets its own dedicated event loop. And then because sharing them across threads, it's kind of, I don't know, it's like Ghostbusters crossing the wires. You probably shouldn't do it. You might be able to.

  25. Calvin Hendryx-Parker

    The performance looks pretty awesome, too. You've got some performance numbers here.

  26. Michael Kennedy

    Yep. Where did I put them? Read them to us here.

  27. Calvin Hendryx-Parker

    Oh, here we go. No, I got it.

  28. Michael Kennedy

    10 hours of steady load on one SQLite file, almost 900,000 jobs.

  29. Calvin Hendryx-Parker

    Wow.

  30. Michael Kennedy

    And this is sort of the durability test. Like, let me see if I can hammer this and break it. I have some other interests. Like, I'm telling you, SQLite, y'all, it's out of control. It's off the hook. It's something else. So, yeah, 900,000 jobs in 10 hours.

  31. Calvin Hendryx-Parker

    Yeah.

  32. Michael Kennedy

    Nothing lost.

  33. Calvin Hendryx-Parker

    That's amazing.

  34. Michael Kennedy

    All right.

  35. Calvin Hendryx-Parker

    Really impressive. No, that's super cool. So I'm glad you pointed this one out to me. Yeah. Speaking of things being funky, some other cool stuff over here on the SQLite front, too.

  36. Michael Kennedy

    All right. Let's keep the SQLite train going. This is going to be straight SQLite, like right down the line. Let's go.

  37. Calvin Hendryx-Parker

    Well, so you're familiar with with func cache or functools cache, correct? So this is Alex Chan's decorator style that stores results in, guess what, SQLite. They survive process exits. So basically, if you've got something where you were using, say, func cache in the past or functools cached in the past, that would disappear when your process stops and your memory goes away. This allows it to survive those restarts. One of the interesting use cases that they used in their example here was for static site generation. For static site generation, a lot of times most things don't change, but you run the process once and then it's done and then now you run it again and it'll go through and redo most of the operation. With this, it can actually pull those resulting values out of SQLite and save you tons and tons of time. So if you've got a large-ish static site, this will save you a ton of time on generation it'll save you for example if you're using ci cd or GitHub actions this will reduce your your GitHub actions run times so obviously saving potentially money or credits or whatever you're using to go out there and build those pieces it works very very similarly to the cache stuff or the functools cache where it's just a you can register the sqlite storage and then you use decorators against the expensive functions, for example, here, and then you can specify how it gets hashed. So under the covers, it is hashing. You can't, for example, you can't hash, use a dictionary as a hash key. You can use it as a value, but you can't store that as a key because the dictionaries themselves are mutable. They figured out how to optimize around turning that dictionary into a string, which is an immutable object in Python, to allow that to be the key for or the pulling back the value out of the cache. That actually led to a cool discovery by them and me now, which is JSON hashed as a string. There's obviously different ways to do it. And then if you want to hash it as the key, there's, for example, you could just use an identity function or an MD5 function, for example. I had never heard of this hashing library called XXH64. I don't know if you've run across that or not either.

  38. Michael Kennedy

    No, that's new to me, yeah.

  39. Calvin Hendryx-Parker

    Yeah, so converting into JSON, basically we're looking at options like pickle and JSON. Obviously I mentioned JSON as one that got chosen, but if you look here on the performance and time, being able to store that into the database and then compute that hash obviously has a performance impact. The HXXH64 insert and lookups, you can see here are very, very quick, under almost 0.01 seconds in the benchmark compared to like MD5 being 0.1 seconds. So we're looking at like a times 10 speed increase on the MD5 version, which I've made this mistake in the past as well, thinking like, well, MD5 is not necessarily secure, so it must be fast. Not true, not necessarily true. So HH, or good Lord, I'm gonna get that right someday. XXH64 is not cryptographically secure, but that's not the point here. We're using it for identity. And so we were looking for the fastest way to create some kind of a hash. There's an opportunity, potential opportunity for hash collisions, but in this scale-

  40. Michael Kennedy

    That is so much faster. I'm so interested in this.

  41. Calvin Hendryx-Parker

    Yeah, yeah, exactly. If nothing else, if you don't even use the SQL-like funky cache piece of this, discovering that there is a faster hashing mechanism when security is not the important part of why you're using it, this is well worth the discovery alone. So yeah.

  42. Michael Kennedy

    Let me throw one more thing on hashing that has caught me out because I was looking at it a lot with stuff I'm about to talk about. Python has a built-in hash function, right? So why not just use that? It's the built-in, yeah? You don't even have to use MD5 or any of those things. It is not. If I hash something and then hash it again, I'll get the same answer. But if I shut down the process and start it back up again and hash it again, I get a different answer.

  43. Calvin Hendryx-Parker

    Oh, goodness.

  44. Michael Kennedy

    So if you save it to a file and you ask, is it in that file? It's not in the file anymore. So stay away. For this purpose, for giving an ID, don't use the build to pick something, this looks like a good answer.

  45. Calvin Hendryx-Parker

    Xxh64 looks like a really good option for reliable hashes that are fast. So yeah, that was super cool to discover that. I think if there's any of that here, cache keys, they're hashed with the JSON bit, they're deliberately lossy, which is fine, because what happens is they go through a couple different iterations on, so I want to jump ahead too quick there, the hashing is, here it is, basically reducing them into a quick hash so that speed was the feature, and then using Pydantic to convert these models to data classes and Python objects, and then refactoring so that each function only takes a minimal set of required data. So this was just an optimization, optimization, optimization, because we're all talking about cache and speed here. The other interesting bit with this specific tool is there's a bit of a dependency tracking here. So if you, for example, or generating a static site generation, you've got a main like index blog page, for example, and you add a new blog post, you would want that main page to get regenerated, but it didn't necessarily change as far as the code's concerned. So you can specify that when these pages change or when this pattern of pages change, regenerate this other potentially expensive page. So it's a little bit like a kind of a graph that you can establish. So you could do something with something like Airflow, but that'd be a little heavy handed. This includes that dependency tracking built in. So you can say registering specific files to track those dependent changes. So if things change in templates, for example, regenerate them. And so it basically shows this kind of reactive aspirations or reactive programming. If you change input article one, then the list of articles two steps away can also change in response to it. So a nice pattern for basically a very minimal DAG situation. So if you didn't want the full blown, Actually, it's kind of worked well with your previous topic about scheduled tasks, combining the previous tiny, tiny, tiny queue, what was that called?

  46. Michael Kennedy

    Tiny jobs.

  47. Calvin Hendryx-Parker

    Tiny jobs. If you combine tiny jobs with funky cache, you actually get a very lightweight, SQLite based version of Airflow, it seems like to me. I was, again, thought that was a good combo to put together this week's episode.

  48. Michael Kennedy

    Yeah, that's really cool. And I love the names. I love the names, they're fun.

  49. Calvin Hendryx-Parker

    They're very funky. Very, very funky.

  50. Michael Kennedy

    They definitely are funky. All right. Now, before we move on, let me tell you about our sponsor this week. So Longlink. Let's talk about Longlink. Longlink is a really cool platform for building business software. Saves you a lot of the stuff that you got to do otherwise. All the plumbing, the foundational stuff. All right. So this episode is brought to you by Longlink, of course, a growing startup out of Switzerland. How much of your company still runs on spreadsheets? I don't know what the answer is. Probably it's too much.

  51. Calvin Hendryx-Parker

    Probably too much, even in my own.

  52. Michael Kennedy

    In all of ours, it's probably too much. So for most businesses, it's a lot. Approvals live in email threads, tracking lives in shared Excel files. Off-the-shelf software rarely fits, so you've got to work around it. So AI has actually changed that quite a bit. And I'm seeing that with other companies that are working with it. They're like, oh, here's our new internal app. I'm like, oh, that looks familiar. Or I could see the origin of where that might come from. So custom business software is now cheap to build, but keeping it simple and affordable to maintain is not as easy. So that's the problem that Longlink is solving. You write your business apps in plain Python with familiar libraries and standard development practices. Longlink provides the platform underneath. Authentication, permissions, deployment, storage, routing, logging, all handled. You focus on the business logic. Purchase approvals, vendor onboarding, work orders, and complaint tracking to start one process and then build the next and sort of work back through these apps that need modernization. So get started in one command, uvx long link in it. Platform has a free tier, no credit card required. The project is open source and in beta, and the team would love you to try it out and share your feedback. And while you're there, they would also really appreciate a GitHub star. So check it out at pythonbytes.fm/long link. The link, no joke, is in your podcast player show notes.

  53. Calvin Hendryx-Parker

    Is it long?

  54. Michael Kennedy

    Actually, ironically or surprisingly, it is not long. How about that?

  55. Calvin Hendryx-Parker

    That's great. Great to hear.

  56. Michael Kennedy

    Yeah. All right. Let's go back over to you. What's next?

  57. Calvin Hendryx-Parker

    Yeah, so I can't resist a great set of tools and this one is no exception. I love local based tools, I love terminal based tools and this one is both. And so this is a fast keyboard driven TUI API client and webhook inspector written in Python called Ghostman. So if you check it out, the GitHub repository for it, it is no cloud, no electron, 100% local first. It hits all the marks for me. It's also MIT licensed. It just, again, looks like a really cool tool. I've started playing with it a little bit in preparation for the show. They mentioned installing it via pip from PyPI, but I would recommend just uvx Ghostman. If you just type uvx Ghostman into your terminal, you will get a beautiful little looking terminal thing. So for those of you who've used Postman or Bruno or some of the other web GUI versions of API client testing out and exploring various REST APIs, this is an option you can use just right there in your terminal. It just launched, first release was like Halloween, and then this most recent release came out November 3rd at 1.0.1.8, built on Textual, HTTPX, and Rich, so it's pure Python under the hood, which also makes, you know, warms my heart when I hear that there are these pure Python tools still out there. You can do things like, you know, obviously the standard get post put, delete, and patch requests. It'll show DNS and time to first byte. So you get a little bit of performance stuff going on in there. And it will also color your JSON responses in response. It's got a built in, the neat thing, it's got a built in webhook inspector. So if you use the keyboard, there's a couple of keyboard shortcuts for it, which is also kind of nice, big fan of keyboard shortcuts. Control W will start the webhook listener on port 9090. You can actually point your application to it if it's posting webhooks and inspect what comes out the other side without having to resort to like netcat and some other stuff i i used to do that quite a bit i would just like open up a netcat watch the text just flow in but here you can get it actually like syntax highlighted which was nice

  58. Michael Kennedy

    uh the webhooks are the worst i mean they're really valuable but they're so hard to debug

  59. Calvin Hendryx-Parker

    hard to debug exactly hard to debug you can build collections just like you could in postmans and you can put them it looks for them under a.ghostman folder inside the current directory or you can have a global one at your home directory with a.ghostman version of it there. Again fully keyboard driven it's very very lean. The author claims 30 megabytes of RAM and a cold start of about 150 milliseconds. So we all love a fast tool like that. Actually I've got a demo for you. I'll show you a quick little demo. I can put up my screen again here share screen. I'll go to my terminal. Here we go. So here is going to add it back to the stage. There we go. This is what it looks like when it launches. It's got a couple of examples built into here. So you can just like load that up, choose what you want. And I'm using the mouse with it, oddly enough. It's a full rich, you know, 2E interface, which is kind of nice, but you can create posts, public, you know, it's got the GitHub example here for Octocat. You can get the response. Scrolling works as you would expect it, or you can go fully full blown keyboard shortcuts. If I hit the webhook UI, you can see right there webhook listener started on 9090. So now if I was supposed to post something into it, it would show up over here in the in the UI. Again, really, really cool local first. You can see there's the collections piece there. You can create a new collection, start in adding in payloads and webhooks and headers. And it's basically Postman. But for those of us who love the terminal, I found a new tool. I love it.

  60. Michael Kennedy

    This is very Calvin. I love it.

  61. Calvin Hendryx-Parker

    it's so true yeah it looks textual it is yeah it's textual and httpx which again just beautiful uh and this is running inside of my 3d accelerated terminal kitty which i am a huge fan of because everyone needs a 3d accelerated terminal why would you not doing at least 240 frames a second on your terminal you're doing a terminal i mean speed is the feature michael speed is the feature but on

  62. Michael Kennedy

    you know that is a joke sort of but at the same time if you get if you get flickering and stuff in your terminal then that's also not fun that's really that's annoying it's no good no good it's no good all right something that i think is good i want to i want to talk about the next thing this is the big thing for for me this week so i've been a big fan of disk cache and disk cache i even did a podcast episode on talk python with vincent warmerdom and we both said should we cover this It literally is possibly one of the best caching options bar none out there. It is so, so good. But the person who maintains it just ghosted the world, which is fine. I'm not putting them on blast or nothing for that. But it leaves a big gap, right? And had a bunch of problems, a bunch of GitHub issues, a bunch of unanswered pull requests. And I thought, well, this is part of my mission, right? Like I'm trying to make free. My mission is I want a foundation I can build web apps in that is safe and free-threaded Python. And while you're at it, let's just see if we can make it fast. Yeah. So my big announcement is I rebuilt disk cache and something called disk cache oxide. Calvin, can you guess what that might be written in?

  63. Calvin Hendryx-Parker

    Let me guess. I'm sensing a trend here in your projects. Yes. Is it Rust?

  64. Michael Kennedy

    It is a Rust core.

  65. Calvin Hendryx-Parker

    Love that.

  66. Michael Kennedy

    With Python. It's a Python only cache. This is not a Rust library. So introducing disk cache oxide, Python cache, Rust engine, SQLite storage. And this thing is an absolute monster. I mean, it's out of control. So this is powering Python by Spatafim right now and the courses and talk Python. And it's actually been running all the web apps for maybe a week, week and a half, something like that. I didn't want to announce it and have some kind of issue. I'm like, let's just live with it for a while, see how it's going. And it's been flawless. So let me just scroll down here and pull up some numbers. on a single SQLite file with one thread, just straight gil python, nothing fancy yet. It does in a 99 to one read-write ratio. So 99 reads, one write. That's pretty cash standard. There's also a graph for a thousand reads and one write. It does 670,000 reads and writes a second. A second, okay?

  67. Calvin Hendryx-Parker

    Michael, isn't it just good enough? Do we need this?

  68. Michael Kennedy

    yes we do because the previous one was also very impressive like i i do not take away my my um positive comments about regular disc cache yeah but if and here remember the free thread mission this is my mission what happens if i take that same awesome disc cache not mine the original and i use it in a multi-threaded situation it goes from 400 000 requests a second to 19 000 woof it's 20 times slower if i try to use it in a free threaded way yeah broken as that

  69. Calvin Hendryx-Parker

    It's no good.

  70. Michael Kennedy

    And it's just, it was built for a different time, right? And I would be totally content if, I think the guy's name is Greg. Greg behind it would like go, yeah, we're totally going to ramp this thing up. But he got hired at OpenAI. And then like the next day, like responses on GetUp. Like there was just, maybe it's a corporate thing. I don't know. It's just like not allowed to even reply, but done. So I went through and I said, I want to take a similar API, not identical, but almost the same. and I want to build this free-threaded, multi-threaded, Rust-based version of this. Yeah, and that's what we got. It's super, super neat. And it does a bunch of things that the regular disk cache does it. And I think this is really one of them, going to be one of the really best caching libraries for Python.

  71. Calvin Hendryx-Parker

    So here's how it works. So you're ready to deploy onto Py0 now?

  72. Michael Kennedy

    Yes, yeah, 100%. So you give it just SQLite file and it can be durable or not. So the serialization for disk cache and a lot of these caches, I think I saw it in the other one, is pickle. That's just wrong to me. Like it's a security violation. You hear this a lot with hugging face and those types of things. Like, hey, if we use pickle, somebody could insert a malicious script. And then when you just load the file, it runs this Python and it's bad. Plus it's just not durable. Like if I change the name of a field and I rerun it, like I can't parse it anymore. Well, that's broken. You know, like I can't control it. Nothing like that. So this by default uses message pack, which is a super tight binary format for storing things. And also has JSON as another built-in option. And if you really want, you can say pickle, but try not to, you know?

  73. Calvin Hendryx-Parker

    Now why risk it?

  74. Michael Kennedy

    Yeah, exactly.

  75. Calvin Hendryx-Parker

    Those things can execute.

  76. Michael Kennedy

    Yeah, so you can come up with this cache. You can say, if something goes wrong with the GC serialization, just throw that away and just say it's a miss, right? So instead of trying to deal with a bunch of errors, you're just like, look, if I can't deserialize it, it's a cache. What else am I going to do besides just say it's not there? Or you can let it throw exceptions and so on. And then you just cache get item or bracket item and then set as expirations. Now, a lot of these SQLite local caches, it's up to you to kind of manage the files and make sure at some point in your app you call expire to get rid of the other ones or you can set a limit of how many it can have. You can say delete and delete those if it's too big and call them and so on. This has a dedicated worker maintenance thread in Rust that's periodically going around and just cleaning up. So it's a little more tidy. You can even use it for job scheduling and cross-process coordination. So you can say, like, I want to claim a job. I'll add this job, give it my ID, and expire. And either it's already in there, which means it's running, or you've added it, which means, hey, you're starting this job. And the fact that you expire the previous one is you just keep trying to add this job. It does git added. That means the previous one expired. So it's time to do, I don't know, refresh feeds or whatever. And because SQLite is cross-atomic and cross-process, this basically is multiprocess coordination. So if I have, say, Granian or GUnicorn or whatever with four workers, they can use this to have one of the workers periodically run one of the jobs, which is pretty neat. There's a lot of documentation that I've put together. And by a lot, I don't think you would, until you start reading, you're like, why am I not making progress in the scroll bar? There's, by way of comparison, The Great Gap Spee is 45,000 words of the book, the novel. This is 70,000 words of like, hey, I'm new to caching. What do I do on this situation? How do I, you know, how do I work with serialization? How do I work with like groups of named caches? Or there's like recipes for different common things you do with like coordinated workers, right? that thing I just talked about, or using it for rate limiting, or using it for work cues, and so on. So this is a really fun project. Let me see if I can find the free threading. Let's see, I think I was trying just under performance, because this is also gets interesting. So if I want to do a get 0.9 microseconds, that is less than one one thousandths of a millisecond. I want to do a set, it's only 0.018 milliseconds. But if you come down here, and you look at free threading, for four threads, it does 1.3 million operations, reads and writes a second.

  77. Calvin Hendryx-Parker

    That's pretty incredible.

  78. Michael Kennedy

    Yeah. And this is SQLite. Here we go.

  79. Calvin Hendryx-Parker

    We're modern now.

  80. Michael Kennedy

    And I'll tell you what, this is not, oh, yeah, it's in Rust, so of course it's fast. No, this is Python code doing 1.3 million reads and writes a second. It is so, so cool. What else can I say? I guess it's super tested. Like I said, it's been running all the websites for a while, But also I've been having, I had to reboot my mini, which is why I was messing with my camera at the beginning of my mini pro because I've had it do so much work. It was, it'll run like, Hey, I'm going to do a big change to the way, like the work stealing cue or whatever sort of works. And so let's, let's make that change. But I also want to test that there's like no race conditions and deadlocks and leaks and so on. So I'll run it for like 24 hours, 17 workers doing 150,000 requests a second each for a day. And it'll have this chaos monkey in there, like killing off the processes periodically and like seeing what's going on. And it's been taken. I think I did about 1.5 trillion cash operations. Probably destroyed my drive.

  81. Calvin Hendryx-Parker

    That is a big number.

  82. Michael Kennedy

    It's 1,500 billion operations.

  83. Calvin Hendryx-Parker

    Yeah, I think people recognize how big those numbers are. We throw them around these days. That's a very big number.

  84. Michael Kennedy

    One final thing, super interesting that this has that might be not obvious is this fan out cash. So one of the, you know, you've like, oh, I got SQLite, I have this problem, like where there's like this write contention or whatever.

  85. Calvin Hendryx-Parker

    Yeah.

  86. Michael Kennedy

    So what you can do is you can say, I want eight SQLite files, and it's going to automatically, given the key, it's going to use the hash and like a way to figure out where that goes.

  87. Calvin Hendryx-Parker

    So you can shard.

  88. Michael Kennedy

    Yeah, so you can shard into eight or more SQLite things using multi, when you're doing multi-threading, then each independent thread could potentially choose a different shard, in which case those are independent SQLite operations. So super, super cool. Now I tried to run this. Yeah, I tried to run this with the old one and it just crashed because it like leaked handles or couldn't deal with it.

  89. Calvin Hendryx-Parker

    It's like, nope.

  90. Michael Kennedy

    It was fine on one, but as soon as you started to do threading, it's like, nope, there's too many crash. I'm like, yeah, no, this one doesn't crash. It totally takes it. So there's a lot of interesting things. I don't think, oh, do I have a graph here? Yeah, again, there's a lot of ops you can do here. This is very fun. So I'm really, really proud of this library. I think it's going to be super useful for people. Check it out. I'd love for you to try it.

  91. Calvin Hendryx-Parker

    Is this full drop-in for disk cache ready, or do people need to make some modifications?

  92. Michael Kennedy

    No, it's full drop-in. One thing that it doesn't do is it doesn't take your existing cache files. So if you've got a cache that was hard to compute, it's because I disagree with the philosophy of how to store the files. I don't want them as pickles, and there's other things as well. It actually creates a separate folder path that it goes down. So in that sense, you'd have to rebuild the cache. But other than that, it's like 99% identical. The one thing that's not there yet is the Django cache, which is coming, folks. But give me a moment. It's a lot of work. It's taking me some time. But I'm working on the Django cache and some other ideas. I'm thinking that there's really interesting things, like large files, kind of like almost an S3 type of thing, which you don't necessarily want to put in the database, but kind of like an aside storage of files. I'm going to put them in the cache, and when the thing expires in the cache, it manages the files coming and going. And I think those kinds of things would be really fun to do as well.

  93. Calvin Hendryx-Parker

    Yeah, and I see this like Mac and Linux. What's the holdup on Windows?

  94. Michael Kennedy

    No, it's on Windows. It is on Windows. Yeah, if my docs say that it's not on Windows, it is. It just takes, these wheels take a long time to build because the wheels are profile-guided optimized wheels. So what I have is I have a whole profiling, like a series of stuff that it runs through and it'll first build them bare and then it builds them with prof to make sure the test fast then it will build them with profiling on take the results of the profiling and then rebuild them optimized with like that information yeah and just doing that on windows was harder it's not super hard it's just more the automation of it um so no i it's if you pip uv pip install or pip install it you'll get the windows wheels now

  95. Calvin Hendryx-Parker

    as well it's very cool awesome michael like wow thanks like i can't wait to see what next week brings uh what what oxide project are we going to get next week i just you know i mean this graph is

  96. Michael Kennedy

    sort of this first graph that's right on the home page it just tells like why why do we need this like because the python space is not it's just not ready for three free threading and people have not put an effort into it and this project is abandoned effectively right much much like chameleon is not abandoned but it's just like it's no one is putting the time and energy go like we really need to push this forward and the adoption of free threaded python is not going to work if is the graph everyone gets. It's just like from high numbers to just collapse if you try to use it. Like, well, why would I do this? This is like way more compute and it doesn't work. Well, it can work. It just doesn't work unless you specifically put some focus on it, you know? Yeah.

  97. Calvin Hendryx-Parker

    You're doing a good public service here.

  98. Michael Kennedy

    Thank you. Thank you.

  99. Calvin Hendryx-Parker

    All right. Well, let's head over into extras and see. I've got a couple extras for us. And one of them is the Django Software Foundation board nominations are open until December 2nd. There are five of the seven board positions open for election this year. Go sign up if you are interested in participating in the governance of an amazing open source project. Kaplan Moss, still involved in the project, especially from a governance standpoint, has been helping out getting this all going. And we wanna thank those who have spent the time and effort on the last round. So Jeff Triplett, Abigail Avogato, Paolo Melchua and Tom Carrick, the time, dedication, and efforts they've spent. So go join the Django Software Foundation board and participate in what happens next for that. The one last other extra I wanted to put in here is for those of you who don't know, one of the more prolific maintainers of Python has passed, Tim Peters, passed in July. And I wanted to remind people, this is one of my favorite Easter eggs in the whole language, is the fact the Zen of Python is inside of, and that was authored by Tim. And if you just go import this from a REPL or just do Python 3 minus C, import this, you will be able to read one of the things I refer to constantly, which is the Xenopython. So we're obviously sad to see that light extinguish. And he was a great contributor to the language itself too. But Xenopython, what a great legacy in my mind. And everyone should go do that. I tell people to print it out, frame it, and put it on their wall in the bathroom so they can read it every day when they're brushing their teeth. Words to live by.

  100. Michael Kennedy

    Yeah, the Xenopython is amazing. and it's had a huge effect but honestly that's just a part right like it's just a small part i mean

  101. Calvin Hendryx-Parker

    it's one i cherish because i when i was when i would teach people python that's where i'd start with that because there's so many great things there he's obviously contributed way bigger things

  102. Michael Kennedy

    to the language itself well he will be missed thanks for for bringing that up on the show yeah all right michael you got some extras i have some extras i will try to be quick because i have Extras start page, the search engine has always been nice, but you know, I actually wrote an article and complained about how like the whole front, like everything above the fold is now ads, which I'm like, this is, but you could also put your money where the mouth is and say like, I'd rather support the world than have ads. And so they opened up a paid $4 a month for their search tools with zero ads. And you know what, to me, I thought that's, it's pretty neat. So I don't know. I just thought I'd give that a quick shout out for them. Also, have you noticed my

  103. Calvin Hendryx-Parker

    browser is a little different. I don't know if you've... I haven't, but I'm very curious. I saw this listed in the extra. I peeked at this one and I'm very curious. Look how tight and like how much

  104. Michael Kennedy

    space I have on my screen, on my little like streaming screen.

  105. Calvin Hendryx-Parker

    True. And I've gone through a bunch of different browsers recently and someone has just informed, which is usually my children, that my most recent browser choice is still problematic.

  106. Michael Kennedy

    You know what? I mean, yes, but like so is Firefox and some of its origins. So like... Right. There was somebody that wrote a parser that was a jerk. And so, I mean, yes, but at the same time,

  107. Calvin Hendryx-Parker

    right.

  108. Michael Kennedy

    But I'm sorry, using helium, which I've talked about before. And it's actually Python plus Chrome, which is an interesting angle. Like all of those sort of interactions is like, I believe Python and stuff, at least it was when we talked. So this is really neat. It's privacy first, like brave. Um, and it has vertical tabs on the left, or you can have this super condensed view. And this is like, at first, when I saw this, I like, Oh, this would be great for streaming, but it's so hard to navigate. I can just hit like a button and then just i get a little drop down which is like vertical tabs but it's not you can do auto hide there's even less than this calvin a hotkey to hide and close the vertical tabs on

  109. Calvin Hendryx-Parker

    the side oh okay i'm sold yes i know i know that was your whole thing i am moving over today now

  110. Michael Kennedy

    it's it's still a pretty new project so you know take that with a grain of salt and like all the

  111. Calvin Hendryx-Parker

    things that you should consider but it is people who know me know i'm an early adopter i know exactly

  112. Michael Kennedy

    Well, welcome to the show. You fit perfectly in, right? That's what this is about. So, but it is based on Chrome and they promise to release Chrome updates frequently and if there's any kind of issue. So keep that in mind, but I'm enjoying it. All right, Tallyman, my little app that lets you get graphs of like how much, what type of code you're using in your project and generate little shareable graphics that you can put images and so on. Got a major release. So I went through it and did a whole bunch of changes. So if you're using that, give it an update. I want to just call out in a not positive way, bunny.net, which I love bunny.net for their CDN and their DNS and stuff. But I had the crappiest experience with them. So they have fonts.bunny.net, which is an alternative, an API compatible alternative to Google Fonts. That's cool. Privacy focused, cool. You know what's not cool? Is if you build your website with it four years ago and you set a CSP policy so people can't run crap on your website. Like, hey, security, that is a thing, right?

  113. Calvin Hendryx-Parker

    It is definitely a thing.

  114. Michael Kennedy

    Well, they just decided we're going to not run that anymore. And so we're just serving everything out of JS Deliver, which is no hurt on JS, no shade on JS Deliver. But I was at the, go ahead.

  115. Calvin Hendryx-Parker

    Yeah, but no one loves a brown bag release.

  116. Michael Kennedy

    Yeah. So I was at the Apple store with my daughter helping us get something set up. And the iPhone Duo was at it. Oh, cool. Let me see what the website looks on that. And I load it. I'm like, that looks amazing. I click one thing, it says too many requests. I'm like, what? Because the CSP policy didn't allow any of the fonts or any of the other things that needed. And so every page load was sending 1,600 CSP violations to my server. I'm like, oh my God, dude. And it stopped serving all the fonts. I'm like, that is not a cool thing to do. So if you, long story short, the extra is if you use bunny.net fonts and you have a CSP policy, you need to review this. All right. Really quick. Last thing. Did I say I'm on a kick? I'm doing a members only Talk Python tech meetup. So please join the members, come see the tech meetup or watch it after. SQLite might actually be all you need. So this, this is not even on any of the SQLite stuff I've talked about. This is a totally different and even crazier SQLite story. And it's going to be amazing December 2nd. So it's in the show notes. Hopefully

  117. Calvin Hendryx-Parker

    you can be there. I thought attention was all I needed.

  118. Michael Kennedy

    It is, but then attention helps you get sequel light perfect um you know hat tip to the um transformers original paper yeah that's not

  119. Calvin Hendryx-Parker

    funny but you know what is what is funny two jokes some jokes you got two jokes yes i got two jokes

  120. Michael Kennedy

    i've not peaked good i couldn't even decide i couldn't even decide something they're both going in because what happened this week maybe last week this week i think it was last week all the things happened last week has anyone tried to like i don't know check their outlook mail i'm kind of scared

  121. Calvin Hendryx-Parker

    about the next friday the 13th this last friday the 13th was pretty bad yes i know i'm i am not

  122. Michael Kennedy

    a fan of friday 13th let's don't go down that path so remember clippy yes yeah the little thing says um the joke says decommissioned just means the one machine in the building nobody will ever dare touch it's clippy pops up and says would you like to try powering up the decommissioned exchange 2010 server that you never bothered to remove from the rack so that you can get your mail

  123. Calvin Hendryx-Parker

    back this bit me this weekend i powered i powered off a piece of hardware i had in my little home rack that i'd forgotten about for like the last year that i thought i'd taken out of service sure enough stuff stopped working on the network things were talking to it yep it's they're in

  124. Michael Kennedy

    there you don't know very real the other one also outlook based it has a picture of like earth rise from the moon right yeah and it says the prophecy has been fulfilled i have two versions of outlook

  125. Calvin Hendryx-Parker

    neither of them is working it has been foretold so are we all it's all behind us now done yeah

  126. Michael Kennedy

    we're good to go it's all fine we've got what's done what's done is done it's done i think this

  127. Calvin Hendryx-Parker

    episode's done what do you think i think so too thank you michael to you all next week