<div dir="auto"><p dir="ltr" style="line-height:1.38;margin-top:0.0pt;margin-bottom:0.0pt" id="docs-internal-guid-3ceb7778-7fff-adb5-0bb0-f47530ecfa7c"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">One alternative way of managing the dependencies is to package the non-binary runtime dependencies (including licenses) with the plugin. This also tackles the problem with different versions of the same requirements between multiple plugins. There is a tool for that </span><a href="https://github.com/nlsfi/qgis-plugin-dev-tools" style="text-decoration-line:none"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;text-decoration-line:underline;vertical-align:baseline">https://github.com/nlsfi/qgis-plugin-dev-tools</span></a><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> which also has many more useful features for developing QGIS plugins. </span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0.0pt;margin-bottom:0.0pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">One example of plugins using this tool is pickLayer (</span><a href="https://plugins.qgis.org/plugins/pickLayer/" style="text-decoration-line:none"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;text-decoration-line:underline;vertical-align:baseline">https://plugins.qgis.org/plugins/pickLayer/</span></a><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">) which bundles </span><a href="https://github.com/GispoCoding/qgis_plugin_tools" style="text-decoration-line:none"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;text-decoration-line:underline;vertical-align:baseline">https://github.com/GispoCoding/qgis_plugin_tools</span></a><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> with it. </span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0.0pt;margin-bottom:0.0pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">What do you think about this approach?</span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0.0pt;margin-bottom:0.0pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Regards,</span></p><p dir="ltr" style="line-height:1.38;margin-top:0.0pt;margin-bottom:0.0pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Joona</span></p></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ke 23. lokak. 2024 klo 12.01 Info O.GIS via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> kirjoitti:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="font-family:Arial;font-size:small"><div>I also did a similar thing in qgis2web plugin.</div><div>I explained to the user that he can install qtwebengine to get the latest features and to do so he will have to click on a button that indicates that an installation will start.</div><div>Here is the screen:</div><div><br></div><div><img src="cid:1290437387" title="image.png"></div><div><br></div><div>Could it be okay?</div><div><br></div><div>The code:</div><div><br></div><div><div><i>try:</i></div><div><i> if system == 'Windows':</i></div><div><i> pip_exec = os.path.join(sysconfig.get_path("scripts"), "pip3")</i></div><div><i> env = os.environ.copy()</i></div><div><i> if full_proxy_url:</i></div><div><i> env['http_proxy'] = full_proxy_url</i></div><div><i> env['https_proxy'] = full_proxy_url</i></div><div><i> subprocess.check_call([pip_exec, "install", "--upgrade", "PyQtWebEngine==5.15.6"], env=env)</i></div><div><i> elif system == 'Linux':</i></div><div><i> subprocess.check_call(["sudo", "apt-get", "install", "python3-pyqt5.qtwebengine"])</i></div><div><i> elif system == 'Darwin': # macOS</i></div><div><i> subprocess.check_call(["brew", "install", "pyqt5"])</i></div></div><div><br></div><br><div>
<div>
<span style="font-family:Arial;font-size:small">
<div>
<span style="font-family:Arial;font-size:small">
<div>
<span style="font-family:Arial;font-size:medium">
<div>
<span style="font-family:Arial"><font size="2">
</font><div><span style="color:rgb(0,89,179);font-family:Calibri,sans-serif;font-size:small"><b>Andrea Ordonselli</b></span><br style="font-size:small"><div style="font-size:small"><div><span style="font-size:medium"><font size="2"></font><div><span><b><span style="line-height:18.4px;font-family:Calibri,sans-serif;color:rgb(0,89,179)"><font size="2">O.GIS - </font></span></b></span><b><span style="line-height:18.4px;font-family:Calibri,sans-serif;color:rgb(0,89,179)"><font size="2"><a href="http://opengis.it" target="_blank" rel="noreferrer">opengis.it</a></font></span></b></div></span></div></div>
</div>
</span>
</div>
</span>
</div>
</span>
</div>
</span>
</div>
</div><br><br><div><div style="border-left:3px solid #000000;padding-left:10px"><div><span style="font-family:Arial;font-size:11px;color:#5f5f5f">Da</span><span style="font-family:Arial;font-size:12px;color:#5f5f5f;padding-left:5px"> "QGIS-Developer" <a href="mailto:qgis-developer-bounces@lists.osgeo.org" target="_blank" rel="noreferrer">qgis-developer-bounces@lists.osgeo.org</a></span></div>
<div><span style="font-family:Arial;font-size:11px;color:#5f5f5f">A</span><span style="font-family:Arial;font-size:12px;color:#5f5f5f;padding-left:5px"> "Matthias Kuhn" <a href="mailto:matthias@opengis.ch" target="_blank" rel="noreferrer">matthias@opengis.ch</a></span></div>
<div><span style="font-family:Arial;font-size:11px;color:#5f5f5f">Cc</span><span style="font-family:Arial;font-size:12px;color:#5f5f5f;padding-left:5px"> "Thomas B via QGIS-Developer" <a href="mailto:qgis-developer@lists.osgeo.org" target="_blank" rel="noreferrer">qgis-developer@lists.osgeo.org</a></span></div>
<div><span style="font-family:Arial;font-size:11px;color:#5f5f5f">Data</span><span style="font-family:Arial;font-size:12px;color:#5f5f5f;padding-left:5px"> Wed, 23 Oct 2024 16:16:43 +1000</span></div>
<div><span style="font-family:Arial;font-size:11px;color:#5f5f5f">Oggetto</span><span style="font-family:Arial;font-size:12px;color:#5f5f5f;padding-left:5px"> Re: [QGIS-Developer] How to deal with QGIS plugins which install additional packages</span></div>
<br>
<div>
<div dir="auto"><div><br><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">On Wed, 23 Oct 2024, 4:07 pm Matthias Kuhn, <<a href="mailto:matthias@opengis.ch" target="_blank" rel="noreferrer">matthias@opengis.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>On Wed, Oct 23, 2024 at 2:49 AM Nyall Dawson via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org" rel="noreferrer noreferrer" target="_blank">qgis-developer@lists.osgeo.org</a>> wrote:</div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">On Wed, 23 Oct 2024, 9:20 am Greg Troxel via QGIS-Developer, <<a href="mailto:qgis-developer@lists.osgeo.org" rel="noreferrer noreferrer" target="_blank">qgis-developer@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thomas B via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">qgis-developer@lists.osgeo.org</a>> writes:<br>
<br>
> Dear QGIS-Developers,<br>
><br>
> Are there any guidelines from the QGIS project regarding whether a QGIS<br>
> plugin is allowed to autonomously install required packages using PIP or<br>
> similar tools without manual installation by the user?<br>
><br>
> While this might seem convenient, I see it as a potential security risk,<br>
> especially if the user is not explicitly informed about what is happening<br>
> in the background.<br>
<br>
Agreed this is not ok. I think a plugin downloading anything to be<br>
executed or interpreted should be entirely prohibited.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">+1 . This practice should lead to a plugin being removed from the repositories.</div><div dir="auto"><br></div><div dir="auto">(Possibly we could do something on the code side too, eg by monkey patching over subprocess/etc and explicitly blocking execution of sip, with a developer-friendly exception stating this policy. It'd be easy for someone motivated to circumvent, but could at least be used to advise plugin developers that this is not acceptable practice...)</div></div></blockquote><div><br></div><div>We've tried to come up with a more transparent approach with support for requirements.txt (see <a href="https://github.com/opengisch/qpip" rel="noreferrer noreferrer" target="_blank">https://github.com/opengisch/qpip</a>). It is using pip but with a frontend which informs the user and lets him confirm an eventual installation.</div><div>Is this approach generally acceptable?</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Well, I definitely trust yourself/OpenGIS significantly more then other random plugin developers 👍</div><div dir="auto"><br></div><div dir="auto">I would personally feel safest if this was something officially endorsed, with an explicit allow list of acceptable packages.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Nyall</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Matthias</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"><br></div><div dir="auto">Nyall</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div></div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" rel="noreferrer noreferrer" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div></div>
</blockquote></div></div></div>
</div>
</div></div></span>_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank" rel="noreferrer">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>