PyQGIS code completion in Mac OSX


I'm using PyCharm 3.0 on Mac OSX to build plugins for QGIS 2.

Everything is working fine except code completion. The path to PyQGIS has been added to the interpreter, but even after hitting reload the skeleton isn't built.
In the console 'import qgis' works so it is being considered, just code completion is not working.

I suspect it has to do with issue

QGIS uses a simple text file listing all the classes and methods for code completion (attached for your reference). Is there a way to convert this text file into a skeleton that can be used in PyCharm?

I read about custom skeletons in the latest version but found no other information about that...

Any help is greatly appreciated!

PyQGIS.api (534KB)
Comment actions Permalink

Just stumbled upon the same thing and the problem appears to be:

qgis binary modules' names (e.g. "") don't follow the pep-314 naming convention and are therefore ignored by the skeleton generator script (see BIN_MODULE_FNAME_PAT in ~/.pycharm_helpers/pycharm_generator_utils/  The "solution" is to copy qgis mods to something skeleton generator can accept, e.g.

cd /usr/lib/python2.7/dist-packages/qgis

After that, IDEA was able to generate skeletons . Hope this helps someone.

Comment actions Permalink

Out of curiosity, do you still see this issue?  I just ran into this with QGIS 3.0/Pycharm 2018.2/2018.3EAP and Georg's workaround worked for me. 


However, now the .so files are now named correctly (e.g. "") so the issue is more than file naming standards. 

I filed a new issue -- if either of you still see this happening with QGIS 3, please chime in there if you have anything to add. 


Please sign in to leave a comment.