#505: Introducing diskcache-oxide
About the show
Sponsored by LongLink: pythonbytes.fm/longlink
Connect with the hosts
- Michael: Mastodon / BlueSky / X / LinkedIn
- Calvin: Mastodon / BlueSky / X / LinkedIn
- Show: Mastodon / BlueSky / X
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-styledecorator 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:
funkycache1.0.4, from November 15. The first release, 1.0.0, came out November 7. It needs Python 3.14+ and depends onpydanticandxxhash. - 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.cachehands 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.
- 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.
- 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.
- Root cause: Bunny Fonts began serving its font files from
- Talk Python Meetup: SQLite Might Actually Be All You Need
Jokes:
Episode Transcript
Collapse transcript
00:00
00:05
00:10
00:11
00:12
00:13
00:15
00:18
00:21
00:24
00:27
00:33
00:34
00:39
00:44
00:48
00:50
00:54
00:58
00:59
01:00
01:02
01:06
01:08
01:11
01:14
01:16
01:19
01:20
01:23
01:23
01:27
01:31
01:32
01:33
01:34
01:35
01:37
01:44
01:45
01:50
01:51
01:53
01:54
02:00
02:04
02:12
02:18
02:19
02:22
02:22
02:24
02:28
02:29
02:35
02:36
02:40
02:45
02:46
02:52
02:55
02:59
03:04
03:05
03:10
03:13
03:14
03:19
03:23
03:24
03:25
03:28
03:30
03:32
03:34
03:35
03:36
03:39
03:40
03:40
03:43
03:48
03:53
04:00
04:06
04:11
04:13
04:14
04:17
04:21
04:26
04:28
04:30
04:33
04:34
04:36
04:38
04:43
04:44
04:45
04:46
04:50
04:51
04:53
04:54
04:55
04:56
04:58
04:59
05:01
05:03
05:05
05:07
05:12
05:13
05:18
05:18
05:20
05:26
05:27
05:29
05:30
05:31
05:34
05:37
05:38
05:39
05:39
05:40
05:50
05:53
05:55
06:02
06:05
06:07
06:08
06:10
06:13
06:14
06:15
06:16
06:17
06:18
06:18
06:25
06:25
06:28
06:31
06:32
06:34
06:35
06:36
06:37
06:41
06:41
06:42
06:43
06:44
06:45
06:45
06:48
06:48
06:52
06:53
06:53
06:55
06:57
06:58
07:03
07:08
07:09
07:12
07:14
07:19
07:22
07:25
07:31
07:32
07:36
07:41
07:42
07:48
07:53
07:59
08:04
08:12
08:18
08:22
08:24
08:28
08:30
08:32
08:34
08:36
08:39
08:44
08:47
08:51
08:54
08:55
08:57
09:00
09:02
09:06
09:08
09:09
09:11
09:13
09:15
09:20
09:26
09:32
09:40
09:43
09:48
09:50
09:51
09:53
09:57
10:02
10:03
10:06
10:08
10:09
10:11
10:12
10:14
10:18
10:21
10:26
10:28
10:29
10:36
10:37
10:40
10:42
10:43
10:45
10:47
10:52
10:55
10:57
10:57
11:02
11:03
11:05
11:08
11:12
11:18
11:21
11:23
11:26
11:29
11:35
11:40
11:44
11:48
11:50
11:53
11:55
11:58
12:01
12:05
12:09
12:13
12:16
12:18
12:23
12:27
12:29
12:31
12:33
12:37
12:42
12:44
12:46
12:50
12:53
12:58
13:02
13:08
13:10
13:11
13:12
13:16
13:20
13:22
13:24
13:25
13:27
13:29
13:30
13:31
13:32
13:32
13:37
13:38
13:40
13:46
13:48
13:50
13:50
13:56
13:59
14:00
14:02
14:03
14:06
14:07
14:11
14:14
14:16
14:18
14:19
14:22
14:24
14:31
14:34
14:36
14:38
14:41
14:43
14:46
14:47
14:50
14:53
14:57
15:00
15:02
15:06
15:09
15:13
15:15
15:17
15:20
15:21
15:21
15:22
15:22
15:25
15:26
15:29
15:31
15:35
15:36
15:41
15:43
15:47
15:50
15:52
15:54
15:56
15:59
16:02
16:06
16:08
16:11
16:13
16:18
16:22
16:29
16:30
16:34
16:41
16:43
16:48
16:49
16:52
16:54
16:57
16:58
17:02
17:07
17:11
17:12
17:15
17:22
17:27
17:32
17:37
17:42
17:48
17:53
17:56
18:00
18:02
18:04
18:07
18:11
18:12
18:13
18:16
18:18
18:22
18:26
18:27
18:28
18:30
18:33
18:35
18:36
18:42
18:46
18:48
18:51
18:53
18:55
18:59
19:01
19:04
19:05
19:06
19:07
19:15
19:21
19:27
19:33
19:39
19:44
19:49
19:55
20:03
20:08
20:10
20:13
20:16
20:18
20:21
20:22
20:24
20:27
20:30
20:32
20:34
20:35
20:40
20:43
20:44
20:47
20:47
20:48
20:50
20:51
20:52
20:53
20:55
20:58
21:00
21:03
21:05
21:10
21:15
21:16
21:18
21:22
21:23
21:27
21:33
21:35
21:39
21:41
21:42
21:44
21:51
21:52
21:55
21:57
22:03
22:08
22:15
22:20
22:25
22:26
22:29
22:32
22:36
22:37
22:40
22:43
22:43
22:46
22:49
22:51
22:55
22:57
22:58
22:59
23:04
23:08
23:09
23:11
23:13
23:15
23:19
23:25
23:26
23:28
23:31
23:35
23:39
23:40
23:45
23:45
23:47
23:48
23:53
23:57
23:59
24:00
24:01
24:03
24:04
24:07
24:10
24:14
24:17
24:20
24:26
24:29
24:37
24:39
24:43
24:49
24:51
24:56
24:58
25:01
25:04
25:07
25:12
25:13
25:15
25:17
25:21
25:25
25:29
25:33
25:33
25:37
25:41
25:44
25:50
25:50
25:53
25:55
25:58
26:01
26:06
26:06
26:11
26:14
26:18
26:20
26:22
26:29
26:34
26:38
26:42
26:43
26:44
26:45
26:46
26:46
26:47
26:49
26:50
26:51
26:56
26:59
27:00
27:02
27:04
27:12
27:16
27:19
27:21
27:25
27:34
27:40
27:41
27:44
27:45
27:48
27:51
27:54
27:55
27:56
28:03
28:09
28:09
28:13
28:18
28:19
28:25
28:33
28:35
28:36
28:41
28:42
28:43
28:46
28:47
28:49
28:50
28:52
28:53
28:57
28:58
29:00
29:03
29:04
29:05
29:11
29:12
29:17
29:25
29:30
29:33
29:36
29:39
29:40
29:42
29:43
29:44
29:47
29:50
29:54
29:57
29:59
30:01
30:04
30:07
30:08
30:09
30:10
30:12
30:13
30:16
30:21
30:24
30:31
30:36
30:41
30:48
30:52
30:57
31:01
31:06
31:13
31:17
31:22
31:26
31:28
31:30
31:31
31:34
31:35
31:37
31:38
31:39
31:42
31:44
31:49
31:51
31:56
31:58
32:02
32:03
32:07
32:10
32:11
32:16
32:18
32:21
32:25
32:28
32:35
32:37
32:41
32:46
32:47
32:52
32:55
32:57
33:02
33:06
33:09
33:11
33:14
33:17
33:18
33:20
33:25
33:30
33:34
33:40
33:44
33:49
33:53
33:56
33:58
34:01
34:06
34:09
34:11
34:16
34:21
34:24
34:25
34:30
34:33
34:36
34:38
34:40
34:43
34:45
34:47
34:52
34:53
34:57
34:58
34:59
35:01
35:06
35:09
35:15
35:19
35:24
35:28
35:34
35:35
35:37
35:38
35:44
35:45
35:47
35:50
35:58
36:03
36:04
36:06
36:09
36:13
36:16
36:18
36:21
36:24
36:24
36:26
36:27
36:31
36:34
36:35
36:36
36:37
36:39
36:41
36:45
36:47
36:49
36:50
36:53
36:54
36:56
36:57
36:59
37:00
37:01
37:04
37:11
37:15
37:18
37:22
37:25
37:25
37:26
37:28
37:34
37:36
37:38
37:42
37:46
37:48
37:50
37:52
37:54
38:01
38:06
38:09
38:15
38:21
38:27
38:33
38:38
38:44
38:50
38:57
39:01
39:05
39:12
39:18
39:25
39:29


