Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Remove pluggy: it is only used as an entry-point loader, and the class-based hookspecs break on pluggy 1.7

Ouverte
#14 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
1-2 jours
Accessibilité débutants
63/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
tooling

Piste de recherche

Start by tracing plugincode’s current entry-point loading and dependency declaration, then check how src/scancode/cli.py consumes the loaded plugin classes. Run the existing plugin-loading tests before and after the change; done means plugins load through importlib.metadata, duplicate names keep the first entry, subclass validation remains, and the marker decorators stay importable.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Written by Claude Opus 5.5 via Claude Code for the plugincode and scancode-toolkit maintainers; I prompted it, it did the work, I read it.

This is filed by Ronny Pfannschmidt, a pluggy maintainer. The behaviour plugincode relies on was never part of pluggy's API, and pluggy will not restore it.

pluggy 1.7.0 breaks every plugincode stage at import time (aboutcode-org/scancode-toolkit#5363):

File ".../plugincode/__init__.py", line 182, in __init__
    self.manager.add_hookspecs(sys.modules[module_qname])
ValueError: did not find any 'pre_scan' hooks in <module 'plugincode.pre_scan' ...>

scancode-toolkit now caps pluggy < 1.7.0 (aboutcode-org/scancode-toolkit@1891da6acf). A cap is not a fix. The underlying problem is that plugincode does not use pluggy as a hook system at all.

What plugincode actually does with pluggy

  • @pre_scan_spec, @scan_spec, etc. decorate classes. Hookspecs are functions. On pluggy ≤ 1.6, add_hookspecs happened to accept these classes and created hooks named after them (PreScanPlugin, …) that nothing ever calls. pluggy 1.7 only accepts functions and methods, finds none, and raises.
  • @pre_scan_impl, @scan_impl, etc. also decorate classes. register() looks for marked attributes on the plugin object and finds none, so every plugin registers with zero hook implementations, on 1.6 and 1.7 alike.
  • No pm.hook.<name>(...) call exists in plugincode or scancode-toolkit.
  • What is left is load_setuptools_entrypoints(group) followed by list_name_plugin(). In other words: iterate importlib.metadata entry points, ep.load(), store {ep.name: cls}. scancode-toolkit then instantiates the classes and calls their methods directly (src/scancode/cli.py, around line 741).

A standalone script on pluggy 1.6.0 and 1.7.0 shows the above: the class-decorated "hookspecs" fail on 1.7, and register() of a class succeeds with no hook implementations on both versions.

Request

Drop the pluggy dependency and load plugins with importlib.metadata.entry_points(group=entrypoint) directly:

  • Keep ep.name as the plugin name. The first name wins and later duplicates are skipped, matching load_setuptools_entrypoints.
  • Keep the existing issubclass(plugin_class, plugin_base_class) validation.
  • Keep HookspecMarker / HookimplMarker exported as no-op decorators, so third-party plugins that apply @pre_scan_impl keep importing. They can be deprecated later.

This removes a dependency and keeps the plugin API unchanged for plugin authors. Once it is released, scancode-toolkit can drop the < 1.7.0 cap (tracked in aboutcode-org/scancode-toolkit, issue to follow).

Langage dominant
Python
Étoiles
1
Forks
2
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de aboutcode-org/plugincode

Toutes les issues de aboutcode-org/plugincode

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.