Introduction to MicroPython Stubs¶
Welcome to the MicroPython Stubs repository! Here, you’ll find a treasure trove of over 3,000 stub files generated by the MicroPython-Stubber tool. Whether you’re just starting out or a seasoned developer, these stubs are designed to supercharge your MicroPython development process.
This repo stores stubs generated by the MicroPython-Stubber tool which combines documentation with introspection to build a comprehensive set of stubs for MicroPython.
Currently over 3.000 stub files of multiple MicroPython versions and modules are available 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.

Using the MicroPython Stubs in VSCode with Pylance.¶
What are type stubs?¶
Stubs are like cheat sheets for your code. They provide hints, auto-completion, and static type checking, making your life as a developer easier and more productive. Here’s what you can expect from these MicroPython Stubs:
Faster Coding: With stubs, you’ll write code more quickly and confidently. No more guessing function names or parameters!
Fewer Errors: Stubs help catch mistakes early. If you provide incorrect arguments, you’ll get immediate feedback.
Code Completion: Say goodbye to endless Googling. Stubs provide context-aware auto-completion, even for board-specific features.
Static Type Checking: By adding typing information, you’ll catch type-related bugs before they cause runtime issues.
The stubs are packaged and published to PyPi as Pep 561 stub-only packages to allow them to be installed and used with ease.
Type stubs are used by IDEs, linters, and static type checkers to provide a better development experience. They’re especially useful for MicroPython, where the dynamic nature of the language , and the differences between the different ports and boards can make it hard to catch errors early.
Benefits of using MicroPython Stubs¶
If you:
Use a modern Editor or IDE that supports Python static type checking
Install the MicroPython Stubs on you computer (not on the MCU)
Add some basic configuration to your IDE
Use static type checking in your development process
Y=ou can benefit from:
MicroPython specific auto completion, of arguments and things like board specific Pin names
Tooltips with documentation of the MicroPython stdlib and included modules , specific to you port and board
Direct feedback or errors if you provide incorrect parameters to functions or methods
Adding additional checks to you CI/CD Pipelines to catch errors before they are merged into the main branch
Refactor with confidence, knowing that the type checker will help you catch more errors.