python / python/importlib_metadata
Accept `types.ModuleType` as a distribution identifier
未关闭
还没有人认领这个 Issue。
enhancement
feature
help wanted
- 主要语言
- Python
- 星标
- 142
- 派生
- 97
- PR 合并指标
- 30 天内没有已合并 PR
描述
I have recently ran into the issue where the importable module did not come from the distribution metadata found by importlib.metadata. This was because the distribution modules were shadowed in sys.path, which can happen often in test environments.
It would be nice if we could pass a module to importlib.metadata.distribution(), and have it find the distribution where that module originates from, if any.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 importlib.metadata.distribution() 入口点开始,检查 distribution 标识符的解析方式,重点关注 types.ModuleType 以及 sys.path 中被遮蔽的模块。确定传入模块时应如何查找其来源 distribution,包括不存在 distribution 的情况。当模块可以作为标识符被接受,并且针对被遮蔽模块的行为已由测试覆盖时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100