2

My specific question is related to MicroPython development on Pycom's GPY with Pytrack expansion board. I also have Pycom's Pymakr extension for VSCode installed as well. But I feel the question can be asked and answered more generally and I'll try to do that...

When doing development on Micropython, you will have application specific libraries that you load from ./lib but you also load system libraries such as import [ pycom | pyboard | your_board ] which are not available to VSCode since they are not in your workspace folders, but they are available at runtime on the board.

How do you make these available to VSCode so IntelliSense will work correctly AND you won't see import errors in VSCode?

Patrick
  • 2,044
  • 1
  • 25
  • 44
  • The answer is the correct how-to for this generic need. If you're looking for PyCom stubs, I have published the GPy ones and welcome the contribution of others on GitHub https://github.com/askpatrickw/pycom-stubs – Patrick Mar 20 '20 at 20:29

1 Answers1

2

I have ESP32 so my config sample will be ESP32 based. Download https://github.com/lixas/ESP32-Stubs-VSCode

OR

Use following to generate for your board: https://github.com/Josverl/micropython-stubber and download those files from board

My settings.json file:

{
    "python.linting.enabled": true,
    "python.jediEnabled": false,
    "python.autoComplete.extraPaths": [
        "C:\\Users\\lixas\\Workspace\\Python\\stubs\\esp32_1_11_0",
        ".micropy\\RX"
    ],
    "python.autoComplete.typeshedPaths": [
        "C:\\Users\\lixas\\Workspace\\Python\\stubs\\esp32_1_11_0",
        ".micropy\\RX"
    ],
    "python.analysis.typeshedPaths": [
        "C:\\Users\\lixas\\Workspace\\Python\\stubs\\esp32_1_11_0",
        ".micropy\\RX"
    ],
    "python.linting.pylintEnabled": false,
    "files.exclude": {
        ".vscode": true,
        ".micropy": true,
        ".gitignore": true,
        ".pylintrc": true,
        "micropy.json": true,
        "pymakr.conf": true,
        "*requirements.txt": true
    },
    "python.linting.banditEnabled": true,
    "python.linting.flake8Enabled": false
}
Lixas
  • 6,938
  • 2
  • 25
  • 42