OjisanSeiuchi wrote:In the process of working on a new plugin, I've bumped up against the difficulty of Python dependencies,
Is there a canonical method for specifying dependencies? For example, I'd like to use to xmltodict to handle XML returned from a web service. While this module is installed on a system-wide basis, there is no guarantee that would be the case for an end-user. There seems to be no 'requirements.txt' capability or the like. How are others approaching this? Many of the existing modules that I've browsed seem to just avoid esoteric dependencies.
One way to do it is to place the dependent modules within the plugin itself--within the Server Plugin folder. I do this with a couple of my plugins and use the indigoPluginUpdateChecker module (developed by an Indigo developer) in all of my plugins that are published publicly. Other plugins require the user to install external dependent modules separately. I prefer the former.
The biggest issue that I can see is Python compatibility. Your included modules must be compatible with the Python versions likely to be in service and/or include trap(s) to catch exceptions when that's not the case. Even if it's a simple, "This plugin requires Python 2.6" kind of trap.
- Code: Select all
try:
import foo
except ImportError, e:
indigo.server.log("Error: %s" % e, isError=True)