PyQGIS code completion in Mac OSX

Hi,

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 http://youtrack.jetbrains.com/issue/PY-7691.

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!

Jorge
PyQGIS.api (534KB)
2 comments

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

qgis binary modules' names (e.g. "_core.x86_64-linux-gnu.so") 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/constants.py).  The "solution" is to copy qgis mods to something skeleton generator can accept, e.g.

cd /usr/lib/python2.7/dist-packages/qgis
cp _core.x86_64-linux-gnu.so _core.so 

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

0

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. "_core.so") so the issue is more than file naming standards. 

I filed a new issue https://youtrack.jetbrains.com/issue/PY-32125 -- if either of you still see this happening with QGIS 3, please chime in there if you have anything to add. 

0

Please sign in to leave a comment.