Remove pluggy: it is only used as an entry-point loader, and the class-based hookspecs break on pluggy 1.7
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 63/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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_hookspecshappened 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 bylist_name_plugin(). In other words: iterateimportlib.metadataentry 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.nameas the plugin name. The first name wins and later duplicates are skipped, matchingload_setuptools_entrypoints. - Keep the existing
issubclass(plugin_class, plugin_base_class)validation. - Keep
HookspecMarker/HookimplMarkerexported as no-op decorators, so third-party plugins that apply@pre_scan_implkeep 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).
- Vorherrschende Sprache
- Python
- Sterne
- 1
- Forks
- 2
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus aboutcode-org/plugincode
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
aboutcode-org/plugincode#12 · 2 Kommentare ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 45/100
-
enhancement plugin
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
aboutcode-org/plugincode#4 · 6 Kommentare · 1 Reaktion ·
Alle Issues in aboutcode-org/plugincode
Ähnliche Issues
-
ReadQwen3PaperTask5 rejects correct answers that differ only in order, case, or underscore formEvtl. vergeben @Kingpython123 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
Tongyi-MAI/MobileWorld#72 ·
-
_threads/application: Update typing annotations using `pyupgrade --py311-plus`Evtl. vergeben @gudnimg hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Health probes return 401 when authentication is enabled and the API is served under /orbEvtl. vergeben @fgogolli hat das heute übernommen. Offenarea: api priority: p2 size: S type: bug
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 75/100
finos/open-resource-broker#704 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
BCDA-APS/polar-bits#93 ·
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
GoogleCloudPlatform/gce-rescue#218 ·
Maintainer antworten meist innerhalb von 2 Tagen