Skip to content

Update micropython boards stubs to v1.24.1

Choose a tag to compare

@Josverl Josverl released this 05 Feb 22:32
· 510 commits to main since this release

The new stubs contain additional type information for parameters and return types.
The depend on new functionality added in micropython-stdlib-stubs==1.24.1

esp32:

  • micropython-esp32-stubs v1.24.1.post1
  • micropython-esp32-esp32_generic-stubs v1.24.1.post1
  • micropython-esp32-esp32_generic_c6-stubs v1.24.1.post1
  • micropython-esp32-esp32_generic_s3-stubs v1.24.1.post1

rp2:

  • micropython-rp2-stubs v1.24.1.post1
  • micropython-rp2-arduino_nano_rp2040_connect-stubs v1.24.1.post1
  • micropython-rp2-rpi_pico-stubs v1.24.1.post1
  • micropython-rp2-rpi_pico2-stubs v1.24.1.post1
  • micropython-rp2-rpi_pico_w-stubs v1.24.1.post1

samd:

  • micropython-samd-stubs v1.24.1.post1
  • micropython-samd-seeed_wio_terminal-stubs v1.24.1.post1

stm32:

  • micropython-stm32-stubs v1.24.1.post1
  • micropython-stm32-pybv11-stubs v1.24.1.post1

Relevant and related updates in the MicroPython-stubs repo

reference-stubs

The reference stubs themselves are created using the stubber tool to combine and merge infromation from the following sources.

  • The v1.24.1 docstubs , generated from the micropython library documentation.
  • PyBoardTypeshed created by Howard Lovatt
  • PoC of type hints for the RP2 PIO assembler by Jos Verlinde
  • Stubs for modules lacking documentation such as _threads and pars of hashlib and random
  • A new _mpy_shed module has been created based on the _typeshed module. This allows the different micropython stub modules to refer to common types and constants, that are different than the standard CPython types and constants.

micropython-stdlib-stubs

The stubs for the async and uasyncio modules of earlier versions had many issues.
In this version, the stunb for asyncio are based on typeshed stdlib.asyncio stub, that has been tuned specifically for micropython by removing the features and functionality that is not available in MicroPython. However the Doc strings are taken from doc-stubs, to keep them in sync in line with the MicroPython Documentaion

For distribution the _mpy_shed module is added to the micropython-stdlib-stubs package.

Significant effort has been done to improve the ability for mypy to perform type checking on the micropython code,
while maintaining compatibility with the way the micropython documentation, is structured.
There are further improvement to be made, but this is a significant step forward for mypy users.

While parts of the stdlib modules are hand-edited, they can be updated by running the python build.py.
This functionality has not been merged into the stubber tool at this time.

Know limitations

the stubs are not perfect, I am aware of a number of problems yet to solve.
Known Limitations v1.24.1