Giter Club home page Giter Club logo

josverl / micropython-stubber Goto Github PK

View Code? Open in Web Editor NEW
153.0 8.0 12.0 72.99 MB

Generate and maintain stubs for different MicroPython ports to use with VSCode and Pylance, PyRight, Thonny, PyCharm or pylint

Home Page: https://micropython-stubber.readthedocs.io

License: Other

Python 67.08% Shell 0.02% PowerShell 0.59% Dockerfile 0.04% Jupyter Notebook 12.30% JavaScript 19.96%
micropython-stubs micropython-stubber firmware-stubs python micropython static-typing pyright pylance vscode mypy

micropython-stubber's Introduction

Boost MicroPython productivity in VSCode

pypi version python versions Black Star on GitHub All Contributors

pytest stubber pytest mpflash Documentation Status

Open in VSCode

The intellisense and code linting that is so prevalent in modern editors, does not work out-of-the-gate for MicroPython projects. While the language is Python, the modules used are different from CPython , and also different ports have different modules and classes , or the same class with different parameters.

Writing MicroPython code in a modern editor should not need to involve keeping a browser open to check for the exact parameters to read a sensor, light-up a led or send a network request.

Fortunately with some additional configuration and data, it is possible to make the editors understand your flavor of MicroPython, wether you use one of the pre-compiled firmwares, but also if you run a one-off custom firmware version.

demo]

In order to achieve this a few things are needed:

  1. Stub files for the native / enabled modules in the firmware using PEP 484 Type Hints
  2. Specific configuration of the VSCode Python extensions
  3. Specific configuration of Pylint [ Optional ]
  4. Suppression of warnings that collide with the MicroPython principals or code optimization.

