Protecting QGIS Plugin source code

QGIS is licensed under the GPLv2, this same license applies to QGIS plugins.

QGIS has written a blog post that clarifies on the licensing as well as on the commercial aspects of this.

With respect to your question, here is the most relevant part quoted. However, I would suggest to read the complete blog post to also be aware that this is not meant to undermine any commercial intentions.

Under the terms of this license, it is a requirement that all plugins distributed via http://plugins.qgis.org (or through other repositories that may be self-hosted) should comply with the GPL version 2 or greater license. In particular all code included in any plugin should be made clearly and easily available in source form. It has come to our attention that some plugin authors are distributing plugins that do not comply with this condition.

In summary, while the question probably was looking for a technical solution, the question that needs to be asked first is a legal one. The question about "protection of your IP" needs to be considered in the context of "your work being based on work that is published under the GPL", in this case QGIS. Within these limits you are required to give access to the source code to anyone you give the plugin to. On the other hand, you are not required to give the plugin to anyone. And you are also not required to give the plugin to anyone free of cost.

P.S. I am not a lawyer


The easiest way to protect your 'intellectual property' would be not to publish it. But be aware that you would not be able to write any QGIS plugin without using the 'intellectual property' of a big community of contributors to QGIS.


Others have discussed the licensing/legal requirements of releasing QGIS plug-in source code. To the extent your concern is about others not mucking/damaging/repackaging and "profiting from" your work, you should consider QGIS' free-and-open-source (FOSS) approach a feature, not a bug. By writing transparent source code that others can read and modify, your plug-in can be improved and due to everyone doing so, the ecosystem overall continues to expand over time. This is the secret weapon by which FOSS can "compete" with proprietary commercial software.

To the extent you nevertheless have important IP that needs to be segregated (for instance proprietary algorithms, or private data, or merely data to which you have added significant value by processing whose cost you need to amortize), you could perhaps explore a hybrid architecture. For instance, your open-source plug-in could be the bridge to a proprietary separate tool you distribute, or obtain data from an online service you would operate (users would authenticate).

In addition to the SLYR plug-in mentioned by Matthias, examples include https://www.maptiler.com/qgis-plugin/ and https://plugins.qgis.org/plugins/SentinelHub/. Each of these are plug-ins with source code available, but with considerable IP retained by separating out the value-added processed data feed (incidentally, in both cases built upon more freely licensed underlying base data.)

Finally, if you're just concerned that your work spreads too broadly/rapidly, you need not disseminate your plug-in through the public QGIS plug-in repository. You can distribute it manually to target users, or even set up a private "unlisted" repository of your own.