Dear Gurus,<div><br></div><div>I have a question about plugins structure, and I would like to get some advise from you.</div><div><br></div><div>I have an application to which I would like to add some external plugins, that will be essentially part of the application, thus using its existing modules, but adding functionality to the main application. For that, I designed the following structure:</div>

<div><br></div><div>program/</div><div>    |</div><div>    |---- program.py</div><div>    |</div><div>    |---- programlib/</div><div>    |</div><div>    |---- setup.py</div><div>    |</div><div>    |---- plugins/</div><div>

    |         |<br clear="all">   <br>where program.py is the application entry point, which uses the programlib package, and so the plugins. The plugins have access to all packages/modules within programlib and to their own directory tree.</div>

<div><br></div><div>In this sense, the programlib is shared by the main program and its plugins, but it is still private to the rest of python.</div><div><br></div><div>When compiling/building the source with setup.py, I encountered the problem that separating the plugin as an independent solution: <br>

<br><div>program/</div><div>    |</div><div>    |---- setup.py</div><div>    |</div><div>    |---- plugins/</div><div>    |         |<br clear="all">    |         |--pluginA/<br clear="all">    |         |<br clear="all">

</div><div><br></div><div>the setup.py fails (obviously) because it does not find the packages/modules from programlib, which are only available to the main application source.</div><div><br></div><div>Installing program from source, the setup.py places the files under /usr/local/lib/dist-packages, making programlib accessible to the program-pluginA setup.py. But as being an application, the debian packaging will install it into /usr/share/program, so the compilation of the plugin will fail.</div>

<div><br></div><div>Long story short, I guess my question is: what would be the best way to overcome this problem? I can see a couple of workarounds, but I do not know the best approach, or if there are alternatives to what I have in mind. I could think of:</div>

<div><br></div><div>a) make the package programlib public (meaning storing the files in pymodules/dist-packages) - but this does not seem good solution, because it does not have any need for programlib to be accessible by all python code</div>

<div><br></div><div>or </div><div><br></div><div>b) add current installation to python path (eg. /usr/share/program) so the plugin can import the programlib packages/modules.</div><div><br></div><div><br></div><div>What would you suggest me to do?</div>

<div><br></div><div>Thank you for your help.</div><br><span style="font-family:courier new,monospace">--</span><br style="font-family:courier new,monospace"><b style="font-family:courier new,monospace">Braga, Bruno</b><br style="font-family:courier new,monospace">

<a style="font-family:courier new,monospace" href="http://www.brunobraga.net" target="_blank">www.brunobraga.net</a><br style="font-family:courier new,monospace"><a style="font-family:courier new,monospace" href="mailto:bruno.braga@gmail.com" target="_blank">bruno.braga@gmail.com</a><br>


</div>