8.5.1.3. pymodaq_utils.plugin_tools.extension_checks module

Check the modules of Dashboard extensions: the check_extension command.

It applies the rules PMQ330 to PMQ339 (see pymodaq_utils.plugin_tools.rules.check_extension_source()) to a python file or to a folder, whether the extension belongs to a plugin package or to PyMoDAQ itself. The sources are read, nothing is imported. check_plugin also applies these rules to the extensions folder of a plugin package.

Added in version 5.3.7.

pymodaq_utils.plugin_tools.extension_checks.check_extension_files(targets, fail_on='error', core=None)[source]

Run the extension rules on files or folders and return a report

Parameters:
  • targets (Sequence[str | Path]) – python files of extensions, or folders (see find_extension_files())

  • fail_on (str) – ‘error’ (default), ‘warning’ or ‘todo’, see pymodaq_utils.plugin_tools.checks.FAIL_LEVELS

  • core (Optional[bool]) – True for the extensions of PyMoDAQ: PMQ330 (EXTENSION_NAME and CLASS_NAME missing) is then not reported. By default found from the path of each file (pymodaq/extensions).

Return type:

PluginReport

pymodaq_utils.plugin_tools.extension_checks.find_extension_files(target)[source]

The python files to check: the file itself, or the modules of a folder

For a folder holding an extensions folder (the plugin package, or the repository with its src folder) the modules of this folder are taken, otherwise all the modules of the folder and its sub-folders. The __init__ and the private modules (starting with _) are left out.

Return type:

list[Path]

pymodaq_utils.plugin_tools.extension_checks.is_core_extension(path)[source]

Whether a file is in the extensions of the pymodaq package: the core extensions are registered in pymodaq.extensions and do not need to define EXTENSION_NAME and CLASS_NAME

Return type:

bool

pymodaq_utils.plugin_tools.extension_checks.main(argv=None)[source]

Print the report on extension modules: the check_extension command (or python -m pymodaq_utils.plugin_tools.extension_checks)

Returns 0 if the checks pass, 1 otherwise (so that it can also be used in a script or a CI).

Return type:

int