Skip to content

BenchLab-io/benchlab-pytools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BENCHLAB PyTools

Overview

BENCHLAB PyTools is the main entry point for interacting with BENCHLAB telemetry devices using Python.
It provides a modular launcher to start different modes of operation, including:

  • Interactive terminal TUI
  • CSV logging for offline analysis
  • Fast api server
  • GUI graphing
  • HWiNFO custom sensors
  • MQTT publishing for remote dashboards
  • VU analog-style dials and configuration

The launcher can operate in interactive mode or via command-line flags.


Available Modes

Mode Flag Description Notes
CSV Logging -logfleet Logs device data to CSV Supports single-device and fleet logging.
Fast API -fastapi Access device telemetry through API calls Supports multi-device
Graph -graph GUI graphing interface Visualizes telemetry trends in real time.
HWiNFO -hwinfo HWiNFO export Export telemetry as HWiNFO custom sensors
MQTT Publisher -mqtt Publishes telemetry to MQTT broker Can connect to localhost or a remote broker.
TUI -tui Interactive terminal UI Displays a live TUI for monitoring multiple devices.
VU Dials -vu Analog-style VU dials Visual monitoring of device metrics.
VU Config -vuconfig VU configuration interface Customize VU dials and settings interactively.

Installation

BENCHLAB PyTools relies on Python 3.8+ and optional modules for each mode.

Install core dependencies:

pip install -r requirements.txt

Optional mode-specific dependencies are in:

  • /fastapi/requirements.txt
  • /tests/requirements.txt
  • /vu/requirements.txt

The launcher will attempt to install missing requirements for selected modes automatically.


Usage

Interactive Launcher

Start without arguments:

python benchlab.py
  • Presents a menu to select modes and features.
  • Optionally installs requirements for selected modes.
  • Allows selecting which mode to start immediately.

Command-Line Flags

Run directly using flags:

python benchlab.py -fastapi
python benchlab.py -graph
python benchlab.py -hwinfo
python benchlab.py -logfleet
python benchlab.py -mqtt
python benchlab.py -vu
python benchlab.py -vuconfig
python benchlab.py -tui

Info Mode

python benchlab.py -info

Displays detailed mode descriptions and exits.


Launcher Behavior

  1. Mode Selection

    • Interactive menu lists all modes with descriptions.
    • User can select one or multiple modes.
    • If all is selected, launcher installs dependencies for all available modules.
  2. Dependency Installation

    • Checks for /*/requirements.txt per mode.
    • Silently skips missing requirement files.
    • Installs via pip if present.
  3. Mode Execution

    • Rewrites sys.argv to dispatch to the selected mode.
    • Default behavior launches TUI if no flags are provided.
    • Each mode is isolated; missing modules produce informative messages.

Developer Notes

Modular Design

  • MODES dictionary defines available modes, flags, requirements, and descriptions.
  • launch_mode() handles CLI dispatching to mode-specific runners.
  • Default TUI mode uses curses.wrapper for terminal display.

Adding New Modes

  1. Add a new entry to the MODES dictionary with:
    • flag, reqs, desc, info.
  2. Implement a corresponding runner in benchlab.<module> and import it in launch_mode().
  3. Optionally provide a requirements_<tag>.txt file.

Interactive Menu

  • Clears the screen and shows mode selection.
  • Supports comma-separated input (e.g., 1,3,5) or all.
  • Supports an info view with detailed mode descriptions.
  • Automatically installs requirements for selected modes if available.

References

About

A bunch of python tools for BENCHLAB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published