newsmode
search
Меню
arrow_back Назад

Running Python ASGI apps in the browser via Pyodide + a service worker

auto_awesomeКраткое саммари

Simon Willison рассказывает о Datasette Lite — версии Datasette, которая целиком работает в браузере через Pyodide и WebAssembly. В исходной реализации четырёхлетней давности он использовал Web Workers, перехватывающие навигацию, но при этом JavaScript внутри тегов <script> не выполнялся, что ломало часть функций Datasette и множество плагинов. Утром 30 мая 2026 года автор поручил Claude Opus 4.8 (в Claude Code for web) разобраться, как запускать Python ASGI-приложения в Pyodide с помощью Service Workers, и это сработало. В качестве примеров приведены базовое ASGI-демо и демо с Datasette 1.0a31. Автор ещё разбирается в деталях работы, но планирует затем обновить и сам Datasette Lite.

30th May 2026

Datasette Lite is my version of Datasette that runs entirely in the browser using Pyodide in WebAssembly.

When I first built it four years ago I used Web Workers and code that intercepts navigation operations and fetches the generated HTML by running the Python app.

This worked, but had the disadvantage that any JavaScript in <script> tags would not be executed - breaking some Datasette functionality and a whole lot of Datasette plugins.

This morning I set Claude Opus 4.8 the task (in Claude Code for web) of figuring out how to run Python ASGI apps in Pyodide using Service Workers instead, and it seems to work! Here's a basic ASGI FastCGI demo and here's a demo that runs Datasette 1.0a31.

I'm still getting my head around exactly how it works, but once I've done that I plan to upgrade Datasette Lite itself.

Recent articles

This is a beat by Simon Willison, posted on 30th May 2026.

Monthly briefing

Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.

Pay me to send you less!