We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Improving QGIS plugin developer experience

Formal Metadata

Title
Improving QGIS plugin developer experience
Title of Series
Number of Parts
266
Author
License
CC Attribution 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date2023
LanguageEnglish

Content Metadata

Subject Area
Genre
Abstract
The National Land Survey of Finland (NLS) has developed a solution for sharing common QGIS plugin code among various plugins while maintaining a good developer experience. The challenge arises from the uncertainty of the runtime environment when sharing library code across different QGIS plugins. Python's import machinery doesn't readily support multiple versions of dependencies, limiting the available version of a library to the first-run code and making code sharing and API changes challenging. To overcome these limitations, NLS has created tools that improve the development process and enable easy sharing of QGIS plugin code using standard Python libraries. This streamlined workflow includes virtual environments, dependency management, debugger sessions, and runtime dependency reorganization during build-time, enhancing developer feedback and simplifying QGIS plugin development. NLS's approach involves initializing a QGIS plugin's development environment using a virtual environment and installing dependencies, enabling developers to launch QGIS with the plugin and its dependencies configured. This method simplifies testing, debugging, and code changes by providing a quicker feedback cycle. Additionally, runtime dependencies are reorganized during build-time, ensuring that the exact packaged version of a dependency is used at runtime, thus avoiding version conflicts. The tool also generates metadata files compatible with standard Python packaging tools, enabling code to be shared both as a Python library and a QGIS plugin. This approach offers an efficient and streamlined way to handle QGIS plugin development and code sharing, enhancing the overall developer experience and compatibility.