anyio support

未关闭
#145 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

首先,使用所示的 componentize 命令在 http 示例的 app.py 中重现该故障,然后检查 componentize-py 如何打包 ssl 等 Python 标准库模块。当该示例能够在组件化过程中导入 anyio,且不会因 _ssl 引发 ModuleNotFoundError 时,即视为完成。

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

描述

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/[email protected] 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 <module>
    sys.exit(script())
             ~~~~~~^^
AssertionError: Traceback (most recent call last):
  File "/0/app.py", line 8, in <module>
    import anyio
  File "/1/anyio/__init__.py", line 26, in <module>
    from ._core._sockets import connect_tcp as connect_tcp
  File "/1/anyio/_core/_sockets.py", line 6, in <module>
    import ssl
  File "/python/ssl.py", line 100, in <module>
    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 🤔

主要语言
Rust
星标
284
派生
56
平均合并
2 天 4 小时
30 天内合并 PR
3

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bytecodealliance/componentize-py 的其他 Issue

查看 bytecodealliance/componentize-py 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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