bytecodealliance / bytecodealliance/componentize-py

anyio support

オープン
#145 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
277
フォーク
51
平均マージ
12時間 10分
マージ済み PR(30日)
10

説明

Hi 👋 I'm attempting to componentize a Python app which has `anyio` as a transitive dependency, but it seems that `anyio` imports `ssl` and the `ssl` module isn't present. As a simple repro, if I try to change the `import asyncio` to `import anyio` in the `http` example I see this:

```
❯ uv venv && uv pip install anyio
Using CPython 3.13.0
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
Resolved 3 packages in 1ms
Installed 3 packages in 6ms
+ anyio==4.8.0
+ idna==3.10
+ sniffio==1.3.1
❮ uvx componentize-py -d ../../wit -w wasi:http/proxy@0.2.0 componentize app -o http.wasm -p . -p .venv/lib/python3.13/site-packages
Traceback (most recent call last):
File "/home/ben/.cache/uv/archive-v0/7RckABgkkjmDH-UjGQyxC/bin/componentize-py", line 12, in
sys.exit(script())
~~~~~~^^
AssertionError: Traceback (most recent call last):
File "/0/app.py", line 8, in
import anyio
File "/1/anyio/__init__.py", line 26, in
from ._core._sockets import connect_tcp as connect_tcp
File "/1/anyio/_core/_sockets.py", line 6, in
import ssl
File "/python/ssl.py", line 100, in
import _ssl # if we can't import it, let the error propagate
^^^^^^^^^^^
ModuleNotFoundError: No module named '_ssl'

Caused by:
ModuleNotFoundError: No module named '_ssl'

```

I feel like I'm probably doing something wrong since I couldn't find anything on the issue board about this and it feels like it would have come up already 🤔

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、示されている componentize コマンドを使って http 例の app.py で発生する失敗を再現し、その後、componentize-py が ssl などの Python 標準ライブラリモジュールをどのようにパッケージ化しているかを調べます。例がコンポーネント化中に anyio を import でき、_ssl に対する ModuleNotFoundError が発生しなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, wasm
領域
devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
32/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。