Support for MicroPython #3828
Replies: 17 comments 4 replies
-
Hi @koldomon We are doing some preliminary work in looking at what a great experience for embedded Python development would be. If you don't mind please share what all you would like to see here, so we can take that into consideration. Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @gramster
that's all :-) |
Beta Was this translation helpful? Give feedback.
-
It's great if VSCode also has the "Code insight" feature as in PyCharm plugins for MicroPython devices. |
Beta Was this translation helpful? Give feedback.
-
I found out, that someone of the micropython community is already working on that problem https://github.com/Josverl/micropython-stubber |
Beta Was this translation helpful? Give feedback.
-
Hi, Indeed I have been working on this topic of language support, and am trying to land on a solution that can support decent support for the different micropython and firmware versions under development, as they all differ slightly and even the same firmware may have different modules available depending on compiltation or the frozen modules added. In my view the ability to automatically generate the stubs for a specific firmware has the advantage that VSCode can work with all the different firmwares , without the need to manually code the stubs , and keep them up to date / with the various versions the downside of the generated stubs is that they have no parameter or type information. Happy to combine work on this, or if not then I will try to continue my work this into an add-on myself/ I would also be interested in understanding how to setup unit tests for such an approach. |
Beta Was this translation helpful? Give feedback.
-
@Josverl apart from frozen modules, is it possible to mock those modules from documentation+C headers so they give PEP 484 annotations ( and then offer to merge them back in Micropython documentation ) ? can https://github.com/Josverl/micropython-stubber actually help for that ? |
Beta Was this translation helpful? Give feedback.
-
Currently micropython-stubber does not take use the source files for micropython into account at all.
I have been considering to enrich the the stubs based om HTMLor RST documentation; but that is also quite unstructured across firmware flavours and authors. |
Beta Was this translation helpful? Give feedback.
-
Hi all, I've been working on a project called micropy-cli that aims to help solve this issue. Using pre-generated stubs from Josverl's micropython-stubber, it attempts to automate both stub management and project dependencies. (enabling autocompletion/intellisense for them too). It's not exactly integration, but I believe its the best we can get until more work can be done here. |
Beta Was this translation helpful? Give feedback.
-
FWIW MicroPython is now supported by the Device Simulator Express extension for the micro:bit device. |
Beta Was this translation helpful? Give feedback.
-
@brettcannon Can you please re-review if we need to have a support for this in the extension? 😄 I assume we won't be using this in the browser, so not sure where this could be helpful as of today. |
Beta Was this translation helpful? Give feedback.
-
Since everyone seems to be after IntelliSense, I'm going to move this to PyLance. |
Beta Was this translation helpful? Give feedback.
-
can we get some instructions on how to set this up to repro the issue user is reporting? For pylance to work properly, we need python interpreter to get some environment information. and stubs for builtin/stdlibs. none of them seems possible with microPython. but without actual way to set it up and repro, hard to be sure. |
Beta Was this translation helpful? Give feedback.
-
please reopen with instructions to set up and repro the issue. will close the issue until then. |
Beta Was this translation helpful? Give feedback.
-
@heejaechang, The only hustle is the need to specify |
Beta Was this translation helpful? Give feedback.
-
@Josverl thank you for the comment. one question. for the interpreter, is it using the regular python interpreter for pylance/pyright? or is there micropython for x86? otherwise, basically, all supports you want is override regular stdlib stubs to the one from micropython? |
Beta Was this translation helpful? Give feedback.
-
adding @luabud @judej for input. If we want to add some kind of support for micropython. one way we can do is I think we somehow detect the workspace is for micropython and we automatically switch typeshed folder to the micropython one and auto configure to what this says - https://micropython-stubs.readthedocs.io/en/latest/22_vscode.html#sample-vscode-configuration-file and one way to find out whether it is micropython workspace is checking whether micropython-stubs is installed in current workspace? (https://micropython-stubs.readthedocs.io/en/latest/22_vscode.html#install-the-stubs-from-pypi) |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Environment data
I want to use Visual Studio Code to develop MicroPython on a ESP8266. But I'm really new to Python and this is my really first project. I installed VSCode on Linux Mint19.1 (working fine), installed the Extenions "MicroPython IDE" and "Pymakr" (both are working fine), but when I'm writing Code, there is no code-completion for some modules and "machine" is always marked with "unresolved import". Then I cloned the github repo from micropython and "linked" it in my settings.json ("python.autoComplete.extraPaths": ["/home/me/src/micropython/ports/esp8266", "/home/me/src/micropython/drivers"]). With that extrapath i get most module with code-completion and all the nice intellisense features, but not for "machine" or "network". And I'm stuck at this point. I already tried to get some help in the micropython forum but had no success.
what i want to do: build some nice IOT devices with micropython
what i am actually doing: trying to get the environment working
I'm a developer for VB.NET for years and I know to ask "the right" people if you have a problem. So PLEASE can some of you amazing people spend a few hours to support micropython in visual studio code. PLEASE PLEASE PLEASE help.
greetings Markus
Beta Was this translation helpful? Give feedback.
All reactions