{"id":28474,"library":"yapsy","title":"Yapsy - Yet Another Plugin System","description":"Yapsy is a simple, reusable plugin system for Python applications. It provides a base class for plugins and a plugin manager that discovers and loads plugins from directories. The latest version is 1.12.2, with sporadic releases.","status":"active","version":"1.12.2","language":"python","source_language":"en","source_url":"https://github.com/tibonihoo/yapsy","tags":["plugins","plugin-system","dependency-injection"],"install":[{"cmd":"pip install yapsy","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"IPlugin is in the yapsy.IPlugin submodule, not top-level.","wrong":"from yapsy import IPlugin","symbol":"IPlugin","correct":"from yapsy.IPlugin import IPlugin"},{"note":"Common mistake: PluginManagerSingleton is inside PluginManager module.","wrong":"from yapsy import PluginManagerSingleton","symbol":"PluginManagerSingleton","correct":"from yapsy.PluginManager import PluginManagerSingleton"}],"quickstart":{"code":"from yapsy.IPlugin import IPlugin\nfrom yapsy.PluginManager import PluginManagerSingleton\n\nclass MyPlugin(IPlugin):\n    def activate(self):\n        print(\"Plugin activated\")\n    def deactivate(self):\n        print(\"Plugin deactivated\")\n\nif __name__ == \"__main__\":\n    pm = PluginManagerSingleton.get()\n    pm.setPluginPlaces([\"plugins\"])\n    pm.collectPlugins()\n    pm.activatePluginByName(\"MyPlugin\")\n    pm.deactivatePluginByName(\"MyPlugin\")","lang":"python","description":"Defines a plugin class, uses the singleton plugin manager to discover and activate plugins from a 'plugins' directory."},"warnings":[{"fix":"Override activate() instead of __init__ to access plugin manager or metadata.","message":"Plugin constructor (__init__) is called before plugin info (name, version, etc.) is set. Do not rely on plugin metadata in __init__; use activate() instead.","severity":"gotcha","affected_versions":"all"},{"fix":"Use PluginManagerSingleton.get() or pass plugin_places explicitly.","message":"The use of PluginManager without arguments is deprecated in favor of PluginManagerSingleton or custom locations.","severity":"deprecated","affected_versions":"<1.12"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Ensure your plugin class inherits from yapsy.IPlugin.IPlugin and implements activate()/deactivate().","cause":"Trying to instantiate IPlugin base class directly or forgetting to inherit.","error":"yapsy.IPlugin.IPlugin is not instantiated correctly"},{"fix":"Call pm.collectPlugins() before trying to get a plugin by name.","cause":"PluginManagerSingleton.get() returned None because plugins were not collected yet.","error":"AttributeError: 'NoneType' object has no attribute 'getPluginByName'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}