Legacy singbox protobuf gencode prevents further loading
還沒有人認領這個 Issue。
評估
研究方向
在使用 protobuf-5.28.3 且不含 C 描述子的 python:3.13.2-alpine3.21 容器中重現匯入失敗。從 traceback 中的 xtlsapi/init.py、singbox_api/stats_pb2.py 與 singbox_api/extensions_pb2.py 開始。當 XrayClient 在該環境中能夠成功匯入,且 singbox API 仍然可用時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
Hi team hiddify,
It's an awesome xtlsapi you created. It works well on windows, but there were issues when I tried to deploy it on docker. I encountered the following problem in python:alpine container, causing the container to fail to start:
>>> from xtlsapi import XrayClient
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
from xtlsapi import XrayClient
File "/usr/local/lib/python3.13/site-packages/xtlsapi/__init__.py", line 2, in <module>
from xtlsapi.client.SingboxClient import SingboxClient
File "/usr/local/lib/python3.13/site-packages/xtlsapi/client/SingboxClient.py", line 3, in <module>
from xtlsapi.singbox_api_services import APIService
File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api_services/__init__.py", line 1, in <module>
from .stats import StatsAPIService
File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api_services/stats/__init__.py", line 1, in <module>
from .get_client_upload_traffic import GetClientUploadTraffic
File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api_services/stats/get_client_upload_traffic.py", line 2, in <module>
from xtlsapi.singbox_api import stats_pb2
File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api/stats_pb2.py", line 14, in <module>
from . import extensions_pb2 as extensions__pb2
File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api/extensions_pb2.py", line 22, in <module>
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(message_opt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'MessageOptions' has no attribute 'RegisterExtension'
This seems to be related to https://github.com/mlflow/mlflow/issues/11811. Legacy singbox protobuf gencode prevents further loading when using protobuf without C descriptors, even if not singbox module is imported.
To Reproduce
It's easy to reproduce:
docker run -it python:alpine /bin/sh
pip install xtlsapi
from xtlsapi import XrayClient
Expected behavior
Upgrade singbox protobuf gencode, or lazy import singbox part.
Desktop (please complete the following information):
- docker image python:3.13.2-alpine3.21
- OS: Alpine Linux 3.21
- Python 3.13.2
- using protobuf without C descriptors, like protobuf-5.28.3-py3-none-any.whl
- 主要語言
- Python
- 星號
- 64
- 分支
- 20
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
hiddify/xtlsapi 的其他 Issue
-
bug help wanted
難度 4/5 3-5 天 新手友好度 15/100
-
bug help wanted
難度 3/5 1-2 天 新手友好度 48/100
-
難度 4/5 3-5 天 新手友好度 25/100
-
enhancement question
難度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
documentation
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
Install the skills as a Claude Code plugin可能已有人在做 @ruban-24 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 6 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
FAIRmat-NFDI/pynxtools#874 ·
-
data
難度 2/5 1-3 小時 新手友好度 66/100