Simon Willison 博客· Simon Willison·· 2026-05-31精选AI 评分73
在浏览器中通过 Pyodide 和 Service Worker 运行 Python ASGI 应用
Running Python ASGI apps in the browser via Pyodide + a service worker
AI 导读
作者展示了如何在浏览器中通过 Pyodide 和 Service Worker 运行 Python ASGI 应用。此前的 Datasette Lite 使用 Web Workers,但无法执行 `<script>` 标签中的 JavaScript。新方案由 Claude Opus 4.8 协助完成开发,解决了这一问题。作者已展示了基础的 ASGI FastCGI 演示和运行 Datasette 1.0a31 的演示,并计划后续将此方法应用于升级 Datasette Lite。
推荐理由
Simon Willison 用 Service Worker 让 Python ASGI 在浏览器里真正跑了起来,这个技巧补上了 Datasette Lite 长期缺的 JS 执行能力,搞 Pyodide 的值得看看。
来源:Simon Willison 博客 · simonwillison.net