Browser-Native Python Data Persistence: What the OPFS + Pyodide Harness Proves
Simon Willison used Claude Code to build a cross-browser test harness exploring whether Datasette Lite can read and write persistent SQLite files via the browser's Origin Private File System — a small experiment with large implications for client-side data tooling.
By TRAGenX Desk
Simon Willison — creator of Datasette and Django co-creator — published a concise but telling experiment this week. He wanted to know whether Datasette Lite — the full Datasette Python application running entirely in the browser via Pyodide — could *edit* SQLite files stored persistently on a user's local machine. The answer required building a test harness first, and he reached for Claude Code to get it done fast.
The Stack: Three Pieces That Had to Click
The experiment combines three browser technologies that have each matured independently:
- Pyodide — CPython compiled to WebAssembly. Lets you run real Python (including
sqlite3, pandas, NumPy) inside a browser tab, no server involved. - OPFS (Origin Private File System) — A browser File System API that gives a web origin its own sandboxed, persistent directory. Data survives page reloads and browser restarts. Unlike
localStorage, it handles binary files and large datasets cleanly. - Datasette Lite — Datasette compiled to run entirely in-browser via Pyodide. Previously read-only against uploaded or remote SQLite files; Willison wanted to test writable, *persistent* local storage.
The core question: can Pyodide's sqlite3 module write to a file handle opened via OPFS, and does that data actually persist across sessions? The answer varies by browser, which is exactly why you need a cross-browser harness to generate real data rather than rely on spec assumptions.
Vibecoding the Harness: Claude Code as Prototyping Partner
Rather than building the playground UI from scratch, Willison used Claude Code — Anthropic's agentic coding tool — to generate it. This is the pattern experienced builders are settling into: use AI to collapse the gap between "I want to test X" and "I have a working test environment for X." The harness exists to generate empirical compatibility data across Chrome, Firefox, and Safari. Speed to insight was the goal, not elegance of implementation.
The framing matters here. Willison is not a junior developer offloading code he does not understand — he is a practitioner with deep expertise using AI as a force-multiplier on exploratory work. That is the productive end of vibecoding: cut prototype time on uncertain terrain so you find out what is actually true faster, then decide whether to invest further.
Why Fintech and Data Builders Should Pay Attention
If the OPFS + Pyodide + SQLite combination proves stable across browsers, it enables a class of applications that currently require a backend purely to persist user data. Consider: offline-capable portfolio trackers, local-first audit logs, compliance tools that never write to a server, or browser-side backtesting sandboxes. The privacy and latency properties alone are worth the investigation — data stays on the user's machine while full Python analytics run client-side.
This is still experimental. OPFS browser support and the Pyodide sqlite3 integration both have rough edges in practice, particularly around synchronous access patterns from Web Workers. But making the playground public means the community surfaces the compatibility matrix for free, which is a smarter way to gather that signal than reading spec documents.
FAQ
Frequently asked questions
- What is OPFS and how does it differ from localStorage?
- OPFS (Origin Private File System) is a browser API that provides a sandboxed, persistent local filesystem scoped to a web origin. Unlike localStorage (which stores strings with strict size limits) or IndexedDB (optimized for structured records), OPFS handles arbitrary binary files — including SQLite databases — and is designed for high-performance file I/O, including access from Web Workers.
- What can Pyodide run in the browser?
- Pyodide is CPython compiled to WebAssembly. It runs in the browser and supports a large portion of the Python standard library — including sqlite3 — plus scientific packages such as NumPy and pandas. Code executes client-side with no Python server required.
- Is the OPFS + Pyodide + SQLite stack production-ready?
- Not in a general sense yet. Browser support for OPFS is broad but behavior in edge cases — particularly synchronous file access from workers — varies by engine. Willison's harness is designed to map exactly those gaps. It is a promising direction, not a solved stack.
Sources
- OPFS + Pyodide test harness — Simon Willison
- Origin private file system — MDN Web Docs — MDN Web Docs
- Pyodide: Python in the Browser — Pyodide Project