[QGIS-Developer] Python Plugins external libs

michal.wloga at envirosolutions.pl michal.wloga at envirosolutions.pl
Tue Jun 2 06:52:20 PDT 2020


Hi Sebastian,

Thank you for your reply. I'm developing a plugin to allow SSH Tunneling for a database connection (e.g. Postgres). Actually it works, but need some python dependencies.
It is not the first time I'm facing a third-party modules issue. The challenge is to:
- do not brake down native OSGeo4W python paths
- make plugin available to install for each qgis user, without root/admin permissions (put dependencies inside user's catalogue - e.g. inside plugin folder)
- make it uploadable to the Official QGIS Repository (shall not be to heavy, so can't include external libs in most cases)
- make it work on every OS

Recently I ended up with hosting all compiled dependencies for each OS and supporting Python version on my own server. Checking OS and Python during plugin startup, downloading appropriate archives and unpacking them inside the plugin folder, appending paths to sys.path. It has surprisingly worked, but it was horrible to develop if you have a long "dependency chain".

Does anyone have a better solution?

Regards,
EnviroSolutions Sp. z o. o.
Michał Włoga

-----Original Message-----
From: Sebastian M. Ernst [mailto:ernst at pleiszenburg.de] 
Sent: Friday, May 29, 2020 12:54 PM
To: michal.wloga at envirosolutions.pl; qgis-developer at lists.osgeo.org
Subject: Re: [QGIS-Developer] Python Plugins external libs

Hi Michał,

I was waiting for any of the QGIS developers to comment on this ... A collection of common, bad approaches can be found here [1]. Bottom line:
There is no clean way to do it. I recently wrote a summary of the situation and those approaches, see here [2]. I also released an official QGIS enhancement proposal which is currently being discussed.
It addresses this issue, among other stuff, see here [3]. I'd appreciate if you could describe your desired use-case and put it as a comment into the discussion. It would help to support the proposal.

Best regards,
Sebastian


[1]: https://gis.stackexchange.com/q/196002/13332
[2]:
https://github.com/qgist/pluginmanager-qep/blob/master/QEP.md#currently-missing-links
[3]: https://github.com/qgis/QGIS-Enhancement-Proposals/issues/179


Am 27.05.20 um 15:30 schrieb michal.wloga at envirosolutions.pl:
> Dear All,
> 
>  
> 
> What is the best approach to include third-party python modules into 
> the QGIS python plugin?
> 
>  
> 
> Regards,
> 
> EnviroSolutions Sp. z o. o.
> Michał Włoga
> 



More information about the QGIS-Developer mailing list