Josverl / micropython-stubs

Stubs of most MicroPython ports, boards and versions to make writing code that much simpler.
https://micropython-stubs.readthedocs.io
MIT License
133 stars 21 forks source link

stdlib stubs contain sys.executable also in esp32 package #747

Closed paulober closed 5 months ago

paulober commented 5 months ago

In the esp32 micropython 1.21.0.post4 contains stdlib stubs 1.1.1. The sys.pyi stub file in the esp32 package does correctly not contain a executable property but the stdlib folder includes a sys folder with a init.py than contains a executable property. That causes the pylance to show sys.executable in autocompletion even though the esp32 Micropython port doesn't include a executable property in the (u)sys module.

Josverl commented 5 months ago

Hi Paul, thanks for the report, harmonizing stdlib with the different ports is a work in progress. pyright and mypy have different orders of preference and resolution mechanisms for stdlib modules.

In order to get mypy to work I have recently created an automated process to refreshed the stdlib from typeshed.

I'll need to come up with an approach to patch the module attributes as well.

Josverl commented 5 months ago

sys.executable and a bunch of other module level attributes have been removed. I published an update to stdlib that should be picked up by all the stub distributions.

See: https://github.com/Josverl/micropython-stubs/releases/tag/v1.1.2-micropython-stdlib