The plugins on this page are user-contributed and have not been thoroughly tested. Use at your own risk Not logged in

PyQGIS Plugins

How to Package a Plugin

A PyQGIS plugin has specific requirements. For information on writing a plugin, see the HowTo.

Once you have a plugin that works on your local QGIS installation, you can package it up:

  1. Create a distribution directory. The name you choose will be the directory name under which the plugin is deployed in QGIS.
  2. Copy only the necessary files for you plugin to the distribution directory. If you are using CVS or SVN as part of your development process, you should do an export to avoid distributing the .cvs and .svn directories.
  3. Package the plugin by making a zip archive of it, including the directory
If your plugin is not valid, the upload will fail.

Example

You have a plugin named ZoomToPoint and it's stored in a directory zoom_to_point in your development directory. Here is the process for packaging it on Linux or Mac from the command line:
gsherman@madison:~/development$ ls 
zoom_to_point
gsherman@madison:~/development$ mkdir dist
gsherman@madison:~/development$ cp -r zoom_to_point dist
gsherman@madison:~/development$ ls dist
zoom_to_point
gsherman@madison:~/development$ cd dist
gsherman@madison:~/development/dist$ zip -9v zoom_to_point.zip zoom_to_point/*
  adding: zoom_to_point/COPYING (in=18701) (out=7082) (deflated 62%)
  adding: zoom_to_point/icon.png        (in=1278) (out=1278) (stored 0%)
  adding: zoom_to_point/__init__.py     (in=1460) (out=508) (deflated 65%)
  adding: zoom_to_point/resources.py    (in=6402) (out=2556) (deflated 60%)
  adding: zoom_to_point/resources.qrc   (in=107) (out=87) (deflated 19%)
  adding: zoom_to_point/ui_zoomtopoint.py       (in=5049) (out=1328) (deflated 74%)
  adding: zoom_to_point/zoomtopointdialog.py    (in=1419) (out=497) (deflated 65%)
  adding: zoom_to_point/zoomtopointdialog.pyc   (in=2953) (out=1233) (deflated 58%)
  adding: zoom_to_point/zoomtopointdialog.ui    (in=4584) (out=1138) (deflated 75%)
  adding: zoom_to_point/zoomtopoint.py  (in=3550) (out=1282) (deflated 64%)
total bytes=45503, compressed=16989 -> 63% savings
gsherman@madison:~/development/dist$ ls
zoom_to_point  zoom_to_point.zip
Along with the command line, you can use any tool you like to create the archive, including popular zip managers on Windows. The important point is to use zip to package the file and be sure to include the directory in the archive.