mlonmcu package

Subpackages

Submodules

mlonmcu.artifact module

Artifacts defintions internally used to refer to intermediate results.

class mlonmcu.artifact.Artifact(name, content=None, path=None, data=None, raw=None, fmt=ArtifactFormat.UNKNOWN, flags=None, archive=False, optional=False)[source]

Bases: object

Artifact type.

export(dest, extract=False)[source]

Export the artifact to a given path (file or directory) and update its path.

property exported

Returns true if the artifact was writtem to disk.

print_summary()[source]

Utility to print information about an artifact to the cmdline.

validate()[source]

Checker for artifact attributes for the given format.

class mlonmcu.artifact.ArtifactFormat(value)[source]

Bases: Enum

Enumeration of artifact types.

ARCHIVE = 13
BIN = 11
DATA = 6
IMAGE = 5
JSON = 9
MLF = 3
MODEL = 4
NUMPY = 7
PARAMS = 8
PATH = 10
RAW = 11
SHARED_OBJECT = 12
SOURCE = 1
TEXT = 2
UNKNOWN = 0
mlonmcu.artifact.lookup_artifacts(artifacts, name=None, fmt=None, flags=None, first_only=False)[source]

Utility to get a matching artifact for a given set of properties.

mlonmcu.config module

Collection of utilities to manage MLonMCU configs.

mlonmcu.config.filter_config(config, prefix, defaults, optionals, required_keys)[source]

Filter the global config for a given component prefix.

Returns:
cfgdict

The filteres configuration.

Raises:
AssertionError: If a required key is missing.
mlonmcu.config.remove_config_prefix(config, prefix, skip=None)[source]

Iterate over keys in dict and remove given prefix.

Returns:
retdict

The transformed configuration.

mlonmcu.config.resolve_required_config(required_keys, optional=None, features=None, config=None, cache=None, hints=None, default_flags=None)[source]

Utility which iterates over a set of given config keys and resolves their values using the passed config and/or cache.

Parameters:
required_keysList[str]
featuresList[Feature]
configdict
cacheTaskCache

Optional task cache parsed from the cache.ini file in the deps directory.

hintsList[str]

List of additional flags which can be provided as a hint to lookup a cache config.

default_flagsdict

User-provided mapping of cache flags for some cache entries.

Returns:
resultdict
mlonmcu.config.str2bool(value, allow_none=False)[source]
mlonmcu.config.str2dict(value, allow_none=False)[source]
mlonmcu.config.str2list(value, allow_none=False)[source]

mlonmcu.logging module

Loging utilities for MLonMCU

mlonmcu.logging.get_formatter(minimal=False)[source]

Returns a log formatter for one on two predefined formats.

mlonmcu.logging.get_logger()[source]

Helper function which return the main mlonmcu logger while ensuring that is is properly initialized.

mlonmcu.logging.set_log_file(path, level=10, rotate=False)[source]

Enable logging to a file.

mlonmcu.logging.set_log_level(level)[source]

Set command line log level at runtime.

mlonmcu.mlonmcu module

Main module.

mlonmcu.plugins module

Utilities for MLonMCUs extension mechanism.

mlonmcu.plugins.process_extensions(file)[source]

mlonmcu.report module

Definitions of the Report class used by MLonMCU sessions and runs.

class mlonmcu.report.Report[source]

Bases: object

Report class wrapped around multiple pandas dataframes.

add(reports)[source]

Helper function to append a line to an existing report.

property df

Combine the three internal dataframes to a large one and return in.

export(path)[source]

Export the report to a file.

set(pre=None, main=None, post=None)[source]

Setter for the dataframe.

set_main(data)[source]

Setter for the center part of the dataframe.

set_post(data)[source]

Setter for the right third of the dataframe.

set_pre(data)[source]

Setter for the left third of the dataframe.

mlonmcu.timeout module

mlonmcu.timeout.exec_timeout(timeout, func, *args, **kwargs)[source]

mlonmcu.utils module

mlonmcu.utils.ask_user(text, default: bool, yes_keys=['y', 'j'], no_keys=['n'], interactive=True)[source]
mlonmcu.utils.filter_none(data)[source]

Helper function which drop dict items with a None value.

mlonmcu.utils.get_base_prefix_compat()[source]

Get base/real prefix, or sys.prefix if there is none.

mlonmcu.utils.in_virtualenv()[source]

Detects if the current python interpreter is from a virtual environment.

mlonmcu.utils.is_power_of_two(n)[source]

mlonmcu.version module

Version module for mlonmcu.

Module contents

Top-level package for ML on MCU.