Pyodide で利用可能な WASM ウィールを PyPI に公開する方法
本文の状態
日本語全文を表示中
詳細モードで約4分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Simon Willison Blog
Simon Willison は、Pyodide や PEP 783 に準拠する Python ランタイム向けにビルドされたパッケージを、直接 PyPI に公開してインストールできるようになったと報告した。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
Pyodide 314.0 リリースの発表(Hacker News を経由)には、私が長年待ち望んでいたニュースが含まれています:
今や、Pyodide(または PEP 783 で定義された PyEmscripten プラットフォーム に互換性のある任意の Python ランタイム)向けにビルドされた Python パッケージを、直接 PyPI に公開し、実行時にインストールすることが可能になりました。
以前は、Pyodide のメンテナーが 300 以上のパッケージ自体を維持・構築・ホストする必要があり、これはメンテナーにとって大きな負担となり、コミュニティにおける主要なボトルネックとなっていました。なぜなら、新しいパッケージごとに手動でのレビューが必要だったからです。
今後は、パッケージのメンテナーは、Linux、macOS、Windows のネイティブ用ホイールで行うのと同じように、Pyodide 用のホイールを構築して PyPI に公開するだけで済みます。
これは 4 月 21 日にマージされた、この機能をサポートする PyPI 自体への PR です。
私は Pyodide を愛していますが、過去にはこの制限に frustration を感じていました。C や Rust の拡張をホイールファイル内で WASM にコンパイルすることは可能ですが、これまでそれを配布するための簡単な方法はありませんでした。
多くの人々の努力のおかげで、その問題は解決されました!
luau-wasm で試してみる
お祝いも兼ねて、パッケージ化できるものを探してみました。実験的な Pyodide プロジェクトがいくつか手元にありますが、今回の目的に最も適しているのは、3 月 9 日に公開した Luau WebAssembly 研究スプイク のようです。
Luau は、「段階的型システムを備えた、小さく高速で埋め込み可能なプログラミング言語」であり、Lua をベースにしています。これは Roblox によって開発され、MIT ライセンスの下でリリースされています。
この言語は C++ で書かれています。WebAssembly にコンパイルして Pyodide の内部で実行可能であることはすでに知っていましたので、Codex と GPT-5.5 xhigh を使って、私の実験をパッケージ化し、GitHub Actions を利用して PyPI へ公開するタスクを任せてみました。
いくつかの試行錯誤を経て、最終的な結果がこちらです:luau-wasm は、Pyodide で以下のように使用できる、276KB の luau_wasm-0.1a0-cp314-cp314-pyemscripten_2026_0_wasm32.whl ファイルを公開する、全く新しい PyPI パッケージです。
micropip をインポートします。
await micropip.install("luau-wasm")
import luau_wasm
print(luau_wasm.execute(r'''
local animals = {"fox", "owl", "frog", "rabbit"}
table.sort(animals, function(a, b) return #a
for i, name in animals do print(i .. ". " .. name .. " (" .. #name .. ")") end
'''))
このコードは、Pyodide REPL デモ で実行して動作を確認できます。
luau-wasm の GitHub リポジトリ には、ビルドおよびデプロイ用のスクリプト(最新の cibuildwheel を使用)がすべて含まれており、Pyodide を読み込んで luau-wasm をインストールし、試すためのインターフェースを提供する HTML デモページもデプロイされています:https://simonw.github.io/luau-wasm/

