Python application extending, plugins

Discussion in 'Python' started by John Pote, Jan 7, 2005.

  1. John Pote

    John Pote Guest

    Hi,

    Has anyone any thoughts on structuring a program so that it can be extended
    simply and elegantly by a user who only has a compiled (.pyc) version of the
    application?

    I wish to write an application, myApp, that provides a GUI to, amongst other
    things, a simulator implimented as a class. myApp's simulator may then be
    extended by more python code to produce what is effectively 'myApp2'. The
    simulator might then be further extended from myApp2 to myApp3 in a similar
    manor. Don't think there would be much call, if at all, to go beyond myApp3
    level. But who knows!

    Any thoughts would be appreciated.

    John Pote
    John Pote, Jan 7, 2005
    #1
    1. Advertising

  2. John Pote

    Kartic Guest

    John,

    To achieve this, your application must define an API that third party
    coders can use to extend your application.

    How you define your API is upto you; there are no general "guidelines",
    AFAIK. But if you want seamless extensibility, it entirely depends on
    how elegantly you design the API for you application.

    My approach has been to study other applications (python or otherwise)
    that allow plug-ins to be written and get ideas.

    You can may be look at SPE, Stani's Python Editor, as it allows
    extending the app using plug-ins and there are some sample plug-ins. I
    have also read some plugin-related articles at codeproject.com (VB and
    C++).

    The good thing about Python is its introspection that you can use to
    detect the presence of certain functions in order to qualify as a
    plug-in for your application. And you can use pycheck (pycheck.sf.net)
    to check the plugin's python code before you load it into your
    application's namespace.

    Cheers!
    --Kartic
    Kartic, Jan 9, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page