Build the plugin

To build the plugin pb_tool must be available in the system. This package is available via PyPI service (using pip install).


It might look as good idea to use standard make, since Makefile is available too. This is considered deprecated option and should no longer be used. pb_tool is more complex build system (and supports various opereting systems).

To install pb_tool, just use

pip install pb_tool

Configuration file pb_tool.cfg

pb_tool needs a configuration file (generated by the Plugin Builder). In this file, you can modify target plugin path as well as locales, extra directories needed and other metadata.

First build of the plugin

First we compile UI files

pb_tool compile

Next we deploy our plugin to the QGIS Plugin directory

pb_tool deploy

Deploying to ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/fiberplanitconvert
Deploying will:
  * Remove your currently deployed version
  * Compile the ui and resource files
  * Build the help docs
  * Copy everything to your ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/fiberplanitconvert directory

Proceed? [y/N]: y


Instead of deploying the plugin using pb_tool it could be more flexible when developing the plugin to set up QGIS environment in order to be able to install the plugin from original destination without need of deployment.

This can be done by setting up environmental variable QGIS_PLUGINPATH in Settings ‣ Options ‣ System. Enable Use custom variables in Environment section and add a new variable: QGIS_PLUGINPATH. This variable should point to a root directory where the directory with the plugin is located. Restart (close and open) QGIS and continue with installing the plugin.

Installing plugin to QGIS

Open QGIS and find the new plugin in the Plugins ‣ Manage and Install Plugins…. Check the checkbox to activate the plugin in QGIS.


Fig. 12 Activate newly created plugin in QGIS

An icon of the plugin new_plugin appears in the toolbar as well as new menu selection in Vector ‣ fibarplanitconvert ‣ CSV2FiberplanIT.

When running it, new (empty) dialog will be open.


Fig. 13 Empty plugin dialog of the plugin.



Virtualenv is one of the possibilities, how to keep your code and it’s dependencies independent.

To create the virtualenv, run

python3 -m venv yungovenv

For QGIS running within Python virtualenv, you need to adjust :file:``activate` script and add PYTHONPATH with Python, Qt and QGIS libraries.

$EDITOR yungovenv/bin/activate

export PYTHONPATH=$PYTHONPATH:/usr/local/share/qgis/python/:/usr/lib/python3/dist-packages/

To initialize the virtualenv, run

source yungovenv/bin/activate


It’s generaly good advice to use virtualenvwrapper tool.