Add a `Distribution.editable` property
还没有人认领这个 Issue。
评估
调研方向
首先跟踪 Distribution API 及其 origin 数据,然后查看 PEP 610 中关于 dir_info 和 editable 的 direct_url.json 规则。完成的标准是新属性暴露一个布尔值,并在缺少 origin 或 editable 信息时返回 false。
由索引模型根据 Issue 内容生成。
描述
Recently, when trying to check if a distribution is editable, I noticed doing so using the current API is very un-ergonomic. This information is available via the direct_url.json file of PEP 610, which is exposed in Distribution.origin.
When url refers to a local directory, the dir_info key MUST be present as a dictionary with the following key:
editable(type:boolean):trueif the distribution was installed in editable mode,falseotherwise. If absent, default tofalse.
So, to check if the distribution is editable, we can check Distribution.origin.dir_info.editable, however, Distribution.origin might be None (no direct_url.json), and Distribution.origin.dir_info might not be set (url in direct_url.json in not a local directory), which.
is_editable = distribution.origin and distribution.origin.dir_info and distribution.origin.dir_info.editable
try:
is_editable = distribution.origin.dir_info.editable
except AttributeError:
is_editable = False
It would be helpful to have this information available via a more ergonomic API.
- 主要语言
- Python
- 星标
- 142
- 派生
- 97
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/importlib_metadata 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
python/importlib_metadata#535 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
python/importlib_metadata#528 · 4 条评论 ·
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 68/100
python/importlib_metadata#526 · 6 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
python/importlib_metadata#525 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 35/100
python/importlib_metadata#540 · 1 条评论 ·
查看 python/importlib_metadata 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·