stubber.get_mpy

Collect modules and python stubs from MicroPython source projects (v1.12 +) and stores them in the all_stubs folder The all_stubs folder should be mapped/symlinked to the micropython_stubs/stubs repo/folder

Module Contents

Functions

get_frozen(stub_path: str, version: str, mpy_path: str = None, lib_path: str = None)

get and parse the to-be-frozen .py modules for micropython to extract the static type information

get_frozen_folders(stub_path: str, mpy_path: str, lib_path: str, version: str)

get and parse the to-be-frozen .py modules for micropython to extract the static type information

get_target_names(path: str) → tuple

get path to port and board names from a path

read_micropython_lib_commits(filename='data/micropython_tags.csv')

Read a csv with the micropython version and matchin micropython-lib commit-hashes

get_frozen_from_manifest(manifests, stub_path: str, mpy_path: str, lib_path: str, version: str)

get and parse the to-be-frozen .py modules for micropython to extract the static type information

Attributes

log

FAMILY

mpy_path

stubber.get_mpy.log
stubber.get_mpy.FAMILY = micropython
stubber.get_mpy.get_frozen(stub_path: str, version: str, mpy_path: str = None, lib_path: str = None)
get and parse the to-be-frozen .py modules for micropython to extract the static type information
  • requires that the MicroPython and Micropython-lib repos are checked out and available on a local path

  • repos should be cloned side-by-side as some of the manifests refer to micropython-lib scripts using a relative path

Parameters
  • stub_path (str) –

  • version (str) –

  • mpy_path (str) –

  • lib_path (str) –

stubber.get_mpy.get_frozen_folders(stub_path: str, mpy_path: str, lib_path: str, version: str)

get and parse the to-be-frozen .py modules for micropython to extract the static type information locates the to-be-frozen files in modules folders - ‘ports/<port>/modules/.py’ - ‘ports/<port>/boards/<board>/modules/.py’

Parameters
  • stub_path (str) –

  • mpy_path (str) –

  • lib_path (str) –

  • version (str) –

stubber.get_mpy.get_target_names(path: str) tuple

get path to port and board names from a path

Parameters

path (str) –

Return type

tuple

stubber.get_mpy.read_micropython_lib_commits(filename='data/micropython_tags.csv')

Read a csv with the micropython version and matchin micropython-lib commit-hashes these can be used to make sure that the correct micropython-lib version is checked out.

TODO: it would be nice if micropython-lib had matching commit-tags

# git for-each-ref –sort=creatordate –format ‘%(refname) %(creatordate)’ refs/tags

stubber.get_mpy.get_frozen_from_manifest(manifests, stub_path: str, mpy_path: str, lib_path: str, version: str)

get and parse the to-be-frozen .py modules for micropython to extract the static type information locates the to-be-frozen files through the manifest.py introduced in MicroPython 1.12 - manifest.py is used for board specific and daily builds - manifest_release.py is used for the release builds

Parameters
  • stub_path (str) –

  • mpy_path (str) –

  • lib_path (str) –

  • version (str) –

stubber.get_mpy.mpy_path = ./micropython