I'm using VScode to write MicroPython code. The linting and code completion is quite decent, but as there are quite a few differences between CPython and MicroPython, I think the linters could be better.
Is there a way for pylint to :
recognize the subset of classes / methods implemented versus CPython
In other words I'd like to prevent errors and warnings such as these:
I've looked at a promising approach by Thonny to extract module information and save that in module/APIstubs,
however that results in rather bare/sparse stubs, but that may be better than just ignoring everything.
I have also looked at options such as typeshed, or a way to have pylint consume the .rst files but I have not found anything there yet.
or has someone looked at adopting the gendoc script to generate these types of stubs ?
https://github.com/micropython/micropyt ... /gendoc.py
micropython stubs for linting
Re: micropython stubs for linting
micropython-lib includes a WIP "typing" module, which was initially contributed, and which I slowly elaborate since then: https://github.com/pfalcon/micropython- ... ter/typing .
So, beginnings of typing annotation is there, and interested parties would be able to work on actual typing stubs for MicroPython API. (Well, fairly speaking, they could start even without it, as they would use CPython-based tools for actual annotation consumption anyway, the point that the work progresses even on MicroPython's own side.)
So, beginnings of typing annotation is there, and interested parties would be able to work on actual typing stubs for MicroPython API. (Well, fairly speaking, they could start even without it, as they would use CPython-based tools for actual annotation consumption anyway, the point that the work progresses even on MicroPython's own side.)
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: micropython stubs for linting
Hi Paul,
sorry for the late response.
I did see the typing module, but i do not see how that would help for this use case.
As VSCode is running on the PC/Laptop, i would expect that a full pythin instance is available there to support the syntaxhighlighting and linting.
are you suggesting that also in that case it would make sense to use the micropython-lib version of the typing odule , rather than the full version ?
/Jos
sorry for the late response.
I did see the typing module, but i do not see how that would help for this use case.
As VSCode is running on the PC/Laptop, i would expect that a full pythin instance is available there to support the syntaxhighlighting and linting.
are you suggesting that also in that case it would make sense to use the micropython-lib version of the typing odule , rather than the full version ?
/Jos
-
- Posts: 1
- Joined: Wed Dec 08, 2021 2:39 pm
Re: micropython stubs for linting
Any progress on this? What is "the promising approach by Thonny to extract module information and save that in module/APIstubs,"?