This repository demonstrates various integration patterns between LabVIEW and Python, showcasing three different approaches for bidirectional communication and collaboration between the two environments.
The repository contains practical examples of three integration modes:
- LabVIEW calls Python - LabVIEW acts as the orchestrator, invoking Python code
- Python calls LabVIEW - Python scripts control and execute LabVIEW VIs
- Equal Partnership - Both systems work together through message-based architectures (RabbitMQ, gRPC)
.
├── LabVIEWtoPython/ # LabVIEW calling Python examples
│ └── PythonNode/
├── PythonToLabVIEW/ # Python calling LabVIEW examples
│ ├── PYtoLV_DLL/
│ ├── PYtoLV_HTTP/
│ ├── PYtoLV_TCP/
│ └── PYtoLV_VI-Server/
├── gRPC/ # gRPC-based integration (equal partnership)
│ ├── calculator_client/
│ ├── calculator_server/
│ ├── calculator.proto
│ ├── Client.py
│ └── Server.py
└── rabbitMQ/ # RabbitMQ-based integration (equal partnership)
├── src/
│ ├── analysis/
│ ├── simulator/
│ ├── ui/
│ └── shared/
└── tests/
Examples demonstrating how LabVIEW can call Python code directly.
Location: LabVIEWtoPython/
Features:
- Python Node integration in LabVIEW
- Image processing examples (coin counting)
- Video processing capabilities
- Coin analysis using Python computer vision libraries
Multiple approaches for Python to control and execute LabVIEW VIs:
Control LabVIEW VIs programmatically using the VI Server API via ActiveX.
Location: PythonToLabVIEW/PYtoLV_VI-Server/
Features:
- Call LabVIEW VIs from Python using
vi.Call()andvi.Call2()methods - Set/get control values on VIs
- Works with both LabVIEW Development System and built executables
- Supports connector pane parameters and loose controls
Quick Start:
cd PythonToLabVIEW/PYtoLV_VI-Server
uv run python Call-Method.py
# or
uv run python Call2-Method.pySee PYtoLV_VI-Server/readme.md for details.
Call LabVIEW web services via HTTP requests.
Location: PythonToLabVIEW/PYtoLV_HTTP/
Quick Start:
- Run LabVIEW as Administrator
- Open the LabVIEW project and start the web service
- Run:
cd PythonToLabVIEW/PYtoLV_HTTP
uv run python CallLVWebservice.pySee PYtoLV_HTTP/readme.md for details.
Network-based communication using TCP sockets.
Location: PythonToLabVIEW/PYtoLV_TCP/
Quick Start:
- Open LabVIEW Example Finder: Networking > TCP & UDP > Simple TCP.lvproj
- Run Simple TCP - Server.vi
- Run:
cd PythonToLabVIEW/PYtoLV_TCP
uv run python python-client.pySee PYtoLV_TCP/README.md for details.
Direct library calls using LabVIEW-built DLLs (Windows-specific).
Location: PythonToLabVIEW/PYtoLV_DLL/
Features:
- Call LabVIEW functionality compiled as DLL
- Low-latency integration
- Python code:
call_labview.py
Both LabVIEW and Python work as equal partners, communicating through message-based architectures.
Remote procedure call framework for high-performance, language-agnostic communication.
Location: gRPC/
Architecture:
- Protocol Buffers definition:
calculator.proto - LabVIEW Server:
calculator_server/- RPC service implementation
- Message handlers for AddRequest/AddResponse
- Server lifecycle management in
Run Service.vi
- LabVIEW Client:
calculator_client/- Client API for unary calls
- Calculator Add operation for RPC calls
- Python implementations:
Client.py,Server.py
Generated Code:
- Python:
calculator_pb2.py,calculator_pb2_grpc.py - LabVIEW: Message registration and RPC method bindings
- Protocol file:
calculator.proto
Quick Start:
cd gRPC
# To run Python gRPC server:
uv run python Server.py
# In another terminal, run Python gRPC client:
uv run python Client.pyCode Generation:
# To regenerate Python stubs:
cd gRPC
uv run python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. calculator.protoDemo:
Contains a Python demo/ folder with Python-only reference implementation.
Full-featured demo showcasing asynchronous message-based communication with UI, simulator, and analysis modules.
Location: rabbitMQ/
Architecture:
- Exchange:
demo.topic(topic exchange) - Queues:
queue.lv- Simulator/LabVIEW stubqueue.analysis- Analysis servicequeue.ui- User interface
- Message Flow:
- UI sends
cmd.start→ Simulator generatesmeas.raw→ Analysis producesmeas.result→ UI displays results - Health scoring and fault detection
- Status heartbeats from all services
- UI sends
Modules:
- Simulator (
src/simulator/) - Generates synthetic measurement data with optional fault injection - Analysis (
src/analysis/) - FFT-based frequency analysis and health scoring - UI (
src/ui/) - NiceGUI web dashboard for control and visualization - Shared (
src/shared/) - Common RabbitMQ infrastructure and message contracts
Quick Start:
-
Start RabbitMQ:
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
-
Install Dependencies:
cd rabbitMQ uv sync --extra dev -
Run Demo:
# Option A: All modules at once uv run poe run-all # Option B: Individual modules (separate terminals) uv run poe run-simulator uv run poe run-analysis uv run poe run-ui
-
Open Browser: http://localhost:8080
Features:
- Real-time measurement flow visualization
- Fault injection toggle
- Health score monitoring with color coding
- Remote shutdown via message bus
- End-to-end correlation IDs for debugging
- Frequency spectrum analysis with peak detection
Testing:
uv run poe test # Run pytest suite
uv run poe typecheck # Type checkingSee rabbitMQ/README.md for complete documentation.
- Python 3.11+
- Common libraries:
aio-pika,nicegui,numpy,plotly,grpcio,grpcio-tools,win32com(Windows only)
- LabVIEW 2020 or later recommended
- gRPC support library (gRPC LabVIEW)
- VI Server enabled for ActiveX examples
- Administrator rights for web service examples
- RabbitMQ: Docker or local installation
- gRPC: Protocol Buffers compiler for regenerating stubs