stubber.publish.candidates

In order to generate stups for all ports and boars and versions of micropython we need to know what versions are available. This module provides functions to :

  • get a list of all ports for a given version of micropython ( list micropython ports)

  • get a list of all ports and board for a given version of micropython (list micropython ports boards)

    • get a list of versions for micropython ( version candidates)

  • get the frozen stubs for a given version of micropython ( frozen candidates)

  • get a list of all the docstubs (docstub candidates)

  • get a list of the firmware stubs (firmware candidates, formerly called MCU stubs)

Functions

subfolder_names(path)

returns a list of names of the sub folders of the given path

version_candidates(→ Generator[str, None, None])

get a list of versions for the given family and suffix

list_frozen_ports([family, version, path])

get list of ports with frozen stubs for a given family and version

list_micropython_ports([family, mpy_path])

get list of micropython ports for a given family and version

list_micropython_port_boards(port[, family, mpy_path])

get list of micropython boards for a given family version and board

best_matching_port(→ Optional[str])

Resolve a reported port name to a valid MicroPython port.

frozen_candidates(→ Generator[Dict[str, Any], None, None])

generate a list of possible firmware stubs for the given family (, version port and board)

is_auto(thing)

Is this version/port/board specified as 'auto' ?

board_candidates([family, versions, mpy_path])

generate a list of possible board stub candidates for the given family and version.

firmware_candidates(→ Generator[Dict[str, Any], None, ...)

Generate a list of firmware stub candidates based on existing stubs in the file system.

filter_list(worklist[, ports, boards])

filter a list of candidates down to the ones we want, based on the ports and boards specified (case insensitive)

Module Contents

stubber.publish.candidates.subfolder_names(path: pathlib.Path)

returns a list of names of the sub folders of the given path

Parameters:

path (pathlib.Path)

stubber.publish.candidates.version_candidates(suffix: str, prefix: str = '.*', *, path: pathlib.Path = CONFIG.stub_path, oldest: str = OLDEST_VERSION) Generator[str, None, None]

get a list of versions for the given family and suffix

Parameters:
Return type:

Generator[str, None, None]

stubber.publish.candidates.list_frozen_ports(family: str = 'micropython', version: str = V_PREVIEW, path: pathlib.Path = CONFIG.stub_path)

get list of ports with frozen stubs for a given family and version

Parameters:
stubber.publish.candidates.list_micropython_ports(family: str = 'micropython', mpy_path: pathlib.Path = CONFIG.mpy_path)

get list of micropython ports for a given family and version

Parameters:
stubber.publish.candidates.list_micropython_port_boards(port: str, family: str = 'micropython', mpy_path: pathlib.Path = CONFIG.mpy_path)

get list of micropython boards for a given family version and board

Parameters:
stubber.publish.candidates.best_matching_port(port: str, family: str = 'micropython', mpy_path: pathlib.Path = CONFIG.mpy_path) str | None

Resolve a reported port name to a valid MicroPython port.

MicroPython ports are defined by the folder names in micropython/ports. Some firmware reports a more specific name (e.g. ‘nrf52’) than the actual port (‘nrf’). If the reported port is not an exact match, return the known port that is the longest prefix of the reported port (e.g. ‘nrf52’ -> ‘nrf’). Returns the matched port name, or None if no match is found.

Parameters:
Return type:

Optional[str]

stubber.publish.candidates.frozen_candidates(family: str = 'micropython', versions: str | List[str] = V_PREVIEW, ports: str | List[str] = 'all', boards: str | List[str] = 'all', *, path: pathlib.Path = CONFIG.stub_path) Generator[Dict[str, Any], None, None]

generate a list of possible firmware stubs for the given family (, version port and board) - family = micropython

board and port are ignored, they are looked up from the available frozen stubs

  • versions = ‘latest’ , ‘auto’ or a list of versions

  • port = ‘auto’ or a specific port

  • board = ‘auto’ or a specific board, ‘generic’ must be specified in lowercare

Parameters:
Return type:

Generator[Dict[str, Any], None, None]

stubber.publish.candidates.is_auto(thing: None | str | List[str])

Is this version/port/board specified as ‘auto’ ?

Parameters:

thing (Union[None, str, List[str]])

stubber.publish.candidates.board_candidates(family: str = 'micropython', versions: str | List[str] = V_PREVIEW, *, mpy_path: pathlib.Path = CONFIG.mpy_path)

generate a list of possible board stub candidates for the given family and version. list is based on the micropython repo: /ports/<list of ports>/boards/<list of boards>

Parameters:
stubber.publish.candidates.firmware_candidates(family: str = 'micropython', versions: str | List[str] = V_PREVIEW, ports: str | List[str] | None = None, boards: str | List[str] | None = None, *, path: pathlib.Path = CONFIG.stub_path) Generator[Dict[str, Any], None, None]

Generate a list of firmware stub candidates based on existing stubs in the file system. This finds stubs that have already been generated and stored, including custom/out-of-tree boards. Pattern: {family}-{version}-{port}-{board} Example: micropython-v1_28_0-nrf-PROMICRO_NRF52840

Parameters: - ports: specific port(s) to search, None to search all ports - boards: specific board(s) to search, None to search all boards

Parameters:
Return type:

Generator[Dict[str, Any], None, None]

stubber.publish.candidates.filter_list(worklist: List[Dict[str, str]], ports: List[str] | str | None = None, boards: List[str] | str | None = None)

filter a list of candidates down to the ones we want, based on the ports and boards specified (case insensitive) for board also match using a ‘GENERIC_’ prefix, so board ‘s3’ will match candidate ‘GENERIC_S3’

Parameters:
  • worklist (List[Dict[str, str]])

  • ports (Optional[Union[List[str], str]])

  • boards (Optional[Union[List[str], str]])