Skip to content

Commit 49968c2

Browse files
author
Tyler Goodlet
committed
Deprepate implprefix arg to PluginManager
Resolves #116
1 parent aeb1f67 commit 49968c2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pluggy/manager.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ class PluginManager(object):
4040
"""
4141

4242
def __init__(self, project_name, implprefix=None):
43-
""" if implprefix is given implementation functions
43+
"""If ``implprefix`` is given implementation functions
4444
will be recognized if their name matches the implprefix. """
4545
self.project_name = project_name
4646
self._name2plugin = {}
4747
self._plugin2hookcallers = {}
4848
self._plugin_distinfo = []
4949
self.trace = _tracing.TagTracer().get("pluginmanage")
5050
self.hook = _HookRelay(self.trace.root.get("hook"))
51+
if implprefix is not None:
52+
warnings.warn(
53+
"Support for the `implprefix` arg is now deprecated and will "
54+
"be removed in an upcoming release. Please use HookimplMarker.",
55+
DeprecationWarning
56+
)
5157
self._implprefix = implprefix
5258
self._inner_hookexec = lambda hook, methods, kwargs: \
5359
hook.multicall(
@@ -106,7 +112,14 @@ def parse_hookimpl_opts(self, plugin, name):
106112
if res is not None and not isinstance(res, dict):
107113
# false positive
108114
res = None
115+
# TODO: remove when we drop implprefix in 1.0
109116
elif res is None and self._implprefix and name.startswith(self._implprefix):
117+
_warn_for_function(
118+
DeprecationWarning(
119+
"The `implprefix` system is deprecated please decorate "
120+
"this function using an instance of HookimplMarker."),
121+
method
122+
)
110123
res = {}
111124
return res
112125

0 commit comments

Comments
 (0)