laborchestrator.pythonlab_process_finder module

This module provides the ProcessFinder. A tool ta get a list of all available PythonLan processes in a specified directory or module.

class laborchestrator.pythonlab_process_finder.ImportableProcess(module, name, file_path)[source]

Bases: NamedTuple

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {'file_path': None}
_fields = ('module', 'name', 'file_path')
classmethod _make(iterable)

Make a new ImportableProcess object from a sequence or iterable

_replace(**kwds)

Return a new ImportableProcess object replacing specified fields with new values

file_path: str | None

Alias for field number 2

module: ModuleType

Alias for field number 0

name: str

Alias for field number 1

class laborchestrator.pythonlab_process_finder.ProcessFinder[source]

Bases: object

static _find_processes(pck: ModuleType) List[ImportableProcess][source]

recursively iterate through namespace Specifying the second argument (prefix) to iter_modules makes the returned name an absolute name instead of a relative one. This allows import_module to work without having to do additional modification to the name. s. https://packaging.python.org/guides/creating-and-discovering-plugins/

static create_process(importable_process: ImportableProcess) PLProcess[source]
static create_process_from_id(process_id: str, pck: ModuleType) PLProcess | None[source]
static get_processes(pck: ModuleType) List[ImportableProcess][source]
static importable_processes_from_string(src: str, debug_printouts: bool = False) List[ImportableProcess][source]
static to_process_id(ip: ImportableProcess)[source]

In case two processes have the same name, this is a readable, unique string to distinguish them :param ip: :return: