This repository contains generated Python stubs for gi.repository modules that can aid in developing Python plug-ins for GIMP 3.0 or later, by providing code completion suggestions. The stubs can be used in a variety of IDEs such as PyCharm, from which these stubs were generated.
This repository additionally includes stubs for modules which PyCharm may fail to generate on some platforms due to a bug.
Download the repository and copy the gi directory to a PyCharm directory containing other generated stubs. Overwrite if asked.
Assuming you added GIMP Python modules to your Python interpreter in PyCharm, you can find the path as follows:
- Go to your PyCharm project and display the Project view.
- Find
External Libraries, expand it and findBinary Skeletons, right-click onBinary Skeletons, selectCopy Path/Reference...and selectAbsolute Path.
It may happen that PyCharm automatically deletes the directories that you just copied when you restart PyCharm. To prevent the directories from being deleted:
- On Linux, run
chattr +i [directory]for thegidirectory. - On Windows:
- Right-click on the
gidirectory, then go toProperties -> Security -> Advanced. - Click on your user account (not SYSTEM or Administrators), then click
Disable inheritance, thenConvert inherited permissions into explicit permissions for this object.. - Still having your user account selected, click
Edit. - In the displayed dialog, click
Show advanced permissions, and then uncheckDeleteandDelete subfolders and files. - Save the changes.
- Right-click on the
In general, you can create a local environment (e.g. via venv or Anaconda) and then manually copy the gi directory under Lib/site-packages.