python / python/importlib_metadata
Using entry-point `value` for non-object references
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 142
- 派生
- 97
- PR 合并指标
- 30 天内没有已合并 PR
描述
napari uses the entry-point value for non-object references, i.e. a file path to load metadata from (i.e. as module:file_path).
This pattern seemed like a good idea for certain use cases. The main idea is that only reading metadata effectively ensures that we do no costly imports until we actually need to (which may be never).
Now, I noticed that since gh-518 such (ab)use is more heavily policed, since loading will fail immediately and not just when EntryPoint.load() is actually called.
So I suppose I have to comments/questions:
- The idea of (ab)using the entry-point for a metadata file seems neat to me. Would it be OK to accept it as use (even if not common or advertised) or is there a reason against it?
- Raising an error at
EntryPointconstruction itself fails already atimportlib_metadata.entry_points(group="my_group"), which means that a bad entry-point cannot be skipped (unlike if it fails forEntryPoint.load()which may be guarded with a try/except).
EDIT: I just noticed thatgroup=seems to be applied afterEntryPointcreation. So a single bad entry-point will break any project loading entry-points.
Neither of these are big issues, in practice a filename usually conforms (or can be made to conform) to a Python object reference, so there is nothing stopping us from just keeping to use it. But it seemed like a good thing to check in, if just for awareness that this pattern exists in the wild.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 issue 中描述的 EntryPoint 构造和 entry_points(group=...) 行为,然后检查 gh-518 中的更改。确定是否应接受非对象的 entry-point 值,以及在组选择期间是否可以跳过无效条目;完成条件是有一项记录在案的决定,以及相应的行为或测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100