IDE Autocomplete for Python SDK

Here’s a short guide on configuring autocomplete for the IDA Python SDK in your IDE. If you have further ideas, tweaks, configurations - please don’t hesitate to continue the thread below!


For LSP-based editors, including VS Code and Helix, the easiest way is to install the idapro package from PyPI: pip install idapro.

The idapro package is typically used to install library code for idalib, but as a side effect, it adds type hint stub files (*.pyi ) to the Python environment. Modern LSP servers, such as Pylance and python-lsp-server, can use these type hints as a source for symbols to autocomplete. So run pip install idapro and re-start your LSP server (read: just restart your editor) and autocomplete should work.

VS Code:

Helix (via python-lsp-server):

For other editors: extend the autocomplete search path with the directory containing the IDA Python SDK files.

Unfortunately, this is a bit more involved. You have to teach the editor where to find the Python files, like ida_kernwin.py, that are not found within the typical Python installation directories (site-packages). Start by finding the path to python directory within your IDA installation, something like: /Applications/IDA Professional 9.2.app/Contents/MacOS/python/. Then, update your IDE to search in this directory; the specific place to do this depends on your editor.

VS Code (wait! prefer the mechanism above): update analysis.extraPaths and autoComplete.extraPaths like @Milanek suggests here Stubs for Qt in Visual Studio Code or suggested here: ida - How to setup VSCode with IDAPython? - Reverse Engineering Stack Exchange

PyCharm: update “Interpreter Paths” like suggested here: GitHub - overfl0/IDAPython-pycharm-setup: How to setup Pycharm to run scripts in IDA using the Run menu (or a keybind)

Vim with Pyright: update pyrightconfig.json in the project to contain:

{
...
    "extraPaths": [
        "/Applications/IDA Professional 9.2.app/Contents/MacOS/python/",
    ],
...
}

Other editor? let’s crowdsource what works. Comment below.


What else have you found that works well?

2 Likes