pylavi
Python LabVIEW VI file checker
Notice
This code is not endorsed, supported, or encouraged by National Instruments (NI).
This is a clean-room examiniation of LabVIEW files and using information from pylabview by mefistotelis.
There is no guarantee of this tool working as designed with any particular LabVIEW files.
You should validate that this tool will work for your use case and re-verify with each new version of LabVIEW.
Description
This tool is designed to quickly validate large groups of VIs for common problems.
This could be used in a Pull Request build to verify the LabVIEW files are saved in the correct version.
You could perform the same check using LabVIEW, but this tool can often verify thousands of files in the time it takes to launch LabVIEW (~1,200 files/second on an M2 macBook Pro).
For a Pull Request build, you want to make sure your builds are as short as possible, hence, this tool.
Using to validate VIs
Install
pip3 install pylavi
Validate VIs
This command will validate that all LabVIEW files in this directory (deep scan) were saved in a LabVIEW version greater than 21.0.0f0.
If any VIs were saved in a previous version, it will print the path to the VI and return a non-zero exit code.
vi_validate --path lv_source --no_beta --gt 21.0
usage: vi_validate [-h] [-l LT] [-g GT] [-e EQ] [-r] [-b] [-a] [-d] [-i] [-p PATH] [-s SKIP] [-x EXTENSION] [-q]
Validates LabVIEW resource files
optional arguments:
-h, --help show this help message and exit
-l LT, --lt LT LabVIEW version must be less than this
-g GT, --gt GT LabVIEW version must be greater than this
-e EQ, --eq EQ LabVIEW version must this
-r, --no-release LabVIEW version must not be release
-b, --no-beta LabVIEW version must not be beta
-a, --no-alpha LabVIEW version must not be alpha
-d, --no-development LabVIEW version must not be development
-i, --no-invalid LabVIEW version must be a valid phase
-p PATH, --path PATH Path to scan for files (or a file path) (defaults to current directory)
-s SKIP, --skip SKIP Path to not scan for files (or a file to ignore)
-x EXTENSION, --extension EXTENSION
File extensions to evaluate (defaults to all known)
-q, --quiet Reduce the output (multiple times reduces output more)
Credits
This project was inspired by pylabview by mefistotelis (which was originally forked from pylabview by jcreigh).
The idea was to reverse engineer the LabVIEW VI file format.
The pylavi
project is designed to be a reboot, taking the incredible discovery done by the pylabview
projects and simplifying the structure of the code.
This starts with a conceptual model of the LabVIEW resource file and treats the binary resources files as just collections of resources.
Once the API for working with the file format itself is solidified, then code can be added to work with resources of specific types.
Along the way discoveries will be documented.