Skip to content

Commit 32a6bc5

Browse files
Refactor _hooks.py into organized sibling modules by category
Split the large _hooks.py file (1132 lines) into three focused modules: - _hook_config.py: Configuration classes and type definitions (HookspecOpts, HookimplOpts, HookspecConfiguration, HookimplConfiguration) - _hook_markers.py: Hook decorators and specifications (HookspecMarker, HookimplMarker, HookSpec, varnames utility) - _hook_callers.py: Hook caller implementations and HookImpl (HookCaller protocol, NormalHookCaller, HistoricHookCaller, SubsetHookCaller, HookRelay, HookImpl) The original _hooks.py now serves as a backward compatibility module that re-exports all symbols, maintaining 100% API compatibility. Updated all internal imports across the codebase to use the new module structure while preserving existing public interfaces. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent dccd7cb commit 32a6bc5

File tree

8 files changed

+1248
-1155
lines changed

8 files changed

+1248
-1155
lines changed

src/pluggy/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
"PluggyWarning",
1919
"PluggyTeardownRaisedWarning",
2020
]
21-
from ._hooks import HistoricHookCaller
22-
from ._hooks import HookCaller
23-
from ._hooks import HookImpl
24-
from ._hooks import HookimplConfiguration
25-
from ._hooks import HookimplMarker
26-
from ._hooks import HookimplOpts
27-
from ._hooks import HookRelay
28-
from ._hooks import HookspecConfiguration
29-
from ._hooks import HookspecMarker
30-
from ._hooks import HookspecOpts
21+
from ._hook_callers import HistoricHookCaller
22+
from ._hook_callers import HookCaller
23+
from ._hook_callers import HookImpl
24+
from ._hook_callers import HookRelay
25+
from ._hook_config import HookimplConfiguration
26+
from ._hook_config import HookimplOpts
27+
from ._hook_config import HookspecConfiguration
28+
from ._hook_config import HookspecOpts
29+
from ._hook_markers import HookimplMarker
30+
from ._hook_markers import HookspecMarker
3131
from ._manager import PluginManager
3232
from ._manager import PluginValidationError
3333
from ._project import ProjectSpec

src/pluggy/_callers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import NoReturn
1212
import warnings
1313

14-
from ._hooks import HookImpl
14+
from ._hook_callers import HookImpl
1515
from ._result import HookCallError
1616
from ._result import Result
1717
from ._warnings import PluggyTeardownRaisedWarning

0 commit comments

Comments
 (0)