createstubs_db
¶
Create stubs for (all) modules on a MicroPython board.
This variant of the createstubs.py script is optimized for use on very-low-memory devices. Note: this version has undergone limited testing.
reads the list of modules from a text file ./modulelist.txt that should be uploaded to the device.
- creates a btree database of the files that should be stubbed
todo:
add a main.py that starts stubbing
- process the modules in the database:
stub the module
reboots the device if it runs out of memory
creates the modules.json
If that cannot be found then only a single module (micropython) is stubbed. In order to run this on low-memory devices two additional steps are recommended: - minification, using python-minifierto reduce overall size, and remove logging overhead. - cross compilation, using mpy-cross, to avoid the compilation step on the micropython device
You should find a cross-compiled version located here: `./minified/createstubs_db.mpy
Module Contents¶
Classes¶
Generate stubs for modules in firmware |
Functions¶
|
|
|
Create nested folders if needed |
|
collect base information on this runtime |
|
Determine the root folder of the device |
|
get --path from cmdline. [unix/win] |
|
runtime test to determine full or micropython |
Attributes¶
- createstubs_db.__version__ = 1.5.5¶
- createstubs_db.ENOENT = 2¶
- createstubs_db._MAX_CLASS_LEVEL = 2¶
- createstubs_db.resetWDT()¶
- class createstubs_db.Stubber(path: str = None, firmware_id: str = None)¶
Generate stubs for modules in firmware
- get_obj_attributes(self, item_instance: object)¶
extract information of the objects members and attributes
- Parameters
item_instance (object) –
- create_all_stubs(self)¶
Create stubs for all configured modules
- create_one_stub(self, module_name)¶
- create_module_stub(self, module_name: str, file_name: str = None) bool ¶
Create a Stub of a single python module
Args: - module_name (str): name of the module to document. This module will be imported. - file_name (Optional[str]): the ‘path/filename.py’ to write to. If omitted will be created based on the module name.
- write_object_stub(self, fp, object_expr: object, obj_name: str, indent: str, in_class: int = 0)¶
Write a module/object stub to an open file. Can be called recursive.
- property flat_fwid(self)¶
Turn _fwid from ‘v1.2.3’ into ‘1_2_3’ to be used in filename
- createstubs_db._info()¶
collect base information on this runtime
- createstubs_db.show_help()¶
- createstubs_db.main_esp8266()¶
- createstubs_db._log¶