Skip to content

load_services undocumented #37

@nerdoc

Description

@nerdoc

I really had a hard time finding out how PluginGlobals.load_services() works - I didn't make it. Is there any kind of documentation besides the few lines in the [pdf](https://software.sandia.gov/trac/pyutilib/export/1831/pyutilib.component.doc/trunk/doc/plugin/pca.pdf]?

AFAIK, and after having worked myself through the code of the loader, you have to import a Loader class first which implements IPluginLoader before calling load_services().
So:

# plugin.py
class Test:
    implements(ITest)
    def test():
        print("test)
# main.py
class ITest(Interface)
    def test():
        pass

class Main:
    test_extension = ExtensionPoint(ITest)
    
    def __init__(self):    
        loader = ImportLoader()
        PluginGlobals.get_env().load_services(path="./plugins", auto_disable=False)

    # test it:
    for ep in self.test_extension:
        ep.test()
  • Does this work (here test() is never called, the for loop does not iterate at all over the plugins)?
  • Is the get_env() necessary (the pdf doc doesn't mention it)?
  • even if I write auto_disable=False the plugin is not called in the following context.
    Is there any chance that the documentation gets updated?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions