[Qgis-developer] Configuring PyCharm

Larry Shaffer larrys at dakotacarto.com
Wed Feb 15 16:36:31 EST 2012


Hi George,

> Also, what are the best practices on how to deploy/test a new plugin? The
> biggest problem I've seem is that my project (that it's located elsewhere)
> needs to be transfered to .qgis/plugins to work. How can I circumvent this
> need? Or should I build a "pre build" script?

Consider setting up a Makfile or other script that compiles your Qt
resources and strips the plugin of unnecessary files and deposits a
working, deployed copy in the <user dir>/.qgis/python/plugins/
directory. See other plugin's Makefiles for examples on how to do
this. The Plugin Builder plugin also has an example Makefile.

During development, you can use the Plugin Reloader plugin to reload
and test the plugin without restarting QGIS.


I use a slightly different approach, which works on Unix-like
machines, where I create a symbolic link from my project dir into
<user dir>/.qgis/python/plugins/

For example on my Mac I use:

ln -s /Users/larrys/QGIS/PluginProjects/my_plugin
/Users/larrys/.qgis/python/plugins/my_plugin

The plugin will then be available to load in QGIS. Then I use Plugin
Reloader during development. This method skips the need to run make
every time I want to test the plugin in QGIS.

When I'm ready to release the plugin, I run make on my Makefile which
deploys to a different, test plugin folder, e.g. <user
dir>/.qgis/python/plugins/my_plugin_test. After restarting QGIS and
testing that the deployment works OK, I quit QGIS and move the test
plugin from the plugins directory, renaming it appropriately.


For PyQt development, I prefer Eric4 [1], as it has good tools for
compiling and working specifically with PyQt. Also, it is entirely
built using PyQt. So, if you want to know how something can be done,
just open up Eric's files and take a look. The code is very well
documented. It also has good support for custom and remote debugging.
Eric5 is built for Python 3.x, but QGIS is probably most stable when
using Python 2.x, so I recommend trying Eric4 (4.5.x).

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota

[1] http://eric-ide.python-projects.org/


More information about the Qgis-developer mailing list