Skip to content

feat(implementation): add NormalImpl, WrapperImpl, and CompletionHook setup API - #707

Open
RonnyPfannschmidt wants to merge 5 commits into
pytest-dev:mainfrom
RonnyPfannschmidt:refactor/hookimpl-wrapper-types
Open

feat(implementation): add NormalImpl, WrapperImpl, and CompletionHook setup API#707
RonnyPfannschmidt wants to merge 5 commits into
pytest-dev:mainfrom
RonnyPfannschmidt:refactor/hookimpl-wrapper-types

Conversation

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

Step 04HookImpl becomes a base class holding hookimpl_config; NormalImpl / WrapperImpl validate their configuration; HookimplConfiguration.create_hookimpl() returns the right subclass; WrapperImpl.setup_and_get_completion_hook() exposes wrapper setup/teardown as a runtime-checkable CompletionHook.

Depends on #706 (includes it — full diff vs main).
Per-step diff for review: RonnyPfannschmidt#8

Refactoring series

Ordered re-implementation of the try-claude architecture experiments as reviewable steps (design writeups live in design/ inside the series). Each upstream PR shows the full cumulative diff against main; the linked chain PR on my fork shows only this step's changes:

Step Chain PR (per-step diff)
01 module split RonnyPfannschmidt#6
02 configuration objects RonnyPfannschmidt#5
03 markers attach config RonnyPfannschmidt#7
04 impl subclasses + CompletionHook API RonnyPfannschmidt#8
05 Protocol callers + multicall RonnyPfannschmidt#9
06 ProjectSpec RonnyPfannschmidt#10
07 async Submitter RonnyPfannschmidt#11

🤖 Generated with Claude Code

RonnyPfannschmidt and others added 5 commits July 24, 2026 18:48
Add the design/ writeup chain (decisions + per-step docs 01-07) that
guides the stacked refactoring branches. Exclude design/ from
blacken-docs since the docs use elided pseudo-code signatures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Move hook types, markers, callers, implementations, and multicall out of
the monolithic _hooks/_callers modules so later typed-config and
CompletionHook work can land without thrashing one huge file. Keep
_hooks and _callers as re-export shims for import compatibility.

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Cursor Grok 4.5 <grok@cursor.com>
Markers attach HookspecConfiguration/HookimplConfiguration objects.
Registration discovers those privately; parse_hookimpl_opts and
parse_hookspec_opts remain a deprecated pytest concession that returns
legacy dicts and is only called when a subclass overrides them and no
modern configuration attribute was found.

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Cursor Grok 4.5 <grok@cursor.com>
Complete design step 03: markers already attach configuration objects
since step 02; this finishes the step by storing the spec configuration
as HookSpec.config (try-claude naming) with a deprecated .opts alias,
reading .config in HookCaller firstresult resolution, and covering
decoration-time historic+firstresult validation and configuration
attachment with tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… setup API

Complete design step 04:

- HookImpl becomes a base class storing hookimpl_config (deprecated
  .opts alias kept) with arg binding moved to _get_call_args.
- NormalImpl / WrapperImpl subclasses validate their configuration;
  HookimplConfiguration.create_hookimpl() returns the right subclass
  (fixing the try-claude footgun of bare HookImpl for normals).
- WrapperImpl.setup_and_get_completion_hook() runs wrapper setup and
  returns a CompletionHook (runtime-checkable Protocol) that owns
  teardown, adapting old-style hookwrappers uniformly.
- Registration and call_extra construct impls via create_hookimpl;
  multicall binds args via _get_call_args. Full dual-sequence multicall
  rewiring lands with design step 05.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the refactor/hookimpl-wrapper-types branch from c5cf018 to 6338f75 Compare July 24, 2026 16:54
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.

1 participant