stubber.stubber

Pre/Post Processing for createstubs.py

Module Contents

Functions

do_post_processing(stub_paths: List[pathlib.Path], pyi: bool, black: bool)

Common post processing

stubber_cli(ctx, debug=False)

cli_init(mpy: bool, mpy_lib: bool, path: Union[str, pathlib.Path])

Clone the micropython repos locally to be able to generate frozen-stubs and doc-stubs.

cli_stub(source: Union[str, pathlib.Path])

Create or update .pyi type hint files for all .py files in SOURCE path.

cli_minify(ctx, source: Union[str, pathlib.Path], target: Union[str, pathlib.Path], keep_report: bool, diff: bool, cross_compile: bool, all: bool) → int

Creates a minified version of the SOURCE micropython file in TARGET (file or folder).

cli_get_frozen(stub_folder: str = STUB_FOLDER, mpy_folder: str = MPY_FOLDER, mpy_lib_folder: str = MPY_LIB_FOLDER, version: str = '', pyi: bool = True, black: bool = True)

Get the frozen modules for the checked out version of MicroPython

cli_get_lobo(stub_folder: str = STUB_FOLDER, pyi: bool = True, black: bool = True)

Get the frozen modules for the Loboris v3.2.24 fork of MicroPython

cli_get_core(stub_folder: str = STUB_FOLDER, pyi: bool = True, black: bool = True)

Get the core (CPython compat) modules for both MicroPython and Pycopy.

cli_docstubs(source: str = '', target: str = './all-stubs', verbose: bool = False, black: bool = True, basename='micropython')

Read the Micropython library documentation files and use them to build stubs that can be used for static typechecking.

Attributes

STUB_FOLDER

MPY_FOLDER

MPY_LIB_FOLDER

log

stubber.stubber.STUB_FOLDER = ./all-stubs
stubber.stubber.MPY_FOLDER = ./micropython
stubber.stubber.MPY_LIB_FOLDER = ./micropython-lib
stubber.stubber.log
stubber.stubber.do_post_processing(stub_paths: List[pathlib.Path], pyi: bool, black: bool)

Common post processing

Parameters
stubber.stubber.stubber_cli(ctx, debug=False)
stubber.stubber.cli_init(mpy: bool, mpy_lib: bool, path: Union[str, pathlib.Path])

Clone the micropython repos locally to be able to generate frozen-stubs and doc-stubs.

Parameters
stubber.stubber.cli_stub(source: Union[str, pathlib.Path])

Create or update .pyi type hint files for all .py files in SOURCE path.

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

Creates a minified version of the SOURCE micropython file in TARGET (file or folder).

Parameters
Return type

int

stubber.stubber.cli_get_frozen(stub_folder: str = STUB_FOLDER, mpy_folder: str = MPY_FOLDER, mpy_lib_folder: str = MPY_LIB_FOLDER, version: str = '', pyi: bool = True, black: bool = True)

Get the frozen modules for the checked out version of MicroPython

Parameters
  • stub_folder (str) –

  • mpy_folder (str) –

  • mpy_lib_folder (str) –

  • version (str) –

  • pyi (bool) –

  • black (bool) –

stubber.stubber.cli_get_lobo(stub_folder: str = STUB_FOLDER, pyi: bool = True, black: bool = True)

Get the frozen modules for the Loboris v3.2.24 fork of MicroPython

Parameters
  • stub_folder (str) –

  • pyi (bool) –

  • black (bool) –

stubber.stubber.cli_get_core(stub_folder: str = STUB_FOLDER, pyi: bool = True, black: bool = True)

Get the core (CPython compat) modules for both MicroPython and Pycopy.

Parameters
  • stub_folder (str) –

  • pyi (bool) –

  • black (bool) –

stubber.stubber.cli_docstubs(source: str = '', target: str = './all-stubs', verbose: bool = False, black: bool = True, basename='micropython')

Read the Micropython library documentation files and use them to build stubs that can be used for static typechecking.

Parameters
  • source (str) –

  • target (str) –

  • verbose (bool) –

  • black (bool) –