Why pluxeo¶
Most Python applications that accept plugins end up writing the same code: read entry points, import them, instantiate them, catch the ones that fail, keep a list of the disabled ones, call them in some order, and hope a plugin missing a method is caught before production. pluxeo 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,DISABLEDorERRORED, 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.Protocolper namespace, checked when the plugin loads instead of when a rarely used code path calls the missing method. - 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¶
One runtime dependency: Pluggy, which itself has none. pluxeo 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. pluxeo draws the line in more detail.