pytest-dev/pluggy

pluggy vs namespace packages

hamelsmu opened this issue · 4 comments

Hello, I am just getting started with plugins. I am sorry for opening an issue, I don't know how else to ask a general question.

I started from the python documentation and have been directed to namespace packages, particularly native namespace packages as a way of achieving plugins.

In the Why is it useful? section pluggy's website, it does mention things like method overriding and money patching.

My general question is, how do I know if pluggy is right for me? Does anyone have a primer I can read on the benefits of using pluggy vs using something like namespace packaging? I am trying to figure out what the high level features are that I will benefit from before diving in.

If someone has any pointers or reference materials - I am happy to study that and then make a PR towards the docs to aid other beginners like me.

Thanks so much for your help.

Pluggy and namespace packages are completely orthogonal

Namespace packages are a way of organising modules

Pluggy plugins are a way of organising invocation of "hooks" that compose a certain program

Thanks much, @RonnyPfannschmidt. My question is more about understanding what kinds of benefits will I enjoy by using "hooks" to create plugins for my python modules versus using namespaces. I understand that they are orthogonal, but at least at the surface, these seem like two possible ways of creating plugins for a program.

Again apologies for my noob question, I have read the pluggy docs carefully as well as followed the links that describe hooks and its still not entirely clear to me. If there are other things I should be reading to get more background please let me know.

Thanks for your help

From my point of view, namespaces are only about code organisation, and not about enabling plugin apis

closing as resolved, will reopen if other questions come up