13. Contributing to QPolaris#

Developing and testing QGIS plugins is quite different from developing a python package for two main reasons:

  1. The virtual environment required for development is extremely complex, as it is composed of the entire QGIS software/capabilities

  2. Testing software with Graphical User Interfaces requires different resources than testing terminal tools

We address these two issues explicitly in the software testing setup by adopting the QGIS docker images as development environments and by testing all the software capabilities with the exception of the graphical interfaces.

There is also an additional difficulty in developing the Polaris QGIS plugin, which is related to the need of installing polaris-studio in the user’s environment for QGIS Python.

13.1. QGIS environments#

This package is tested with the latest LTR (long-term release) and master versions of the QGIS docker image.

The goal is to maintain compatibility with the current LTR and the latest release, while we recommend to users to use the current LTR.

13.2. Package documentation#

The documentation is written in Restructured Text, and it lives in the docs/source, accessible from the root directory of you project.

13.3. Setting up your dev environment#

Because of the complexities in building a development environment, we recommend using a development environment based on a QGIS docker image, preferably the current LTR.

Developing with Docker can be achieved in both VSCode and Pycharm, but we recommend using VSCode for its easy setup of Docker development.

All environment definitions are kept up-to-date under the directory .devcontainer in the QPolaris repository, so following the instructions on the Dev Containers installation guide is sufficient to get a full development environment for QPolaris.

13.4. Installing polaris-studio in Python QGIS#

After downloading the polaris-studio python wheel, simply open the Python terminal inside QGIS and enter the code below

import subprocess
subprocess.Popen("python -m pip install --user D:/path/to/polaris-studio.whl")