Packaging Your Plugin

To distribute a plugin, it needs to be packaged with all its dependencies in a zip file.

The easiest way to add dependencies to your plugin is to create a vendor directory, and then use the pip command to install your dependencies into the vendor directory:

user@host ~/Projects/myplugin/vendor $ pip install -t . python-midi

Then, in your code, you will need to add the vendor directory to the list of paths that Python needs to search in order to import modules.

import os
import sys

this_dir = os.path.abspath(os.path.dirname(__file__))
vendor_dir = os.path.join(parent_dir, 'vendor')
sys.path.append(vendor_dir)

Now, when you import any of your dependencies, they'll be pulled from that directory. For example:

import midi    # Imports the midi module from the "vendor" directory