`packaging` is imported at runtime but not declared as a dependency
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 86/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- build-system
调研方向
阅读 faust/transport/drivers/aiokafka.py 第 52 行附近,确认 Version 来自 packaging.version 且是唯一使用处,然后添加一行 packaging(例如 packaging>=20.0)到 requirements/requirements.txt;仅检查 requirements/dist.txt 以了解为何之前假定它已存在。要验证,请从编辑后的 requirements 安装到一个新的 virtualenv 中,并带上 aiokafka==0.15.0,然后运行 python -c "import faust.transport.drivers.aiokafka"。完成意味着该 import 成功,且 packaging 不是由另一个包引入的。
由索引模型根据 Issue 内容生成。
描述
Summary
faust/transport/drivers/aiokafka.py line 52 does an unconditional from packaging.version import Version. packaging is not listed in requirements/requirements.txt, so it is not in the published Requires-Dist. It only appears in requirements/dist.txt, which is build tooling.
Until now this worked by accident, because aiokafka pulled packaging in. aiokafka 0.15.0 dropped packaging (and async-timeout) from its dependencies. Its requires_dist is now only typing-extensions; python_version<"3.12". A clean install of faust-streaming with aiokafka 0.15.0 therefore has no packaging, and the Kafka transport fails to import.
Versions
- faust-streaming 0.15.4 (latest on PyPI); also checked on master at ca53750
- aiokafka 0.15.0
- Python 3.12
Steps to reproduce
python -m venv /tmp/venv && . /tmp/venv/bin/activate
pip install "faust-streaming==0.15.4" "aiokafka==0.15.0"
pip uninstall -y packaging # only needed if something else in the env pulled it in
python -c "import faust.transport.drivers.aiokafka"
Actual
ModuleNotFoundError: No module named 'packaging'
Expected
The import succeeds, because packaging is installed as a declared dependency of faust-streaming.
Suggested fix
Add packaging to requirements/requirements.txt. It is used only for Version(aiokafka.__version__) comparisons, so a lower bound such as packaging>=20.0 should be enough.
Workaround
Pin packaging explicitly in the application's own requirements.
- 主要语言
- Python
- 星标
- 1.9k
- 派生
- 205
- 平均合并
- 2 小时 2 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
faust-streaming/faust 的其他 Issue
-
scripts/install script forces use of ./venv virtualenv, impossible to use with virtualenvwrapper未关闭
难度 1/5 1 小时以内 新手友好度 62/100
faust-streaming/faust#28 · 1 条评论 ·
-
[BUG] SASL PLAINTEXT producer initialization fails : missing sasl_plain_username/password可能已有人在做 @wbarnha 于 56 天前认领。 未关闭
faust-streaming/faust#794 · 2 条评论 · 1 个 reaction · 已指派 2 人 ·
-
难度 4/5 3-5 天 新手友好度 18/100
faust-streaming/faust#670 ·
-
难度 4/5 3-5 天 新手友好度 18/100
faust-streaming/faust#666 ·
-
难度 3/5 1-2 天 新手友好度 35/100
faust-streaming/faust#656 ·
查看 faust-streaming/faust 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
[Maintainer] task area:visualizer
难度 1/5 1 小时以内 新手友好度 78/100
RailtownAI/railtracks#1824 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
apache/datafusion#27688 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
heasarc/heasarc-tutorials#317 ·
-
bug good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
mloda-ai/mloda-registry#1664 ·
维护者通常 1 天内回复