-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jos Verlinde <Jos.Verlinde@microsoft.com>
- Loading branch information
Showing
45 changed files
with
2,785 additions
and
2,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
(intro)= | ||
# Introduction to MicroPython Stubs | ||
|
||
![logo of pencil stubs](img/colorstubs.jpg){w=300px align=right} | ||
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](https://github.com/Josverl/micropython-stubber#readme) 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](https://micropython.org/). | ||
|
||
```{figure} img/demo.gif | ||
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: | ||
|
||
1. **Faster Coding**: With stubs, you’ll write code more quickly and confidently. No more guessing function names or parameters! | ||
2. **Fewer Errors**: Stubs help catch mistakes early. If you provide incorrect arguments, you’ll get immediate feedback. | ||
3. **Code Completion**: Say goodbye to endless Googling. Stubs provide context-aware auto-completion, even for board-specific features. | ||
4. **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](https://peps.python.org/pep-0561/#stub-only-packages) 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. | ||
|
||
|
||
<!-- TODO: Add code sampled / gif of unannotated code --> | ||
|
Oops, something went wrong.