Detailed Installation Guide¶
The following will help you install the MicroPython Stubs for your specific port and board, or for a specific version of MicroPython.
Install Stubs for a specific port¶
If you only know the MicroPython port then that is sufficient. This will install the stubs for a generic board for that port of micropython.
pip install -U micropython-<port>-stubs --target typing --no-user
pip install -U micropython-esp32-stubs --target typing --no-user
Install Stubs for a Specific Version¶
To install stubs for an older version (e.g., MicroPython 1.18), specify the version followed by .*
:
[Note]
The stub packages are published as post-releases using the same M.M.M version numbering, allowing the stubs to be updated while keeping a clear reference to the MicroPython version.
pip install -U micropython-<port>-stubs==1.18.* --target typing --no-user
pip install -U micropython-esp32-stubs==1.18.* --target typing --no-user
Install Stubs for a Specific Board¶
For a specific MicroPython board (e.g., ESP32 UM-TinyPico), install both the port and board stubs:
pip install -U micropython-<port>-<board>-stubs --target typing --no-user
pip install -U micropython-esp32-um-tinypico-stubs --target typing --no-user
Note
The BOARD_NAMES are commonly in ALL_CAPS with all spaces replaced by _
They should be the same as the name of the board folder in the micropython repo.
PyPi converts port and board names to lowercase with kebab-case (not snake_case).
Not all possible ports/boards are published, as creating board-stubs requires access to hardware.
Some boards have been renamed between versions such as the rp2 PICO to RPI_PICO and several boards have switched from lowercase to all_caps
Check PyPi directly for newly published stubs.
¶
And that’s it!
You’re all set to write MicroPython code with the help of these powerful stubs.
For more details, check out the MicroPython Stubs documentation. You can also explore the full overview of all stubs. 😊