Ask Your Question

Revision history [back]

The way to inform Wing about the modules is to use .pyi files, which are stub python files with class and function definitions. This is commonly used elsewhere for modules that are written in C. The older format is .pi files, but new work is supposed to use .pyi.

Here are the details about how I to set up the pyi files for usage with CircuitPython. First, install circuitpython source.

pip install install rst2pyi
cd circuitpython
make stubs

This creates stubs in the directory circuitpython-stubs. Either copy the required stubs to the project as needed, or put them in a directory, and add this directory to the path in Wing Pro: WingPro -> Preferences -> Source Analysis -> Advanced -> Interface File Path

Close the project. Re-open it. It is not sufficient to "Update all warnings in file". This covers the modules that are written in C. It is not a 100% solution, there are a few gaps, probably caused by errors in the automatic stub generation process. This is a known issue and it is open.

For pure Python modules, it is easier to copy the module directories into the project as needed. Or, look at the .pyi files and follow the pattern to make your own stubs.