stubber.stubber
¶
Create, Process, and Maintain stubs ✏️ for MicroPython
Module Contents¶
Functions¶
|
|
|
Clone/fetch the micropython repos locally. |
|
Switch to a specific version of the micropython repos. |
|
Create or update .pyi type hint files. |
|
Minify createstubs*.py. |
|
Get the frozen stubs for MicroPython. |
|
Get the frozen stubs for Lobo-esp32. |
|
Download core CPython stubs from PyPi. |
|
Build stubs from documentation. |
|
Update the fallback stubs. |
Attributes¶
- stubber.stubber.log¶
- stubber.stubber.stubber_cli(ctx, verbose=False, debug=False)¶
- stubber.stubber.cli_clone(path: Union[str, pathlib.Path])¶
Clone/fetch the micropython repos locally.
The local repos are used to generate frozen-stubs and doc-stubs.
- Parameters
path (Union[str, pathlib.Path]) –
- stubber.stubber.VERSION_LIST¶
- stubber.stubber.cli_fetch(path: Union[str, pathlib.Path], tag: Optional[str] = None)¶
Switch to a specific version of the micropython repos.
Specify the version with –tag or –version to specify the version tag of the MicroPython repo. The Micropython-lib repo will be checked out to a commit that corresponds in time to that version tag, in order to allow non-current versions to be stubbed correctly.
The repros must be cloned already
- Parameters
path (Union[str, pathlib.Path]) –
tag (Optional[str]) –
- stubber.stubber.cli_stub(source: Union[str, pathlib.Path])¶
Create or update .pyi type hint files.
- Parameters
source (Union[str, pathlib.Path]) –
- stubber.stubber.cli_minify(ctx, source: Union[str, pathlib.Path], target: Union[str, pathlib.Path], keep_report: bool, diff: bool, cross_compile: bool, all: bool) int ¶
Minify createstubs*.py.
Creates a minified version of the SOURCE micropython file in TARGET (file or folder). The goal is to use less memory / not to run out of memory, while generating Firmware stubs.
- Parameters
source (Union[str, pathlib.Path]) –
target (Union[str, pathlib.Path]) –
keep_report (bool) –
diff (bool) –
cross_compile (bool) –
all (bool) –
- Return type
- stubber.stubber.cli_get_frozen(stub_folder: str = config.stub_path.as_posix(), version: str = '', pyi: bool = True, black: bool = True)¶
Get the frozen stubs for MicroPython.
Get the frozen modules for the checked out version of MicroPython
- stubber.stubber.cli_get_lobo(stub_folder: str = config.stub_path.as_posix(), pyi: bool = True, black: bool = True)¶
Get the frozen stubs for Lobo-esp32.
Get the frozen modules for the Loboris v3.2.24 fork of MicroPython
- stubber.stubber.cli_get_core(stub_folder: str = config.stub_path.as_posix(), pyi: bool = True, black: bool = True)¶
Download core CPython stubs from PyPi.
Get the core (CPython compat) modules for both MicroPython and Pycopy.
- stubber.stubber.cli_docstubs(path: str = config.repo_path.as_posix(), target: str = config.stub_path.as_posix(), verbose: bool = False, black: bool = True, basename='micropython')¶
Build stubs from documentation.
Read the Micropython library documentation files and use them to build stubs that can be used for static typechecking.