python - Yapsy minimal example -


Can anyone provide an example that works at least?

Here's a very simple example. It has three files:

  • Plugins \ plugin1.py - The plugin should have passed a class from the IPLaganine.
  • plugins \ plugin1.yapsy-plugin - information about the plugin.
  • yapsy-example.py - The main script simply loads all the plugins it can find in the "plugins" directory, and makes a method call on them to prove it.

    You can add more plugins to the plugins directory, and

    yapsy-example.py

      Import from Yapsy.PluginManager PluginManager def (): Plug in the plugin from # Plugin Directory Manager = PluginManager () manager.setPluginPlaces (["plugins"]) manager.collectPlugins () #Log plug in and print their names Please. For Plugin in Manager.getAllPlugins (): plugin.plugin_object.print_name () if __name__ == "__main__": main ()   

    plugins \ plugin1.py

    Plugins \ Plug1.yapsy-plugin [code] name = plugin1 module = plugin1 [documentation] author = John Smith version = 0.1 website = http: // lotsofplugins Com description = my first plugin

Comments