Skip to content

Why Plushy

Most Python applications that accept plugins end up writing the same code. It reads entry points, imports and instantiates them, catches the ones that fail, keeps a list of the disabled ones, and calls them in some order, hoping that a plugin missing a method is caught before production. Plushy is that code, written once, with defined behaviour at each step.

What it gives a host

  • Discovery that works with any build backend. Plugins declare a standard entry point; uv_build, hatchling, PDM and setuptools all produce one. No build hook, no generated registry to keep in sync.
  • Nothing imported before it is needed. Discovery reads metadata only. A command-line tool that uses one plugin does not import the other forty.
  • A lifecycle with defined states. Every plugin is DISCOVERED, INSTANTIATED, LOADED, DISABLED or ERRORED, and the host can ask which.
  • Failures contained. One broken plugin is marked ERRORED, its exception kept for inspection, and the others load.
  • Hooks, sync and async. Pluggy's mature hook engine, plus an async caller for applications running on an event loop.
  • Two ways to use a plugin. Ask for one by name and use what it returns (a storage backend), or call every plugin at an extension point (a rendering pipeline). A plugin can do both.
  • Contracts. A typing.Protocol per namespace, checked when the plugin loads, at startup.
  • Host-controlled enablement. Disable a plugin from configuration or at runtime; it leaves dispatch immediately.
  • Cleanup and dependencies. A plugin that opens a connection closes it when unloaded; a plugin that needs another one gets it loaded first.

What it costs

Plushy has one runtime dependency: Pluggy, which itself has none. Plushy adds about 1,200 lines around it.

When you don't need it

If your application registers a fixed set of plugins by hand, synchronously, and never needs to disable, type-check or clean up after them, Pluggy alone is enough. Pluggy vs. Plushy draws the line in more detail.