I'm using Pluggy to build a plugin system for a Python application. Everything works fine for most hooks, but I'm having a persistent issue where keyword arguments (kwargs) passed from my call_hook() function are not showing up in the plugin function. Here’s a simplified version of the code: Hook specification (plugin_hooks.py): @hookspec def discover_files(directory: str, recursive: bool, reprocess: bool) -> list: """Discover files in the given directory.""" Hook implementation (file_discovery_plugin.py): @hookimpl def discover_files(directory: str, recursive: bool = False, reprocess: bool = False) -> list: print("recursive:", recursive) # Always prints: False print("reprocess:", reprocess) # Always prints: False Plugin invocation: logger.debug("Calling hook '%s' with args=%s, kwargs=%s", hook_name, args, kwargs) result = hook(*args, **kwargs) return result Logging Output: [DEBUG] __main__: Reprocess flag passed to discover_files: True [DEBUG] core.plugin_manager: Calling hook 'discover_files' with args=(), kwargs={'directory': 'C:\\input', 'recursive': False, 'reprocess': True} [DEBUG] file_discovery_plugin: reprocess flag in discover_files: False Despite clearly passing reprocess=True, the plugin function always receives the default False. What I’ve tried: Confirmed the hook is correctly registered Confirmed the parameters match between @hookspec and @hookimpl Printed kwargs in the plugin and verified that it's empty ({}) Tried Python 3.10 and 3.11 — same behavior Manually invoking the plugin bypassing Pluggy works as expected Workaround: As a workaround, I'm bypassing Pluggy for this hook and manually calling plugin.discover_files(...) from my plugin_manager. That works, but I’d prefer to use Pluggy’s dispatch model if possible. Question: Is there a known issue with Pluggy not forwarding kwargs to plugin implementations? Or is there a subtle requirement in how @hookimpl functions are defined that I’m missing? I've been scratching my head over this for a while and any help or insight would be appreciated! Continue reading...