Micropython Language for VS Code

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Jerremy09
Posts: 22
Joined: Wed May 08, 2019 7:40 am

Micropython Language for VS Code

Post by Jerremy09 » Wed May 08, 2019 7:47 am

Hello all,

I would like to ask if there is some posibility to add directly "Micropython" language into VS Code with linghter? Currently I use Python with Pylint, but it would be nice to have directly Micropython insiide.

Thank you

Jan

torwag
Posts: 217
Joined: Fri Dec 13, 2013 9:25 am

Re: Micropython Language for VS Code

Post by torwag » Wed May 08, 2019 7:50 am

It depends on what you want to achieve.

Just syntax or do you want to have a way to run the code directly on a connected uC?

You might want to look into platformio, which works together with VS code and afaik they work on micropython support. There is a plugin already.

klindber
Posts: 4
Joined: Sun Jun 09, 2019 5:37 pm
Location: Madrid, España

Re: Micropython Language for VS Code

Post by klindber » Fri Jun 14, 2019 11:29 am

There is one extension on VS Code calle PyMakr, it is focused on Pycom boards but it seemed to work for many people who wanted to run MicroPython on VSCode.

For me personally it didn't work. After installation it always prompt an error message about serialport module one time and another (I think it was some problem with my NodeJS version), so I changed to uPycraft which is working very well but it does not have Intellisense. :roll:
***
torwag wrote:
Wed May 08, 2019 7:50 am
It depends on what you want to achieve.

Just syntax or do you want to have a way to run the code directly on a connected uC?

You might want to look into platformio, which works together with VS code and afaik they work on micropython support. There is a plugin already.
Oh I didn't know about this, PlatformIO is great, I will see if I can get it to work with MicroPython. Thanks for the info!

zouden
Posts: 1
Joined: Tue Jun 18, 2019 2:33 pm

Re: Micropython Language for VS Code

Post by zouden » Tue Jun 18, 2019 2:37 pm

Hi Jerremy,

For language support I use this: https://github.com/Josverl/micropython-stubber
Follow the instructions there and you'll get *most* of the micropython modules supported by pylint. It doesn't pick up 3rd party modules though. But it's better than nothing!

Also, I wrote an extension called Micropython REPLink. It lets you send code to the REPL and/or save it as a file. I wrote it because I wasn't happy with any of the other extensions like pymakr. It relies on you to provide a REPL shell, and for that I use mpfshell. Hope you find it useful :)

User avatar
BradenM
Posts: 7
Joined: Thu Jul 11, 2019 6:29 am
Contact:

Re: Micropython Language for VS Code

Post by BradenM » Fri Jul 26, 2019 2:17 am

Hi,

continuing on what @zouden said, you may be interested in my project: https://github.com/BradenM/micropy-cli

It uses micropython-stubber, what zouden had linked above, but also solves the issue of 3rd party modules with its dependency management system. Basically, you can install modules to your project with Micropy and it will automatically stub them, allowing you to import them as you would on your device and have autocompletion/intellisense like the included modules.

Jerremy09
Posts: 22
Joined: Wed May 08, 2019 7:40 am

Re: Micropython Language for VS Code

Post by Jerremy09 » Tue Jan 21, 2020 5:44 pm

Hi klindber,

I use "PyMakr" and I can say that Im very sattisfied with it. It works greate if you want to upload whole project to board (currently I have 62 files and it is uploaded with one click). I use "Lolin D32 Pro V2" and PYMAKR do not have any issues to find it.

here is my details of VS Code I use:
Version: 1.41.1 (user setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.16299

I also neede to update "Pymakr Global Setup":
{
"address": "COM7",
"username": "",
"password": "",
"sync_folder": "",
"open_on_start": true,
"safe_boot_on_upload": false,
"fast_upload": true,
"sync_file_types": "py,log,json,xml,html,js,css,mpy,bin",
"ctrl_c_on_connect": true,
"sync_all_file_types": false,
"auto_connect": false,
"py_ignore": [],
"autoconnect_comport_manufacturers": [
"Pycom",
"Pycom Ltd.",
"FTDI",
"Microsoft",
"Microchip Technology, Inc."
]
}
klindber wrote:
Fri Jun 14, 2019 11:29 am
There is one extension on VS Code calle PyMakr, it is focused on Pycom boards but it seemed to work for many people who wanted to run MicroPython on VSCode.

For me personally it didn't work. After installation it always prompt an error message about serialport module one time and another (I think it was some problem with my NodeJS version), so I changed to uPycraft which is working very well but it does not have Intellisense. :roll:
***
torwag wrote:
Wed May 08, 2019 7:50 am
It depends on what you want to achieve.

Just syntax or do you want to have a way to run the code directly on a connected uC?

You might want to look into platformio, which works together with VS code and afaik they work on micropython support. There is a plugin already.
Oh I didn't know about this, PlatformIO is great, I will see if I can get it to work with MicroPython. Thanks for the info!

Jerremy09
Posts: 22
Joined: Wed May 08, 2019 7:40 am

Re: Micropython Language for VS Code

Post by Jerremy09 » Tue Jan 21, 2020 6:06 pm

Hi all,

thank you for your post, I will try the "Josverl" and "Braden" ways. Main point was to get to VSCode something which is not going to lint code like "import machine" ... (so micropython internals at all). I do understand to the fact that locally created function stored in another .py file can/cannot be counted and will or not will be linted, but this is good.

so thank you

Jan

Post Reply