Closed North101 closed 3 months ago
I looked into stubber but I couldn't get it to do anything much of anything, and my understanding is that - at best - it can only glean very superficial details about compiled-in C-modules which aren't introspectable for any type information, docstrings, etc.
I have started a stubs repository here https://github.com/pimoroni/pimoroni-pico-stubs
I need to figure out how to make this installable and - of course - add all the many, many missing modules.
I need to figure out how to make this installable and - of course - add all the many, many missing modules.
The following works for me:
In VS Code I have these extensions installed:
In my VS Code project i have this file:
.vscode/settings.json
{
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "basic",
"python.analysis.diagnosticSeverityOverrides": {
"reportMissingModuleSource": "none"
},
"python.analysis.extraPaths": [
"<full_path_to>/pimoroni-pico-stubs",
],
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "none",
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
}
For rp2 stubs I install micropython-rp2-stubs
from pip and then I add this location pip3 show micropython-rp2-stubs | grep Location
to python.analysis.extraPaths
Unfortunately additions to the stdlib / builtins won't show
When developing it'd be great to have stub files for all the modules. I wonder if it is possible to autogenerate them when building the modules.
https://github.com/cpwood/Pico-Stub/blob/main/micropython-stubber.md#generating-the-stubs This allows you to create a stub file by running the code on the board.