Please review the documentation on [https://micropython-stubber.readthedocs.io]

With that in place, VSCode will understand MicroPython for the most part, and help you to write code, and catch more errors before deploying it to your board.

Note that the above is not limited to VSCode and pylint, but it happens to be the combination that I use.

A lot of subs have already been generated and are shared on PyPi, github or pre-installed by a tool, so it is quite likely that you can just grab a copy be be productive in a few minutes.

To install the stubs from PyPI

This section describes how to install the stubs from PyPI, and how to use them in your project. If you want to create or maintain stub - please see the next section.

  • Install in a typings folder (recommended) pip install -U micropython-<port>[-<board>]stubs --no-user --target ./typings
  • Install in a venv (after activating) pip install -U micropython-<port>[-<board>]stubs --no-user

Examples:

pip install -U micropython-stm32-stubs

# Install stubs for a specific version.
pip install -U micropython-esp32-stubs==1.20.0.*

# Install stubs for a specific board.
pip install -U micropython-rp2-pico_w-stubs

For more details how to use the stubs please refer to the documentation on RTD

  1. The sister-repo MicroPython-stubs contains all stubs I have collected with the help of others, and which can be used directly. That repo also contains examples configuration files that can be easily adopted to your setup.

  2. A second repo micropy-stubs repo maintained by BradenM, also contains stubs, but in a structure only used and distributed by the micropy-cli tool. You should use micropy-cli to consume stubs from that repo.

The (stretch) goal is to create a VSCode add-in to simplify the configuration, and allow easy switching between different firmwares and versions.

Install and basic usage of the stubber tool

pip install micropython-stubber

# go to your working folder 
cd my_stub_folder
mkdir all-stubs

# clone the micropython repo's and switch to a specific version 
stubber clone
stubber switch --version v1.18

# get the document stubs for the current version ( v1.18 )
stubber get-docstubs

# get the frozen stubs for the current version ( v1.18 )
stubber get-frozen

# get the core CPython compatibility stubs from PyPi 
stubber get-core

# Update the fallback stubs
stubber update-fallback

#
ls all-stubs
dir all-stubs

Developing & testing

This is described in more detail in the developing and testing documents in the docs folder.

Branch Main

The name of the default branch has been changed to main. If you have cloned this repo before you main need to adjust the local repro to be aware of this, or create a fresh clone.

To update run the below command:

git branch -m master main                    
git fetch origin
git branch -u origin/main main                      
git remote set-head origin -a

for more info see Renaming a branch

Licensing

MicroPython-Stubber is licensed under the MIT license, and all contributions should follow this LICENSE.

Contributions

Jos Verlinde
Jos Verlinde

πŸ’» πŸ”¬ πŸ€” πŸ–‹ πŸ“š βœ”
Thonny, Python IDE for beginners
Thonny, Python IDE for beginners

πŸ€” πŸ”¬
MicroPython
MicroPython

πŸ”£ πŸ“š
pyright
pyright

πŸ”§
Boris Lovosevic
Boris Lovosevic

πŸ”£ πŸ“š
Paul Sokolovsky
Paul Sokolovsky

πŸ”£ πŸ“š
pycopy
pycopy

πŸ”£ πŸ“š
Pycom
Pycom

πŸš‡
Braden Mars
Braden Mars

πŸ› πŸ’» πŸ“š πŸ“¦
James Manners
James Manners

πŸ’» πŸ›
Patrick
Patrick

πŸ› πŸ’» πŸ“š
Paul m. p. P.
Paul m. p. P.

πŸ€” πŸ”¬
Edward K. Ream
Edward K. Ream

πŸ”Œ
Daryl Stultz
Daryl Stultz

πŸ“š
Keeping things together
Keeping things together

πŸ›
vbolshakov
vbolshakov

πŸ› πŸ“š
Mauro Riva
Mauro Riva

πŸ“ πŸ›
MathijsNL
MathijsNL

πŸ›
Callum Jacob Hays
Callum Jacob Hays

πŸ› βœ”
ZoltΓ‘n VΓΆrΓΆs
ZoltΓ‘n VΓΆrΓΆs

πŸ”£
vincent-l-j
vincent-l-j

πŸ“–
Egor Litvinov
Egor Litvinov

πŸ›
Sam Duke
Sam Duke

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!



micropython-stubber's People

Contributors

allcontributors[bot] avatar bradenm avatar dependabot[bot] avatar github-actions[bot] avatar jmannau avatar josverl avatar pyup-bot avatar samskiter avatar sourcery-ai[bot] avatar vincent-l-j avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micropython-stubber's Issues

MyPy.stubgen error: "yield" in async function

Describe the bug
MyPy.stubgen logs a critical error
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/lock.py:38: error: "yield" in async function

To Reproduce

python3 src/get_all_frozen.py -stubs all-stubs --mpy

lOGS

Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:30: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:34: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:40: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:52: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:65: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:91: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:114: error: "yield" in async function
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/__init__.py
Processing 1 files...
Processing uasyncio
Created all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/__init__.pyi
Processed 1 modules
Generated all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/__init__.pyi
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/funcs.py
Processing 1 files...
Processing uasyncio.funcs
Created all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/funcs.pyi
Processed 1 modules
Generated all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/funcs.pyi
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/lock.py
Processing 1 files...
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/lock.py:38: error: "yield" in async function
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/core.py
Processing 1 files...
Processing uasyncio.core
Created all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/core.pyi
Processed 1 modules
Generated all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/core.pyi
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/event.py
Processing 1 files...
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/event.py:32: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/event.py:57: error: "yield" in async function
INFO:utils:no matching py for : all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/funcs.pyi
INFO:utils:no matching py for : all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/core.pyi
INFO:utils:no matching py for : all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/__init__.pyi
INFO:utils:moving : all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/funcs.pyi
INFO:utils:moving : all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/core.pyi
INFO:utils:moving : all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/uasyncio/__init__.pyi
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/umqtt/robust.py
Processing 1 files...
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/umqtt/robust.py:2: error: No parent module -- cannot perform relative import
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py
Processing 1 files...
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:30: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:34: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:40: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:52: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:65: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:91: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/stream.py:114: error: "yield" in async function
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/lock.py
Processing 1 files...
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/lock.py:38: error: "yield" in async function
Calling stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/event.py
Processing 1 files...
Critical error during semantic analysis: all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/event.py:32: error: "yield" in async function
all-stubs/micropython-latest-frozen/esp8266/GENERIC/uasyncio/event.py:57: error: "yield" in async function
::group::[stubgen] running stubgen on all-stubs/micropython-latest-frozen/esp8266/GENERIC_512K
Processed 11 modules
Generated files under all-stubs/micropython-latest-frozen/esp8266/GENERIC_512K/

**Stubber information **

  • Version
  • Normal or Minified version
  • run directly or though Micropy-cli

**Firmware Information **

  • Family: [e.g. micropython, pycopy , M5Stack ...]
  • Version [e.g. 1.17-Latest]
  • specific additional modules ( if any)

** Hardware information **

  • Make & version
  • CPU
  • Link to HW spec ( if possible)

VS Code Extension Information (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

fix createsubs.py to run in unix port

in order to be able to run CI tests the stubber needs to run on unix/linux

  • fix createstubs to run on linux

  • improve uname() solution

  • add --path parameter

  • use path in test

  • update documentation

Webrepl

Unable to import 'webrepl'
can include in common modules
...\micropython\extmod\webrepl\webrepl.py

Stubber - custom fwid is not used in path and version

  • stub path should respect custom fwid

  • should add option to override version / release

    "firmware": {
    "ver": "1.17-564",
    "port": "esp32",
    "arch": "xtensawin",
    "sysname": "esp32",
    "release": "8.1.0-dev",
    "name": "micropython",
    "mpy": 10757,
    "version": "8.1",
    "machine": "ESP32 module (spiram) with ESP32",
    "build": "564",
    "nodename": "esp32",
    "platform": "esp32",
    "family": "lvgl"
    },

bug: createstubber creates subfolders for modules that are not on the board.

Low Prio
no stub files are created ( which is good), but it would be cleaner if the folders were not created in the first place

INFO  :stubber :Start micropython-stubber v1.4.0 on micropython-linux-1.12.0
INFO  :stubber :Stub module: umqtt/robust         to file: ./stubs/micropython-linux-1_12_0/umqtt/robust.py        mem:2047808
WARN  :stubber :Skip module: umqtt.robust                : Failed to import
INFO  :stubber :Stub module: umqtt/simple         to file: ./stubs/micropython-linux-1_12_0/umqtt/simple.py        mem:2047776
WARN  :stubber :Skip module: umqtt.simple                : Failed to import

still creates folders on the filesystem for umqtt and uasyncio

Stub reports have inconsistent "version" values

Depending on which branch of Micropython firmware you use, the generated modules.json information file's version key is inconsistent.

On esp32_LoBo_3_2_9:

"version": "ESP32_LoBo_v3.2.9 on 2018-04-12"
"release": "3.2.9"

  • version refers to the extended version with firmware and date information
  • release refers to the numerical version

On esp8266_v1_10:

"version": "v1.10-8-g8b7039d7d on 2019-01-26"
"release": "2.2.0-dev(9422289)"

  • version refers to extended version with firmware/commit/date information
  • release refers to the version of the esp sdk

This inconsistency is further apparent on other stubs.

Add Micropython `extmod` python packages to micropython frozen-stubs

Suggested in : Josverl/micropython-stubs#92

I wonder if it would make more sense for python-based uPy packages to directly parse the source files themselves? E.g. this for uasyncio.sleep. I believe stubgen from mypy does this. I just tried:

~/code/micropython/mainline_uPy/micropython/extmod                                                                                                       [master]
% stubgen -o ../../../mypy_stubs uasyncio  

And it did a pretty nice job producing .pyi files with this package, e.g.:

def sleep_ms(t, sgen=...): ...
def sleep(t): ...

initial thinking :

, and now it indeed generates some useful stubs for the .py files included as standard modules in that mpy version

I think it makes sense to add these to the set of frozen modules for the respective micropython ports, to avoid needing to add yet another 'type of stubs'
image

Note that these modules are nt included in the mpy Module manifests model

Add Python 3.10 support - upstream rshell dept

currently tests fail on Windows Python 3.10
due to a failing rshell dependency on pyreadline which is ancient

.venv\lib\site-packages\pyreadline\py3k_compat.py:8
  c:\develop\MyPython\micropython-stubber\.venv\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

investigate/resolve 'import time' and 'import gc' issues

workaround for sys and gc
# pylint: disable=no-member

Module 'sys' has no 'print_exception' member
Module 'gc' has no 'mem_free' member
Module 'gc' has no 'threshold' member
Module 'gc' has no 'mem_free' member
Module 'gc' has no 'mem_alloc' member
{
"resource": "/c:/develop/MyPython/ESP32-P1Meter/src/main.py",
"owner": "python",
"code": "no-member",
"severity": 8,
"message": "Module 'gc' has no 'mem_free' member",
"source": "pylint",
"startLineNumber": 33,
"startColumn": 22,
"endLineNumber": 33,
"endColumn": 22
}

I get nothing from Maixduino

Anyone ever tried on Sipeed Maixduino? I followed the instructions and when I run the createstubs I get nothing.

docstubs bug : `from __future__ import annotations`

from __future__ import annotations should be the first line of code

  *** Error compiling 'C:\\develop\\MyPython\\micropython-p1meter\\venv\\Lib\\site-packages\\esp32.py'...
    File "C:\develop\MyPython\micropython-p1meter\venv\Lib\site-packages\esp32.py", line 26
      from __future__ import annotations
      ^
  SyntaxError: from __future__ imports must occur at the beginning of the file

To Reproduce
pip install the docstubs

pip install C:\develop\MyPython\esp32-test-stubs\stubs\micropython-v1_17-docstubs -v

Additional context

Need to fid a way to test this ?

Autodetection of modules in firmware

Hi,
I'm working on getting my stubs prepared for a lv_micropython 1.17 for ESP32 firmware.
I tried micropy-cli first and then micropython-stubber since a forum post mentioned that micropy-cli did not collect all modules besides micropython's. Now, that forum post mentioned that I could edit createstubs.py to add the desired modules with the output of the help("modules") command.
Shouldn't it be possible to capture the output of the help("modules") command, parse it, discard the problematic modules, deduplicate the list against the originally hardcoded one and then continue with the stub generation? It won't catch all modules, but at least it would get modules added like lvgl (I am not certain if the term is "frozen" for those modules?)

I finally got my stubs after moving to a board with SPIRAM, since the lvgl stub file ended up clocking at around 600kb and that went over the paltry 82kb of RAM that my original board had available...
But in any case, I'd like to help automate that step.

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Link to mpy-stubs repo

update the documentation to link the two repo'sand update the documentation on how to use

Allow install from Github repo

Allow download / installation of the stubber scripts from the repro

2 versions:

  • minified
  • board

possibly also the PC processing scripts

pip install -e "git+https://github.com/Josverl/micropython-stubber.git@master#egg=micropython-stubber&subdirectory=minified"
( or does this take tooooo long to download)

generated classes do not have __init__ methods

the generated classes do not have __init__ methods.
that also leads to the fact that the classes do not have an inferred type after they have been instantiated
for the machine.UART class something like this would help:

class UART:
    def __init__(self):
        'UART on <firmware>'
        pass

Pythonpath : Best (?) Version of Python to use?

I can see in your example you are using Python3.6 as your baseline Python version:

"python.pythonPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\python.exe",

The MicroPython docs say its based on 3.4(which could be incorrect now) but I also know there's been additional features brought back into MicroPython from later Python releases.

I'm just wondering why that specific version in your example and if there's some trigger we can use to know when to move forward.

Thanks,
-p

get the number of positionnal arguments or variable

following microsoft/pylance-release#3783 i had an idea (won't work on closed source, but who would like to work with a closed source micropython anyway ) ?

Maybe try that way:
rgrep ^STATIC MP_DEFINE_CONST_FUN_OBJ on all the source tree

per line you'll have

  1. will be name of module ***** generally py/mod******.c

  2. you will get either MP_DEFINE_CONST_FUN_OBJ_x where x is the number of fixed args
    or MP_DEFINE_CONST_FUN_OBJ_VAR for variable arguments list.

  3. you'll get a () couple where the 2nd item is the function name

I guess you are extracting from a live board and according to the example i gave you in the wrong place (sorry for that) you've closed to my nose when i was about to apologize.

you would get :
py/modmicropython.c:STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_micropython_schedule_obj, mp_micropython_schedule);

that means micropython.schedule(arg0, arg1) which is probably better than micropython.schedule()

also that gives name of relevant C source, maybe more can be extracted there
eg rgrep mp_micropython_schedule|grep { |grep -v MP_ROM

could inform that :

micropython.schedule(function, arg)

improve generation of class methods to include (self,...)

Normal methods should have at least one parameter (the first of which should be 'self').
according to pep484 there is no need to add a type definition to the self parameter

line 247 ?

            if typ in ["<class 'function'>", "<class 'bound_method'>"]:
                s = indent + "def " + name + "():\n"    #todo: add self, and optional params
                s += indent + "    pass\n\n"
                fp.write(s)
                self._log.debug('\n'+s)

deal with modules with very large number of modules

ie the M5Stack has so many frozen and nested modules that stubber runs out of memory , and needs 2 runs to complete all

possible solutions:

  • save list on disk and use soft-reboot to free memory

  • find a way to do partial dumps, and continue
    note: the json file may be difficult to deal with as that is also memory hungry

    #stubber.modules = ['flowlib/app_manage', 'flowlib/button', 'flowlib/face', 'flowlib/faces/_calc', 'flowlib/faces/_encode', 'flowlib/faces/_joystick', 'flowlib/faces/_keyboard', 'flowlib/faces/_rfid', 'flowlib/flowSetup', 'flowlib/i2c_bus', 'flowlib/lib/bmm150', 'flowlib/lib/bmp280', 'flowlib/lib/chunk', 'flowlib/lib/dht12', 'flowlib/lib/easyIO', 'flowlib/lib/emoji', 'flowlib/lib/imu', 'flowlib/lib/mpu6050', 'flowlib/lib/mstate', 'flowlib/lib/numbers', 'flowlib/lib/pid', 'flowlib/lib/sh200q', 'flowlib/lib/speak', 'flowlib/lib/time_ex', 'flowlib/lib/urequests', 'flowlib/lib/wave', 'flowlib/lib/wavplayer', 'flowlib/lib/wifiCardKB', 'flowlib/lib/wifiCfg', 'flowlib/lib/wifiWebCfg', 'flowlib/m5cloud', 'flowlib/m5mqtt', 'flowlib/m5stack', 'flowlib/m5ucloud', 'flowlib/module', 'flowlib/modules/_cellular', 'flowlib/modules/_lego', 'flowlib/modules/_legoBoard', 'flowlib/modules/_lidarBot', 'flowlib/modules/_lorawan', 'flowlib/modules/_m5bala', 'flowlib/modules/_stepMotor', 'flowlib/peripheral', 'flowlib/power', 'flowlib/remote', 'flowlib/simple', 'flowlib/timeSchedule', 'flowlib/uiflow', 'flowlib/unit', 'flowlib/units/_adc', 'flowlib/units/_angle', 'flowlib/units/_button', 'flowlib/units/_cardKB', 'flowlib/units/_color', 'flowlib/units/_dac', 'flowlib/units/_dual_button', 'flowlib/units/_earth', 'flowlib/units/_env', 'flowlib/units/_ext_io', 'flowlib/units/_finger', 'flowlib/units/_gps', 'flowlib/units/_ir', 'flowlib/units/_joystick', 'flowlib/units/_light', 'flowlib/units/_makey', 'flowlib/units/_mlx90640', 'flowlib/units/_ncir', 'flowlib/units/_pahub', 'flowlib/units/_pbhub', 'flowlib/units/_pir']
    #stubber.add_modules(['display', 'espnow','flowlib/units/_relay', 'flowlib/units/_rfid', 'flowlib/units/_rgb', 'flowlib/units/_rgb_multi', 'flowlib/units/_servo', 'flowlib/units/_tof', 'flowlib/units/_tracker', 'lidar', 'logging', 'm5base', 'm5uart', 'm5ui', 'microWebSocket', 'microWebSrv', 'microWebTemplate', 'mlx90640'])

Failed to execute script error

Hey everybody, I’m currently trying to create a stub for my PYboard but am just getting this error:

MicroPy  Connecting to Pyboard @ COM5
MicroPy  βœ” Connected!
MicroPy  Executing stubber on pyboard...
MicroPy  Failed to execute script: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>", line 255, in <module>\r\n  File "<stdin>", line 252, in main\r\n  File "<stdin>", line 184, in clean\r\nOSError: [Errno 2] ENOENT\r\n')

Can anybody help me?
I tried different versions and have reinstalled it multiple times.

Thanks in advance,
Fischchen

module.json schema is too simplistic

the module .json file uses a very simplistic format ( a single array of things) , making it hard to read and reason over it.
A better format would be something such as :

{
    "firmware": {
        "machine": "ESP32 board with ESP32",
        "firmware": "1.2.3.4",
        "nodename": "esp32_LoBo",
        "version": "3.2.24",
        "release": "3.2.24",
        "sysname": "esp32_LoBo"
    },
    "stubber": {
        "version": "1.2.1"
    },
    "modules": [
        {
            "file": "file_name",
            "module": "module_name"
        },
        {
            "file": "file_name",
            "module": "module_name"
        },
        {
            "file": "file_name",
            "module": "module_name"
        }
    ]
}

sort out multi-ws configuration for pylance

  • board - use micropython
  • src / &7 /tests - use normal python

If / when we can get pylance to work with the micropython stubs , this may become simpler as
Pylance natively supports multi-root workspaces, meaning that you can open multiple folders in the same Visual Studio Code session and have Pylance functionality in each folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.