Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Feature request: declarative ordering of hookimpls relative to other plugins (before/after), beyond tryfirst/trylast

未关闭
#705 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
python
领域
tooling

调研方向

先阅读当前 tryfirst 和 trylast hook 的排序行为,以及所引用的 pytest issue。该 issue 还指出,_HookCaller._nonwrappers 是用户目前会检查的 private API。要完成这项工作,需要先为声明式排序制定一个获认可的设计,包括冲突和循环,然后进行实现和测试;维护者目前质疑这是否值得投入。

由索引模型根据 Issue 内容生成。

描述

pluggy currently offers only tryfirst and trylast booleans to control hook order, which remains arbitrary within each of the three categories. Some users want to declare that their hookimpl must run before or after a specific other plugin or hookimpl, and so several pytest issues conclude that the fix (if any) belongs in pluggy:

  • pytest-dev/pytest#13371 — "Provide a better way to schedule hooks ordering." Request for before=/after= ordering relative to named plugins.
  • pytest-dev/pytest#2364 — "undeterministic order of pytest_configure for conftest-loaded plugins." Core/entrypoint/conftest plugins end up in an effectively random relative order; the issue explicitly notes "this may need actual dependency ordering support in pluggy."
  • #250 — an existing user question about reordering hookimpls after registration by poking _HookCaller._nonwrappers (private API), which shows people already reach for unsupported internals to get this.

Personally I'm inclined to close this issue as wontfix, because it's absolutely classic "what if two programs did this" fodder. Even if we proposed to error on such cases and do a fancy toposort on the rest, I don't think it'd be worth the complexity.

主要语言
Python
星标
1.7k
派生
187
平均合并
1 天 14 小时
30 天内合并 PR
23

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pytest-dev/pluggy 的其他 Issue

查看 pytest-dev/pluggy 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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