module_type — Explicit Module ClassificationReplace fragile AST import scanning with a single TOML declaration that tells plesty check exactly what kind of module you are building.
Previously, plesty check decided whether a module was a "device" by walking every .py file with Python's ast module and looking for from plesty.lib.device import … statements. This approach had several critical flaws:
False positives: The SDK's own template files in assets/ import from plesty.lib.device — so the SDK triggered Gate d1 on itself, requiring an ever-growing list of path exclusions (if "assets" in py_file.parts: continue).
Fragile coupling: If a device module restructured its imports, or if the plesty.lib namespace changed, the heuristic silently broke — a device module could stop being detected as one without any error.
Hidden behaviour: Nothing in the repository told you which type of module it was. You had to read the source code to find out.
Add module_type = "device" (or the appropriate value) to [tool.plesty] in your pyproject.toml. That single line is the source of truth.
Explicit: The type is declared, not inferred. No scanning, no path heuristics, no edge cases.
Version-control visible: The type lives in pyproject.toml, alongside the package name and version. Any change is tracked in git.
Validated: Gate 1 rejects unknown values immediately with a clear error message, so typos are caught before the push.
Activating: Setting module_type = "device" automatically activates Gate d1 (Device API Pipeline) — no other configuration needed.
A HUB device driver. Controls lab hardware via VISA, TCP/IP, or serial. Must expose a consistent API and implement the 8-gate DevicePipeline test suite.
A HUB experiment module. Orchestrates one or more devices into a complete measurement workflow. Does not control hardware directly.
Gate d1 not activatedA HUB analyzer module. Processes raw data from device outputs into meaningful results — fitting, reduction, visualisation, or classification.
Gate d1 not activatedA core PLESTY library or SDK module (plesty-lib, plesty-sdk). Not a HUB contribution. Used internally by the PLESTY team.
pyproject.tomlFind the [tool.plesty] section. If it only has standard = "quantum", you are ready to add the type.
module_type on the next lineChoose the value that matches what your module does. For a device driver, use "device".
plesty check and observe Gate 1Gate 1 now reads and validates the value. For a device module, Gate d1 activates automatically after the standard gates pass.
Gate 1 rejects any value not in the known set. The error tells you exactly what to fix.
module_type = "device"The module_type field is read once, validated by Gate 1, and its value gates subsequent checks. No other configuration is required to enable or disable Gate d1.