pytest-dev / pytest-dev/pluggy

Class based plugins and entrypoints

Open
#357 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
160
Avg merge
21h 4m
Merged PRs (30d)
6

Description

This is not a bug report but more of a general question about pluggy.

I know there was talks a few years ago of changing the way entry_points are loaded but it hasn't been implemented.

As the developer of the host application, I can easily create a class that contains hook implementations (what the example from the documentation calls "A hook implementation namespace") and register it with the PluginManager but unless I'm missing something obvious, plugin authors can only define their hook implementations as functions (at least this is what all the examples I've seen seem to suggest).

So my question is, is there any plans of allowing/facilitating "Class based plugins" to be loaded via entry_points?

I "hacked" pluggy (just added a couple lines of code) to be able to do it for my program but maybe a solution from the developers could also be useful to others.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing pluggy's entry_points loading path and the existing PluginManager registration behavior described in the issue. A complete outcome would decide whether class-based plugins should be supported through entry_points and document or test that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.