[Qgis-user] QGIS customized importing apparently causes problems with type checkers/Intellisense

Ari Meyer ari.meyer at gmail.com
Wed Dec 15 16:48:12 PST 2021


Hi,

We've been trying to use VS Code Python type checkers to reduce errors, and
leverage Intellisense for code completion.  We've been unable to get these
to work with PyQGIS and PyQT classes, for instance:

[image: image.png]

I believe I've traced the problem to some customized importing that's used
in places like the following:
c:\OSGeo4W\apps\qgis-ltr\python\qgis\__init__.py
c:\OSGeo4W\apps\qgis-ltr\python\qgis\core\__init__.py
c:\OSGeo4W\apps\qgis-ltr\python\qgis\PyQt\Qt.py

I then found that apparently similar techniques have caused the same types
of problems when using libraries like TensorFlow:
https://stackoverflow.com/questions/65271399/vs-code-pylance-pylint-cannot-resolve-import
https://github.com/PyCQA/pylint/issues/2603#issuecomment-541622729

The convoluted ways suggested to deal with these problems aren't really
that appealing.  Does anyone have any suggestions for cleaner ways to
handle this?

Are there reasons why QGIS has to be implemented like this?  It's not clear
from the "monkey patching" comments whether these were temporary
workarounds or not.

Thanks,
Ari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211215/c5cb5f21/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 17130 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211215/c5cb5f21/attachment.png>


More information about the Qgis-user mailing list