Package: pylavi
pylaviPython LabVIEW VI file checker.There are many valuable checks that should be done on LabVIEW source code.
While you can perform all these checks via running LabVIEW,vi_validatecommand can validate over a thousand VIs before LabVIEW can even launch (and only requires that Python be installed and not all of LabVIEW).Checks:Dependency paths are not absolute paths (this can cause long mass compile times)Version of LabVIEW the file was saved in (do you test with beta versions of LabVIEW?)Separate source code (you don't want to add the bulk of binary code to source code control, right?)Password check (you want to make sure your IP is protected)Auto Error Handling turned off (what a pain when an unexpected error comes out of an error terminal and halts you program)No breakpoints (again, production code that just halts on a breakpoint can be a big bummer)Suspend on run (you mean there is an actual flag that pauses a VI when you run it?)No debugging (speed up your production code by disabling debugging)and many more ...NoticeThis code is not endorsed, supported, or encouraged by National Instruments (NI).
This is a clean-room examiniation of LabVIEW files and using information frompylabview 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.DescriptionThis 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 while LabVIEW takes 1.8 seconds to launch and quit).
For a Pull Request build, you want to make sure your builds are as short as possible, hence, this tool.Validating VIsInstallpip3 install pylaviValidate VIsvi_validate --path lv_source --no_beta --gt 21.0This 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.You can validate the following:versiongreater than, less than, or equal to a specific version (any part of the version not specified is assumed to be zero or f (final))version phasedisallow VIs saved in developer, alpha, beta, or release version of LabVIEW.codedisallow VIs with or without theSeparate compiled code from source filesetting (--no-code means only allow VIs with separated compiled code set)breakpointsdisallow VIs with breakpoints savedlockedrequire all VIs to be locked (with or without a password) or not lockedpasswordrequire VIs to be locked with a password or not locked with a password or require the be locked with a specific passwordclear indicatorsrequire VIs be saved with theClear indiciators when calledor require they not be saved with this settingrun on openrequire VIs be saved with theRun when openedor require they not be saved with this settingsuspend on runrequire VIs be saved with theSuspend when calledor require they not be saved with this settingdebuggablerequire VIs be saved with theAllow debuggingor require they not be saved with this settingautoerrorrequire VIs have theEnable automatic error handlingflag be turned offpath lengthrequire that the path to the VI (including the--pathlength) be less than the given lengthabsolute dependency pathsrequire that all paths are relative to the VI or a known LabVIEW location (ie<vilib>)If none of these are specified, then the following settings are defaulted:--no-absolute-path--no-beta--no-alpha--no-development--no-invalid--path-length 260You may specify multiple--pathor--skip.--pathwill never override--skip.You may also specify multiple paths and associate different settings with each by passing a yaml file to--config.public api:path:-..skip:-../tests/*gt:8.0flt:23.0fno_code:trueno_beta:trueno_alpha:trueno_development:trueno_invalid:trueno_breakpoints:truepassword_match:Setec Astronomyclear_indicators:trueno_run_on_open:trueno_suspend_on_run:truenot_debuggable:trueno_absolute_path:trueautoerror:truepath_length:128test code:path:-../testsextension:-.vieq:21.0fpath_length:128Each entry in the yaml file is treated as a separate call tovi_validate.
The--verboseand--quietflags (or lack of them) on the command line override the .yaml file.
The top level is the name of the set (displayed if--verboseis passed).
Each key underneath is the--name with hyphens converted to underscores (eg--no-absolute-path->no_absolute_path).path,skip, andextensionare lists.path_lengthandpassword_matchare values.
All enable flags are set totrueto enable.pathandskippaths are relative to the directory that the config file is in.usage: vi_validate [-h] [-l LT] [-g GT] [-e EQ] [-r] [-b] [-a] [-d] [-i] [-c] [--code] [--breakpoints] [--locked] [--not-locked]
                   [--password-match PASSWORD_MATCH] [--password] [--no-password] [--clear-indicators] [--no-clear-indicators]
                   [--run-on-open] [--no-run-on-open] [--suspend-on-run] [--no-suspend-on-run] [--debuggable] [--not-debuggable]
                   [--no-absolute-path] [--autoerror] [--path-length PATH_LENGTH] [-p PATH] [-s SKIP] [-x EXTENSION] [-q] [-v]
                   [--config CONFIG]

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
  -c, --no-code         Saved without code
  --code                Saved with code
  --breakpoints         Not saved with breakpoints
  --locked              File is locked (maybe with password)
  --not-locked          File is not locked
  --password-match PASSWORD_MATCH
                        Ensure the password is exactly
  --password            File is locked with a password
  --no-password         File is not saved with a password
  --clear-indicators    VI will clear indicators on run
  --no-clear-indicators
                        VI will not clear indicators on run
  --run-on-open         VI will run when opened
  --no-run-on-open      VI will not run when opened
  --suspend-on-run      VI will suspend on run
  --no-suspend-on-run   VI will not suspend on run
  --debuggable          VI is debuggable
  --not-debuggable      VI is not debuggable
  --no-absolute-path    Does not reference links by absolute path
  --autoerror           Not saved with auto error handling turned on
  --path-length PATH_LENGTH
                        Maximum number of characters for the path
  -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)
  -v, --verbose         Increase the output (multiple times increases output more)
  --config CONFIG       Path to a .yaml file with collections of argumentsCreditsThis project was inspired bypylabview by mefistotelis(which was originally forked frompylabview by jcreigh).
The idea was to reverse engineer the LabVIEW VI file format.
Thepylaviproject is designed to be a reboot, taking the incredible discovery done by thepylabviewprojects and simplifying the structure of the code.This starts with a conceptual model of theLabVIEW resource fileand 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 bedocumented.