Hasty Briefsbeta

Bilingual

Plugins case study: Pluggy

a day ago
  • Pluggy is a Python library for building plugin systems, originally from pytest and now standalone.
  • Core concept: hooks — hosts expose them via HookspecMarker, plugins implement them via HookimplMarker.
  • Plugins can be discovered automatically via setuptools entry points or registered manually with PluginManager.register().
  • Hook invocation returns a list of results from all plugins, with ordering options like LIFO, tryfirst, trylast, and firstresult.
  • The htmlize example demonstrates custom role handlers and content processing through plugins.
  • Pluggy offers advanced features (entry point discovery, signature validation, result collection, hook ordering, wrappers) but is a shallow API, leaving hosts to manage most details.