jonathanfoster / micropython-stubs

Stubs of common micropython modules to aid in code completion, static typechecking and overall development

Home Page:https://micropython-stubs.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

micropython-stubs

pencil stubs

This repo stores stubs generated by the MicroPython-Stubber tool. Currently over 3.000 stubfiles of common MicroPython modules are available in this repo to help you :

  • write code quicker
  • with less errors,
  • get help from code completion,
  • use static type checking

and improve the overall development experience while writing MicroPython.

Demo using VSCode:
demo

Using the MicroPython stubs

in order to get the most out of the MicroPython stubs, you should follow these steps:

  • determine which Micropython version and port you are using.

To install the latest stubs:

pip install -U micropython-<port>-stubs

where port is the port of the MicroPython firmware. ( stm32, eps32,rp2...)

To install the stubs for an older version, such as MicroPython 1.17:

pip install -U micropython-stm32-stubs==1.17.*

To install the stubs for a specific port , such as the ESP32 UM-TinyPico:

pip install -U micropython-esp32-um-tinypico-stubs

Note: PyPi transforms all names to smallcaps and kebab-case, not snake_case.

Simple overview of the published ports and boards.

STM32 ESP32 ESP8266 RP2040
GENERIC
​

Notes:

  • Not all possible ports/boards are published as I do not have access to hardware to run all ports.
  • newly published stubs may show as 'not found', please check PyPi directly
  • Please let me know if you would like to see a port or board added, and are willing to help in validation. Discussions

What do you get

  • micropython-<port>[-<board>]-stubs
    The stubs for a specific version port and board of the MicroPython firmware. These are built by combining:

    • The 'Firmware stubs' generated on a generic board for the port
    • The 'Frozen stubs' from the Micropython repository for that specific version and that port & board combination
    • The 'Core Stubs' to provide a common interface for the Micropython firmware and the CPython core.

    Note: board is omitted if it is GENERIC

    Examples:

    • micropython-stm32-stubs
    • micropython-esp32-stubs
    • micropython-rp2-stubs
    • micropython-esp8266-stubs

Then in VSCode press : F1 and select Python: Restart language server
(only needed once)

You can search for Micropython stub packages on PyPI

List of current firmwares and stubs

The list of the current included firmwares, ports and boards includes stubs from the following micropython families:

  • MicroPython

  • Pycopy

  • Loboris port (ESP32)

  • LVGL

  • EV3 / Lego

  • M5Stack

For a full overview of all stubs check out the documentation on read the docs, or in docs/firmware_grp.md

Using the stubs

To learn how to use the stubs please refer to the documentation on RTD

Branch Main

The name of the default branch has been changed to main. For more info see Renaming a branch

Contributors

Thanks to everyone that has submitted stubs or other relevant pieces of code and information, or published relevant stubs on pypi or github.


Jos Verlinde

πŸ’» πŸ“ βœ” πŸ”§

MicroPython

πŸ”£ πŸ“

Boris Lovosevic

πŸ”£ πŸ“

Paul Sokolovsky

πŸ”£ πŸ“

pycopy

πŸ”£ πŸ“

Pycom

πŸš‡

Braden Mars

πŸ“ βœ” πŸ”§ πŸ“¦

Paul Sokolovsky

πŸ“

Daryl Stultz

πŸ“

Patrick

βœ” πŸ“

Callum Jacob Hays

πŸ’‘ πŸ”¬

Ronald Hiemstra

πŸ“ πŸ–‹ πŸ“–

Chris Wood

πŸ“ πŸ”§

thingslu

πŸ“ βœ”

Matin Tat

βœ”

Roberto Jose Etcheverry Romero

βœ”

jdsmith

βœ”

Mr Keuz

πŸ’» βœ”

Matt Trentini

πŸ“

Andrew St Clair

πŸ“

I invite everyone that has generated stubs for a board or port not on the current list, or has another contribution, to submit the stubs via a pull request or by just zipping up your stubs and creating an issue.

This project follows the all-contributors specification.

About

Stubs of common micropython modules to aid in code completion, static typechecking and overall development

https://micropython-stubs.readthedocs.io

License:MIT License


Languages

Language:Python 100.0%Language:Dockerfile 0.0%Language:PowerShell 0.0%Language:PostScript 0.0%