Skip to content

CLI tool designed for packaging Python measurement plug-ins and publishing the resulting packages to SystemLink feeds.

License

Notifications You must be signed in to change notification settings

ni/measurement-plugin-packager-python

Repository files navigation

Measurement Plug-In Packager for Python

Introduction

The Measurement Plug-In Packager enables users to build Python measurement plug-ins as NI package files (.nipkg) and upload them to SystemLink feeds. This tool streamlines the process of building and distributing measurement plug-ins efficiently.

Dependencies

Installation

  1. Download the required wheel files from the latest release:

    • ni_measurement_plugin_packager-X.X.X-py3-none-any.whl
    • nisystemlink_feeds_manager-X.X.X-py3-none-any.whl
  2. Use the following command to install:

    pip install <path_to_ni_measurement_plugin_packager-X.X.X-py3-none-any.whl> <path_to_nisystemlink_feeds_manager-X.X.X-py3-none-any.whl>

Usage

1. Packaging a Single Measurement Plug-in

The following command takes in --input-path specifying the measurement plug-in directory path to build the .nipkg file. The package is created at <Public Documents>\NI-Measurement-Plugin-Packager\packages.

The package is named in this format: {plugin_folder_name}_{version}_windows_x64.nipkg. Example: sample_measurement_0.5.0_windows_x64.nipkg where the version is picked from the respective measurement plug-in's measurement.py file.

ni-measurement-plugin-packager --input-path "<measurement_plugin_directory>"

Example:

ni-measurement-plugin-packager --input-path "C:/Users/examples/sample_measurement"

Note:

If the Public Documents directory is inaccessible, the tool defaults to the "Documents" directory. In this location, .nipkg files are saved in the \packages folder, log files are saved in the \Logs folder and the packaged measurement plug-in folder is copied to the \{plugin_folder_name} subdirectory.

2. Packaging Multiple Measurement Plug-ins

You can package multiple measurement plug-ins from a parent directory by specifying the respective plug-in(s) directory name. Use the following command with --base-input-dir, and --plugin-dir-name to build .nipkg packages for the specified measurement plug-in(s) from the base directory.

ni-measurement-plugin-packager --base-input-dir "<measurement_plugin_base_directory>" --plugin-dir-name "<plugin1,plugin2>"

Example:

ni-measurement-plugin-packager --base-input-dir "C:/Users/examples" --plugin-dir-name "sample_measurement,test_measurement"

3. Packaging and Publishing the Measurement Plug-in

Prerequisites:

To publish measurement plug-in packages directly to the SystemLink, in addition to the measurement plug-in directory path, you must provide the following values,

  • SystemLink API URL (--api-url)
  • API Key (--api-key)
    • Please refer here for creating an API Key.
  • Workspace name (--workspace)
  • Feed name (--feed-name)
ni-measurement-plugin-packager --input-path "<measurement_plugin_directory>" --upload-packages --api-url "<systemlink_api_url>" --api-key "<api_key>" --workspace "<workspace_name>" --feed-name "<feed_name>"

Example:

ni-measurement-plugin-packager --input-path "C:\Users\examples\sample_measurement" --upload-packages --api-url "https://api.example.com/" --api-key "123abc" --workspace "your-workspace" --feed-name "your-feed-name"

Similarly, to publish multiple measurement plug-ins, replace --input-path with --base-input-dir and specify --plugin-dir-name as shown below.

ni-measurement-plugin-packager --base-input-dir "C:/Users/examples" --plugin-dir-name "sample_measurement,test_measurement" --upload-packages --api-url "https://api.example.com/" --api-key "123abc" --workspace "your-workspace" --feed-name "your-feed-name"

Note:

  • Use -o or --overwrite to replace an existing package in SystemLink feeds.
  • The tool doesn't publish any existing packages. Only packages built during the current packaging process can be published.

Notes

File Exclusions

The following files and directories are ignored while packaging:

  • .venv
  • __pycache__
  • .cache
  • dist
  • .vscode
  • .vs
  • .env
  • poetry.lock
  • .mypy_cache
  • .pytest_cache
  • coverage.xml

Additional Resources

About

CLI tool designed for packaging Python measurement plug-ins and publishing the resulting packages to SystemLink feeds.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages