Page 1 of 1

VS Code Pymar microython

Posted: Thu Jan 13, 2022 12:01 am
by programablearg
Hello everyone, I am taking up an old project that I have with an esp32. I want to do it with micropython, I configured everything to work with vscode, but I have a detail to solve.


It gives me a warning that I would like to solve, it does not affect the operation since it works perfectly.

from machine import Pin

A warning underline appears below the word machine. With the following text

Import "machine" could not be resolved

Can this be solved?

Thanks a lot

Re: VS Code Pymar microython

Posted: Thu Jan 13, 2022 3:03 pm
by Uthayamurthy
Hi programablearg. May I know how you have configured VS Code for micropython (i.e plugins or anything else.) ?

Re: VS Code Pymar microython

Posted: Thu Jan 13, 2022 3:11 pm
by Roberthh
You can ignore the warning. The standard Python plugin for VS-Code knows CPython, but it does not know MicroPython.

Re: VS Code Pymar microython

Posted: Thu Jan 13, 2022 3:58 pm
by Uthayamurthy
Yes Roberthh, you are right. That warning should be harmless. But I think there are some special plugins for VS Code to aid micropython development (eg - Micropython IDE, Pymakr). I think there should not be any warnings if such extensions are used, not exactly sure though, since I haven't tried these extensions.

Re: VS Code Pymar microython

Posted: Thu Jan 13, 2022 4:03 pm
by Roberthh
The Pymakr IDE is for the Pycom variant of MicroPython. And pymakr is notoriously failing every month with a new VSCode release.

Re: VS Code Pymar microython

Posted: Thu Jan 27, 2022 9:15 am
by josverl
in order to get better language support for MicroPython in VScode, pylint, pycharm and others you can take a look at https://micropython-stubs.readthedocs.io/

Its not perfect, but I try to make it not wrong while still helping to write code simpler and with fewer errors.
allows you to select a specific version, port and board to check against, or use a simpler generic fallback.

Currently the initial setup requires you to clone the entire repo, working on making the installation of the type-stubs simpler by using type-packages.

Re: VS Code Pymar microython

Posted: Thu Jan 27, 2022 9:20 am
by josverl
@Robert, pymakr works fine with any port of micropython that exposes a serialport that has a driver on you Host platform.
and indeed , the Javascript serialport OSS library that is used has it's challenges in keeping up with the electron versions .
In the recent iterations Pycom has been much more responsive in fixing these issues though

Re: VS Code Pymar microython

Posted: Tue Feb 08, 2022 11:07 pm
by jim
Language and lint checking can be disabled for individual lines by appending "type: ignore" as a comment. For example:

Code: Select all

import machine              # type: ignore
This will also cause any machine.[*] call to not trigger a warning.

Checking for an entire file can be disable by putting the same as a line comment at the top of the file:

Code: Select all

# type: ignore

Re: VS Code Pymar microython

Posted: Sun Dec 18, 2022 9:24 pm
by mzm
With VS Code 1.74.1 and Ubuntu 22.04 only pymakr-preview 2.25.2 works.

Re: VS Code Pymar microython

Posted: Thu May 25, 2023 7:37 am
by Jackli
Do you need to import the official machine, otherwise it may result in incompatible versions. :)