現在、このプラットフォーム向けにウェルを公開しているパッケージはどれくらいあるのでしょうか?
私は、現在どのくらいの数のパッケージがこのプラットフォーム向けにウェル(wheel)を公開しているのか気になりました。
ChatGPT でいくつか試行錯誤した結果、PyPI の BigQuery 上の公開データセット を対象に実行できる この BigQuery SQL にたどり着きました。クエリ結果の 生 JSON と、最新アップロード日に基づいてパッケージを重複排除する SQLite SQL クエリが Datasette Lite 上で動作しています。
クエリが正しければ、現在 28 の PyPI パッケージが新しい pyemscripten_202*_wasm32 タグを使用して公開されています。
luau-wasm、uuid7-rs、cmm-16bit、pyOpenTTDAdmin、imgui-bundle、numbertoolkit、bashkit、geoarrow-rust-core、arro3-io、arro3-core、arro3-compute、onnx、powerfit-em、tcod、chonkie-core、tokie、robotraconteur、pydantic_core、yaml-rs、cadquery-ocp-novtk-OCP.wasm、uuid_utils、base64_utils、pycdfpp、lib3mf-OCP.wasm、typst、toml-rs、onnx-weekly、dummy-pyodide-ext-test
今後数ヶ月から数年の間に、これらが増えることを願っています。
Tags: lua, pypi, python, sandboxing, webassembly, github-actions, pyodide
原文を表示
The Pyodide 314.0 release announcement (via Hacker News) includes news I've been looking forward to for a long time:
You can now publish Python packages built for Pyodide (or any Python runtime compatible with the PyEmscripten platform defined in PEP 783) directly to PyPI and install them at runtime.
Previously, the Pyodide maintainers had to maintain, build, and host over 300 packages ourselves. This created a significant burden on our maintainers and became a major bottleneck for the community, as every new package required manual review.
Moving forward, package maintainers can simply build and publish Pyodide wheels to PyPI, just as they do for native wheels on Linux, macOS, or Windows.
Here's the PR to PyPI itself supporting this, which landed on April 21st.
I adore Pyodide, and have been frustrated in the past by this limitation. It's possible to compile C or Rust extensions to WASM in a wheel file, but before now there was no easy way to distribute them.
Thanks to the efforts of a whole lot of people, that's now been fixed!
Trying it out with luau-wasm
I decided to celebrate by finding something I could package. I have quite a few experimental Pyodide projects lying around, but the best fit for this looked to be my Luau WebAssembly research spike from 9th March.
Luau is a "small, fast, and embeddable programming language based on Lua with a gradual type system", developed by Roblox and released under an MIT license.
It's written in C++. I already knew it was possible to compile it to WebAssembly and get it running inside of Pyodide, so I set Codex + GPT-5.5 xhigh the task of packaging my experiment up and publishing it to PyPI using GitHub Actions.
It took some iteration, but here's the result: luau-wasm is a brand new PyPI package which publishes a 276KB luau_wasm-0.1a0-cp314-cp314-pyemscripten_2026_0_wasm32.whl file which can be used in Pyodide like this:
import micropip
await micropip.install("luau-wasm")
import luau_wasm
print(luau_wasm.execute(r'''
local animals = {"fox", "owl", "frog", "rabbit"}
table.sort(animals, function(a, b) return #a
for i, name in animals do print(i .. ". " .. name .. " (" .. #name .. ")") end
'''))You can run that code in the Pyodide REPL demo to see it in action.
The GitHub repo for luau-wasm includes all of the build and deploy scripts (using the latest cibuildwheel) and also deploys an HTML demo page which loads Pyodide, installs luau-wasm and provides an interface for trying it out: https://simonw.github.io/luau-wasm/

How many packages are using this so far?
I was curious to see how many packages are currently publishing wheels for this platform.
After some tinkering with ChatGPT I got to this BigQuery SQL which I ran against PyPI's public dataset on BigQuery. Here's the raw JSON of query results and here's a SQLite SQL query in Datasette Lite which dedupes packages by most recent upload date.
If the query is right, there are currently 28 PyPI packages publishing with the new pyemscripten_202*_wasm32 tags:
luau-wasm, uuid7-rs, cmm-16bit, pyOpenTTDAdmin, imgui-bundle, numbertoolkit, bashkit, geoarrow-rust-core, arro3-io, arro3-core, arro3-compute, onnx, powerfit-em, tcod, chonkie-core, tokie, robotraconteur, pydantic_core, yaml-rs, cadquery-ocp-novtk-OCP.wasm, uuid_utils, base64_utils, pycdfpp, lib3mf-OCP.wasm, typst, toml-rs, onnx-weekly, dummy-pyodide-ext-test
Here's hoping we see a whole lot more of those showing up over the coming months and years.
Tags: lua, pypi, python, sandboxing, webassembly, github-actions, pyodide
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み