-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
micropython stdlib contains some modules that are not available on MicroPython #729
Comments
…sh pre-release #729 Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Hi @Josverl II'm trying to use the above to get the typing module. I've done I've added an import from I then use vscode and MicroPico extension to upload the project. When I try to run, I get the error;
Indeed it does look as though the typings folder is not uploaded to the pico. |
Ah, that is something different. There is a PR open to add that functionality, but there is no consensus yet. Meanwhile you can typing add it to your source [in I'll share a sample of a project where I have done that Uploading those files on your board costs a few bytes of flash - but will avoid the ImportError and fiends Also static types get optimized out during freezing or cross-compilation ( -O2 IIRC) so its not needed for production. |
OK thanks, I'll try that over the weekend. Now I'm not sure what your std-lib stubs added for my setup. Before I added your stubs vscode was allowing me to add typing info and I'm guessing that is because it's language server is reading my default system python libraries. Does that make sense? Perhaps this question needs to go to @paulober as I'm not sure how his vscode extension makes use of the stubs? |
The settings.json in your pico project redirects the Python language server for stubs into |
|
Hi @Josverl @paulober thanks for your help on this. I now have it working. It seems the only thing I needed to do was to add the typing.py and typing_extensions.py stubs to the lib folder. That's it. I did successfully install your stubs But anyway the result is great - I get to use all the usual power of vscode and python static type checking for code that can run on the Pico. Many thanks! |
Thanks for confirming.
Still thinking of a way to automate this, possibly using a mip install
The combined work of lots of people 😎 |
Raised on paulober/MicroPico#170
micropython-stdlib contains (copies of) the typeshed stdlib
Some of these packages / modules are used internally by stdlib - so they cannot just be removed
Ill try to rename them in vscode ( which should also refactor the imports in the relevant modules that import these)
see : https://github.com/Josverl/micropython-stubs/blob/main/publish/micropython-stdlib-stubs/stdlib/
The text was updated successfully, but these errors were encountered: