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

sys.implementation is a namedtuple, not a tuple #708

Open scy opened 1 year ago

scy commented 1 year ago

The sys stub for 1.19.1 (ESP32) says that sys.implementation is a tuple. However, it’s actually a namedtuple; its items can be accessed as attributes, e.g. sys.implementation.name.

Using sys.implementation.name currently results in error: "Tuple[Any, ...]" has no attribute "name".

Josverl commented 1 year ago

I have run into the same, and have a potential fix in the works. One catch is that the micropython docs state that the value is a tuple, and that some ports supply a named tuple.

For typing a Union of both may be a good enough experience