-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document implprefix argument? #114
Comments
Hi @anthrotype glad to hear you're considering
Yes you have it. The decorator API is the more mature approach and is preferred. This makes hooks and specs explicit and avoids hard to detect problems for contributor's to your project who aren't aware of the naming implications. If you look at the @RonnyPfannschmidt @nicoddemus @hpk42 please chime in if I'm incorrect in any of these assumptions. |
Thanks for the clarification. “Explicit is better than implicit”! |
Indeed we use them for hook specs, but we don't require the decorator for hook implementations. Pretty much every pytest plugin still relies on the |
Indeed, I remember that now. @nicoddemus that should be something to change no? |
I suggest for us to move this over to #116. |
Hi,
I'm new to the project and I'm considering using pluggy in my own application.
So I started by looking at pluggy's documentation, as well as the way it's being used by pytest.
While looking at the latter, I noticed that the
PluginManager
can also take aimplprefix
argument in order to search for matching names in a plugin namespace to be registered as hook implementations.I also noticed pytest plugins have hooks prefixed with "pytest_", and it doesn't seem necessary to mark implementations with
pytest.hookimpl
decorator to make them discoverable; the latter is of course required if one wishes to customize the behavior of a hook (by passing options to the decorator like hookwrapper, optionalhook, etc.).As far as I can see, the main pluggy documentation at http://pluggy.readthedocs.io/en/latest/ only mentions the
HookimplMarker
decorator as the way to mark a function for detection by a PluginManager'sregister
method.It's true that
implprefix
is mentioned in the "Public API" section of the docs, as it's in the PluginManager's docstring. However, maybe it could be featured more prominently in the main section?Or is this intentional and the decorator approach is the method which should be preferred for detection of hook implementations?
Thank you
The text was updated successfully, but these errors were encountered: