bytecodealliance / bytecodealliance/componentize-py

anyio support

未关闭
#145 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
277
派生
51
平均合并
12 小时 10 分钟
30 天内合并 PR
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,且不会因 _ssl 引发 ModuleNotFoundError 时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python, wasm
领域
devtools
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
32/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。