allenai / allenai/ir_datasets

Plugins via importlib.metadata

未关闭
#297 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
391
派生
58
PR 合并指标
30 天内没有已合并 PR

描述

**Is your feature request related to a problem? Please describe.**
Right now, it is possible to define extension packages, e.g., [ir-datasets-clueweb22](https://github.com/janheinrichmerker/ir-datasets-clueweb22), that define additional datasets.
Though, users of these packages must explicitly register their extra packages to ir_datasets, e.g., by calling the plugin-specific `register()` function. This behavior is error-prone, since the datasets have to be registered before any other code accesses the data.

**Describe the solution you'd like**
In Python package metadata, we can define plugins, which could then automatically be discovered by the main ir_datasets package:
https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata
https://setuptools.pypa.io/en/latest/userguide/entry_point.html#entry-points-for-plugins
No more `register()` call or otherwise manual registration would be necessary.
Additionally, since package metadata can be accessed at any time, ir_datasets can by design make sure that any dataset from a plugin is registered before `ir_datasets.load()` is called for the first time.

**Describe alternatives you've considered**
The easiest alternative would be to keep the old behavior where users need to explicitly register extension packages' datasets.

**Additional context**
-/-

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。