bytecodealliance / bytecodealliance/componentize-py

anyio support

Đang mở
#145 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
277
Fork
51
Merge trung bình
12 giờ 10 phút
Pull request đã merge (30 ngày)
10

Mô tả

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 🤔

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi trong app.py của ví dụ http bằng lệnh componentize được cung cấp, sau đó kiểm tra cách componentize-py đóng gói các mô-đun thư viện chuẩn của Python như ssl. Hoàn thành khi ví dụ có thể import anyio trong quá trình componentization mà không phát sinh ModuleNotFoundError đối với _ssl.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python, wasm
Lĩnh vực
devtools
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
32/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.