Releases: ni/measurement-plugin-python
Releases · ni/measurement-plugin-python
MeasurementLink Support for Python v1.4.0-dev1
What's Changed
- Beginnings of support for Pin and Relay groups (#636, #639)
- Advertise new Mux example (#642)
- Support an array of XY data plots to allow multiple plots on a (LabVIEW-only) UI (#632)
- Fix error when running the DCPower example with 1.4.0-dev0 installed (#643)
Full Changelog: 1.4.0-dev0...1.4.0-dev1
MeasurementLink Support for Python v1.4.0-dev0
What's Changed
- New APIs to allow using NI multiplexers in Python measurement services (#595, #605, #608, #610, #612, #621, #623)
- Add a new example demonstrating the multiplexer workflow (#625)
- Add a security policy to the repo (#577)
- Bug fixes (#575, #597, #631)
- Add annotation for programming language of the service (#599)
- Delete _internal/utilities submodule (#604)
Full Changelog: 1.3.0...1.4.0-dev0
MeasurementLink Support for Python v1.3.0
What's Changed
- Simplified session management (#386 #389 #402 #426 #429 #432 #433 #436 #438 #440 #442 #446 #466 #469 #480 #481 #482)
- The
MeasurementContextclass now providesreserve_session(s)methods, eliminating the need to explicitly instantiate aSessionManagementClientand passmeasurement_service.context.pin_map_contextto it. Example:with measurement_service.context.reserve_sessions(pin_names) as reservation: ...
- The
reserve_session(s)methods now accept a single pin name in addition to a list of pin names. - The reservation classes now provide
initialize_${driver}_session(s)methods for initializing modular instrument sessions. These methods are designed to be used in awithblock. They yield one or multipleSessionInformationobjects, which now contain a reference to the session object.
Example:with reservation.initialize_nidcpower_sessions() as session_infos: for session_info in session_infos: session_info.session.channels[session_info.channel_list].initiate()
- The reservation classes now provide
get_${driver}_connection(s)methods for querying connections between pins and instrument channels. These methods return one or multipleConnectionobjects, which also contain a reference to the instrument session object.
Example:vdd_connection = reservation.get_nidcpower_connection("Vdd") measurement = vdd_connection.session.channels[vdd_connection.channel_name].measure_multiple()
- The reservation classes also provide:
create_nidaqmx_task(s)andget_nidaqmx_connection(s)methods for NI-DAQmx.- Generic
initialize_session(s)andget_connection(s)methods for custom session types, such as instrument drivers based on VISA.
- The new reservation methods have type hints, which enable LSP-enabled text editors such as VS Code and PyCharm to auto-complete references to driver-specific session objects. For example,
reservation.get_nidmm_connection(pin).session.should auto-complete by displaying the methods for thenidmm.Sessionclass. To support these type hints, the new methods use generic protocol classesTypedSessionInformation[TSession]andTypedConnection[TSession]. - The
reservation.session_infoproperty now includes the session object(s) in the returnedSessionInformationobjects, if they have been created. However, clients are encouraged to use the type-safeTypedSessionInformation[TSession]objects returned fromreservation.initialize_${driver}_session(s). - TestStand code modules can also use the new
initialize_${driver}_sessionsmethods. These methods accept an optionalinitialization_behaviorenum parameter, which hasINITIALIZE_SESSION_THEN_DETACHandATTACH_TO_SESSION_THEN_CLOSEenum values designed for this use case. - The example measurements and TestStand code modules have been updated to use the new session management API. As such, most of the examples now require
ni-measurementlink-serviceversion 1.3.0 or later. For example measurements that work with previous versions, use the examples zip file provided with that release on GitHub.
- The
- Configuration via
.envfiles (#421 #425 #441)- You can now configure
ni-measurementlink-servicesettings by setting environment variables or creating a.envfile.- A
.envfile is a text file containing environment variables in the formVAR=value. - The
.envmay be located in the measurement service's current working directory or one of its parent directories. For example, you can place a.envfile at the root of this GitHub repo, in theexamples/nidcpower_source_dc_voltagedirectory, or inC:\ProgramData\National Instruments\MeasurementLinkfor configuring statically registered services. - If the current working directory and its parents do not contain a
.envfile, the search falls back to the script/EXE path (if there is one) or the path of the Python module calling intoni-measurementlink-service(to support TestStand code modules). - Support for parsing the
.envfile is implemented by the 3rd partypython-decouplepackage.
- A
- The modular instrument
initialize_${driver}_sessions(s)methods allow you to use.envsettings to override the IVI option string and specify simulation options.
Example:# Add this to your .env file to enable NI-DCPower simulation with PXIe-4141 instruments. MEASUREMENTLINK_NIDCPOWER_SIMULATE=1 MEASUREMENTLINK_NIDCPOWER_BOARD_TYPE=PXIe MEASUREMENTLINK_NIDCPOWER_MODEL=4141 - The example measurements no longer have a hardcoded
USE_SIMULATIONconstant that you must edit to enable/disable simulation. To enable simulation for all example measurements, copy.env.simulationto.envin the 'examples' directory of this Git repo. - The VISA example measurements use
python-decoupledirectly to readMEASUREMENTLINK_VISA_DMM_SIMULATEfrom the.envfile. - There are a few other
.envsettings for overriding the NI gRPC Device Server configuration and enabling feature toggles. For a complete reference, see.env.samplein the 'examples' directory of this Git repo.
- You can now configure
- Make gRPC extensions public (#545)
- The
GrpcChannelPoolclass is now provided by theni_measurementlink_service.grpc.channelpoolmodule. It is still aliased intoni_measurementlink_service.measurement.servicefor compatibility with existing code. - The
ClientLoggerandServerLoggerinterceptor classes are now provided by theni_measurementlink_service.grpc.loggersmodule.GrpcChannelPoolautomatically adds aClientLoggerandMeasurementServiceautomatically adds aServerLogger, but these helper classes may be useful to clients in other situations.
- The
- Python 3.12 support (#427)
ni-measurementlink-serviceis now tested with Python 3.12.- No code changes were required, so previous releases should work with Python 3.12 as well.
- Bug fixes
- Some cosmetic issues with example measurement UI panels have been fixed. (#420 #424 #435)
- Copying an example measurement into a separate Git repo no longer causes
ni-python-styleguideto reorder itsimportdirectives. (#374 #443) - ServerCallLogger no longer incorrectly logs OK when the call is canceled. (#370 #462)
- Fixed several APIs that leak internal types. (#375 #394 #396 #437)
- The
DiscoveryClientclass is now publicly available via theni_measurement_service.discoverysub-package. - The
DiscoveryClient.register_measurement_servicemethod has been deprecated in favor of a more generalregister_serviceAPI that supports other service types and registering multiple services. - In several public and internal classes, attributes and properties that should not be public have been deprecated and will be removed in a future release.
- Deprecated attributes, methods, and properties generate deprecation warnings, which are enabled by default for
pytesttests but not for standalone Python scripts.
- The
- In the examples and generator templates,
start.batnow assumes you are using an in-project virtualenv. (#416 #417) - The
DiscoveryClientclass now reads the MeasurementLink installation directories from the Windows registry instead of environment variables, eliminating the need to usepassenvwhen testing with Tox. (#483 ) - DeprecationWarning raised due to Pathlib.Path (#514)
- Fix deserialization of large messages (>= ~30 fields) (#554)
- Example improvements
- The VISA examples now have a
visa_dmminstrument driver rather than using VISA directly. (#439, #447) - The reservation timeout and instrument type ID parameters have been removed from the examples because the defaults are sufficient. (#393)
- Update example TestStand sequences to use the new
Update Pin Mapcustom step (#538 #539 #540 #541 #547 #551 #550 #553)- MeasurementLink 2024Q1 introduces a new TestStand step,
Update Pin Map, which sets the active pin map for the sequence execution. - The
teststand_pin_map.pycode module and related code in_helpers.pyhave been deleted. - The example TestStand sequences now require MeasurementLink 2024 Q1 or later and will not work with older versions.
- Existing TestStand sequences should continue to work with MeasurementLink 2024 Q1 or later.
- MeasurementLink 2024Q1 introduces a new TestStand step,
- Add gRPC support to VISA examples (#525)
- Remove streaming-specific examples (#536)
- Remove
sample_streaming_measurementandui_progress_updatesbecause the Game of Life example demonstrates this feature. - Add cancellation to the Game of Life example.
- Remove
- The VISA examples now have a
New Contributors
- @Avinash2Suresh made their first contribution in #439
- @renovate made their first contribution in #474
- @jayaseelan-james made their first contribution in #466
For More Details, see Version 1.3.0 Changes
Full Changelog: 1.2.0...1.3.0
MeasurementLink Support for Python v1.3.0-dev2
What's Changed
- Bug fixes
- Fix deserialization of large messages (>= ~30 fields) (#554)
- Examples
- Update example TestStand sequences to use the new
Update Pin Mapcustom step (#538 #539 #540 #541 #547 #551 #550 #553)- MeasurementLink 2024Q1 introduces a new TestStand step,
Update Pin Map, which sets the active pin map for the sequence execution. - The
teststand_pin_map.pycode module and related code in_helpers.pyhave been deleted. - The example TestStand sequences now require MeasurementLink 2024 Q1 or later and will not work with older versions.
- Existing TestStand sequences should continue to work with MeasurementLink 2024 Q1 or later.
- MeasurementLink 2024Q1 introduces a new TestStand step,
- Add gRPC support to VISA examples (#525)
- Remove streaming-specific examples (#536)
- Remove
sample_streaming_measurementandui_progress_updatesbecause the Game of Life example demonstrates this feature. - Add cancellation to the Game of Life example.
- Remove
- Update example TestStand sequences to use the new
- Configuration settings
- Rename GRPC_DEVICE_SERVER_ADDRESS and change it to a URL (#522)
- Make gRPC extensions public (#545)
- The
GrpcChannelPoolclass is now provided by theni_measurementlink_service.grpc.channelpoolmodule. It is still aliased intoni_measurementlink_service.measurement.servicefor compatibility with existing code. - The
ClientLoggerandServerLoggerinterceptor classes are now provided by theni_measurementlink_service.grpc.loggersmodule.GrpcChannelPoolautomatically adds aClientLoggerandMeasurementServiceautomatically adds aServerLogger, but these helper classes may be useful to clients in other situations.
- The
- Development workflow improvements
- The PR workflow now checks for out-of-date gRPC stubs (#546)
- Testing
- The test-specific gRPC stubs and test measurements have been moved to
tests.utilities.stubs.*andtests.utilities.measurements.*(#548)
- The test-specific gRPC stubs and test measurements have been moved to
Full Changelog: 1.3.0-dev1...1.3.0-dev2
MeasurementLink Support for Python v1.2.1-dev0
What's Changed
- Fix deserialization of large messages (>= ~30 fields) (#554)
- Enable publishing documentation to https://measurementlink-python.readthedocs.io/ (#509)
Full Changelog: 1.2.0...1.2.1-dev0
MeasurementLink Support for Python v1.3.0-dev1
What's Changed
- Bug fixes
- DeprecationWarning raised due to Pathlib.Path (#514)
- Fix incorrect type hints for some new session management APIs. Mypy doesn't catch these because the driver APIs don't have type hints yet, but it affects auto-complete.
- Documentation improvements
- Migrate documentation from GitHub pages to Read the Docs: https://measurementlink-python.readthedocs.io/ (#505 #513)
- Examples
- Tests
Full Changelog: 1.3.0-dev0...1.3.0-dev1
MeasurementLink Support for Python v1.3.0-dev0 🎃👻
What's Changed
- Simplified session management (#386 #389 #402 #426 #429 #432 #433 #436 #438 #440 #442 #446 #466 #469 #480 #481 #482)
- The
MeasurementContextclass now providesreserve_session(s)methods, eliminating the need to explicitly instantiate aSessionManagementClientand passmeasurement_service.context.pin_map_contextto it. Example:with measurement_service.context.reserve_sessions(pin_names) as reservation: ...
- The
reserve_session(s)methods now accept a single pin name in addition to a list of pin names. - The reservation classes now provide
initialize_${driver}_session(s)methods for initializing modular instrument sessions. These methods are designed to be used in awithblock. They yield one or multipleSessionInformationobjects, which now contain a reference to the session object.
Example:with reservation.initialize_nidcpower_sessions() as session_infos: for session_info in session_infos: session_info.session.channels[session_info.channel_list].initiate()
- The reservation classes now provide
get_${driver}_connection(s)methods for querying connections between pins and instrument channels. These methods return one or multipleConnectionobjects, which also contain a reference to the instrument session object.
Example:vdd_connection = reservation.get_nidcpower_connection("Vdd") measurement = vdd_connection.session.channels[vdd_connection.channel_name].measure_multiple()
- The reservation classes also provide:
create_nidaqmx_task(s)andget_nidaqmx_connection(s)methods for NI-DAQmx.- Generic
initialize_session(s)andget_connection(s)methods for custom session types, such as instrument drivers based on VISA.
- The new reservation methods have type hints, which enable LSP-enabled text editors such as VS Code and PyCharm to auto-complete references to driver-specific session objects. For example,
reservation.get_nidmm_connection(pin).session.should auto-complete by displaying the methods for thenidmm.Sessionclass. To support these type hints, the new methods use generic protocol classesTypedSessionInformation[TSession]andTypedConnection[TSession]. - The
reservation.session_infoproperty now includes the session object(s) in the returnedSessionInformationobjects, if they have been created. However, clients are encouraged to use the type-safeTypedSessionInformation[TSession]objects returned fromreservation.initialize_${driver}_session(s). - TestStand code modules can also use the new
initialize_${driver}_sessionsmethods. These methods accept an optionalinitialization_behaviorenum parameter, which hasINITIALIZE_SESSION_THEN_DETACHandATTACH_TO_SESSION_THEN_CLOSEenum values designed for this use case. - The example measurements and TestStand code modules have been updated to use the new session management API. As such, most of the examples now require
ni-measurementlink-serviceversion 1.3.0-dev0 or later. For example measurements that work with previous versions, use the examples zip file provided with that release on GitHub.
- The
- Configuration via
.envfiles (#421 #425 #441)- You can now configure
ni-measurementlink-servicesettings by setting environment variables or creating a.envfile.- A
.envfile is a text file containing environment variables in the formVAR=value. - The
.envmay be located in the measurement service's current working directory or one of its parent directories. For example, you can place a.envfile at the root of this GitHub repo, in theexamples/nidcpower_source_dc_voltagedirectory, or inC:\ProgramData\National Instruments\MeasurementLinkfor configuring statically registered services. - If the current working directory and its parents do not contain a
.envfile, the search falls back to the script/EXE path (if there is one) or the path of the Python module calling intoni-measurementlink-service(to support TestStand code modules). - Support for parsing the
.envfile is implemented by the 3rd partypython-decouplepackage.
- A
- The modular instrument
initialize_${driver}_sessions(s)methods allow you to use.envsettings to override the IVI option string and specify simulation options.
Example:# Add this to your .env file to enable NI-DCPower simulation with PXIe-4141 instruments. MEASUREMENTLINK_NIDCPOWER_SIMULATE=1 MEASUREMENTLINK_NIDCPOWER_BOARD_TYPE=PXIe MEASUREMENTLINK_NIDCPOWER_MODEL=4141 - The example measurements no longer have a hardcoded
USE_SIMULATIONconstant that you must edit to enable/disable simulation. To enable simulation for all example measurements, copy.env.simulationto.envin the root of this Git repo. - The VISA example measurements use
python-decoupledirectly to readMEASUREMENTLINK_VISA_DMM_SIMULATEfrom the.envfile. - There are a few other
.envsettings for overriding the NI gRPC Device Server configuration and enabling feature toggles. For a complete reference, see.env.samplein the root of this Git repo.
- You can now configure
- Python 3.12 support (#427)
ni-measurementlink-serviceis now tested with Python 3.12.- No code changes were required, so previous releases should work with Python 3.12 as well.
- Example improvements
- The VISA examples now have a
visa_dmminstrument driver rather than using VISA directly. (#439, #447) - The reservation timeout and instrument type ID parameters have been removed from the examples because the defaults are sufficient. (#393)
- The example TestStand code modules have been split into
teststand_pin_map.py,teststand_nidcpower.py,teststand_nidmm.pyetc. to faciliate reuse and make it easier to mix and match code modules in the same sequence. (#460 #461 #465)
- The VISA examples now have a
- Documentation improvements (#430)
- The API reference documentation now includes more accurate type information with hyperlinks.
- The API reference documentation now includes hyperlinks to the documentation for
nimi-python,nidaqmx-python, and the Python standard library.
Note These improvements will not be visible on https://ni.github.io/measurementlink-python/ until version 1.3 is officially released.
- Bug fixes
- Some cosmetic issues with example measurement UI panels have been fixed. (#420 #424 #435)
- Copying an example measurement into a separate Git repo no longer causes
ni-python-styleguideto reorder itsimportdirectives. (#374 #443) - ServerCallLogger no longer incorrectly logs OK when the call is canceled. (#370 #462)
- Fixed several APIs that leak internal types. (#375 #394 #396 #437)
- The
DiscoveryClientclass is now publicly available via theni_measurement_service.discoverysub-package. - The
DiscoveryClient.register_measurement_servicemethod has been deprecated in favor of a more generalregister_serviceAPI that supports other service types and registering multiple services. - In several public and internal classes, attributes and properties that should not be public have been deprecated and will be removed in a future release.
- Deprecated attributes, methods, and properties generate deprecation warnings, which are enabled by default for
pytesttests but not for standalone Python scripts.
- The
- In the examples and generator templates,
start.batnow assumes you are using an in-project virtualenv. (#416 #417) - The
DiscoveryClientclass now reads the MeasurementLink installation directories from the Windows registry instead of environment variables, eliminating the need to usepassenvwhen testing with Tox. (#483 )
- Development workflow improvements
- Miscellaneous minor improvements and fixes
New Contributors
- @Avinash2Suresh made their first contribution in #439
- @renovate made their first contribution in #474
- @jayaseelan-james made their first contribution in #466
Full Changelog: 1.2.0...1.3.0-dev0
MeasurementLink Support for Python v1.2.0
What's Changed
- Added support for service annotations (#291 #294 #296 #338)
- The
.serviceconfigfile now supports specifying additional information about the measurement via theannotationsdictionary. - Example:
"annotations": { "ni/service.description": "Measure inrush current with a shorted load.", "ni/service.collection": "CurrentTests.Inrush", "ni/service.tags": [ "powerup", "current" ] }ni-measurementlink-generatornow supports generating theannotationsdictionary. By default, it setsni/service.description,ni/service.collection, andni/service.tagsto empty values. You can specify values with the--description,--collection, and--tagscommand line options.
- The
- Added support for protobuf enums (#328)
- The protobuf generated code for enums does not use the Python
enummodule. Instead, it uses integers and provides a subclass of EnumTypeWrapper describing the enum value mapping. - When you use the
configurationandoutputdecorators to specify measurement parameters, you can now specify either anenum.Enumsubclass or anEnumTypeWrapperinstance forenum_type.
- The protobuf generated code for enums does not use the Python
- Support for Python services returning DoubleXYData
- Bug fixes
- Improved support for automatically launching the discovery service (#343, #344, #345, #346, #353, #391)
- Importing nidcpower.session into output voltage measurement (#399)
- Fix pywintypes error during the launch of the discovery service after a fresh install of MeasurementLink (#407)
- Update reserve_session to roll back on error (#401)
- Fixed CVE-2023-4570
- Misc improvements
- Examples
- Add
_helpers.pyfile to non-driver examples (#329) - Add
Enum outto sample_measurement (#307) - Realign DMM UI controls (#312)
- Disallow click version 8.1.4 due to an issue with type hints (#325)
- Add measurement example involving NI-DCPower and NI-VISA DMM instruments (#323)
- Update examples to centralize USE_SIMULATION in _constants.py (#348)
- Read serviceconfig path from
__file__or exe location (#355) - Remove unused TypeVar from _helpers.py (#363)
- Make enum zero translation more readable (#365)
- Configure mypy for all examples to disallow untyped function definitions (#372)
- Use a
threading.Eventfor cancellation instead of a local callback function andnonlocalvariable. - Consistently use the name
measurement_servicefor the measurement service variable.
- Add
- Minor updates and improvements not listed here
New Contributors
- @LawsonGu made their first contribution in #240
- @Tharun-Sundar made their first contribution in #249
- @vigkre made their first contribution in #254
- @gpachecoNI made their first contribution in #291
- @MounikaBattu17 made their first contribution in #340
Full Changelog: 1.1.0...1.2.0
MeasurementLink Support for Python v1.1.1
MeasurementLink Support for Python v1.2.0-dev3
What's Changed
- Bug fixes
- Fix the discovery service to not terminate on parent process closure by @samchris007 in #391
- Importing nidcpower.session into output voltage measurement (#399) by @DelpireNI in #406
- Fix pywintypes error during the launch of the discovery service after a fresh install of MeasurementLink by @samchris007 in #407
- Update reserve_session to roll back on error (#401) by @bkeryan in #409
Full Changelog: 1.2.0-dev2...1.2.0-dev3