Skip to content

feat: support third-party task registration via unilab.tasks entry-point group - #1501

Merged
TATP-233 merged 1 commit into
mainfrom
feat/issue-1500-entry-point-registry
Sep 4, 2026
Merged

feat: support third-party task registration via unilab.tasks entry-point group#1501
TATP-233 merged 1 commit into
mainfrom
feat/issue-1500-entry-point-registry

Conversation

@TATP-233

@TATP-233 TATP-233 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #1500

范围(roadmap #1252 第 4 点)

第三方 task 包通过 Python package metadata 自动注册:声明 unilab.tasks entry-point group(value = 包名)即可被 ensure_registries() 自动发现并执行 package import,无需 PYTHONPATHUNILAB_TASK_PACKAGES

  • base/registry.pyensure_registries() 在 env var fallback 之后从 unilab.tasks entry-point group 追加包名;entry-point 包保持 strict(导入失败即 raise,便于发现打包错误),env var 包维持 optional 语义。
  • 兼容:现有注册任务、env var、_REGISTERED_TASK_PACKAGES 全兼容;entry-point 只做增量追加(已注册包去重)。
  • 测试:3 个新测试(mock entry point 的 task 发现 / 默认包去重 / 导入失败 strict raise)。
  • 文档(en + zh):1-architecture/5-registry.md 运行时流程与扩展规则;3-extending/1-new_task.md 实现清单补第三方包注册方式。

Validation

最终 head 27ebee04 本地 make test-all PASS(exit 0):

  • ruff check / format:PASS
  • mypy --strict:PASS(0 issues)
  • pyright:PASS(0 errors)
  • pytest:1571 passed, 20 skipped, 882 deselected, 1 xfailed
  • benchmark smoke(所有训练脚本 + 脚本 import smoke):35/36 + 36/37 全过(1 个 mlx benchmark 为 darwin-only 可选 skip)

后续

microduck_rl_unilab / engineai_rl_unilab 声明各自 unilab.tasks entry point 后即可移除 UNILAB_TASK_PACKAGES,作为本机制的首批 adoption 验收。

…ks entry-point group

ensure_registries() now also collects bootstrap packages declared through
the 'unilab.tasks' entry-point group, in addition to the built-in
unilab.tasks package and the UNILAB_EXTRA_REGISTRY_PACKAGES env var (kept
as the test-fixture/ad-hoc seam). Entry-point metadata lives in
site-packages, so spawn-based collector subprocesses discover the same
packages without env-var forwarding; entry-point import failures fail
closed, unlike env-var packages.

Closes the gap tracked in #1500 (roadmap #1252 item 4).
@TATP-233
TATP-233 merged commit 0b930fd into main Sep 4, 2026
7 checks passed
@TATP-233
TATP-233 deleted the feat/issue-1500-entry-point-registry branch September 4, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

第三方 task 包 unilab.tasks entry-point group 注册路径(roadmap #1252 第 4 点)

1 participant