QGIS Plugin templater - Documentation

Description : Template for developing QGIS plugins using modern and relatively accepted ‘good’ practices about tooling, code structuration, documentation and tests.
Author and contributors: Julien Moura (Oslandia)
Version: 3.28.2
Source code: https://gitlab.com/Oslandia/qgis/template-qgis-plugin/
Last documentation build: 13 May 2024

Code style: black Imports: isort pre-commit

Repository template for developing QGIS plugins using modern and accepted “good” practices about tooling, code structuration, documentation and tests.

It’s based on the amazing project templating engine: Cookiecutter.

Cookiecutter logo

Requirements

  • Python 3.9+

  • Recommended: Git

In a nutshell

# install cookiecutter - use `py -3 [...]` on Windows
python3 -m pip install --upgrade "cookiecutter>=2.1"
# run cookiecutter with this repository
cookiecutter https://gitlab.com/Oslandia/qgis/template-qgis-plugin
# if you don't have installed Git, use the ZIP URL
cookiecutter https://gitlab.com/Oslandia/qgis/template-qgis-plugin/-/archive/master/template-qgis-plugin-master.zip

You’ll be prompted for some values. Provide them, then a QGIS plugin project folder will be created for you.

It’s also possible to override the prompt:

cookiecutter --no-input -f https://gitlab.com/Oslandia/qgis/template-qgis-plugin plugin_name=my_latest_plugin

In this case, the output folder is: plugin_my_latest_plugin.

A quick view (click on image to open it wider):

QGIS plugin templater demo gif