From 7c2d26601804e6ddca23416524d935a4b09be7e3 Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Wed, 20 Nov 2024 15:01:38 +0530 Subject: [PATCH 1/7] example: rebrand proto and stubs for sample_measurement --- examples/sample_measurement/_stubs/color.proto | 2 +- examples/sample_measurement/_stubs/color_pb2.py | 6 +++--- examples/sample_measurement/_stubs/color_pb2.pyi | 1 + .../sample_measurement/_stubs/color_pb2_grpc.pyi | 13 +++++++++++++ examples/sample_measurement/pyproject.toml | 2 ++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/sample_measurement/_stubs/color.proto b/examples/sample_measurement/_stubs/color.proto index 8c2c059c1..5772e3996 100644 --- a/examples/sample_measurement/_stubs/color.proto +++ b/examples/sample_measurement/_stubs/color.proto @@ -4,7 +4,7 @@ syntax = "proto3"; //--------------------------------------------------------------------- //--------------------------------------------------------------------- -package ni.measurementlink.measurement.sample_measurement.v1; +package ni.measurementplugin.measurement.sample_measurement.v1; //--------------------------------------------------------------------- //--------------------------------------------------------------------- diff --git a/examples/sample_measurement/_stubs/color_pb2.py b/examples/sample_measurement/_stubs/color_pb2.py index dc11b2356..96082a002 100644 --- a/examples/sample_measurement/_stubs/color_pb2.py +++ b/examples/sample_measurement/_stubs/color_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x63olor.proto\x12\x34ni.measurementlink.measurement.sample_measurement.v1*9\n\rProtobufColor\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04PINK\x10\x01\x12\t\n\x05WHITE\x10\x02\x12\t\n\x05\x42LACK\x10\x03\x42\x37\xaa\x02\x34NationalInstruments.MeasurementServices.Measurementsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x63olor.proto\x12\x36ni.measurementplugin.measurement.sample_measurement.v1*9\n\rProtobufColor\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04PINK\x10\x01\x12\t\n\x05WHITE\x10\x02\x12\t\n\x05\x42LACK\x10\x03\x42\x37\xaa\x02\x34NationalInstruments.MeasurementServices.Measurementsb\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'color_pb2', globals()) @@ -21,6 +21,6 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\252\0024NationalInstruments.MeasurementServices.Measurements' - _PROTOBUFCOLOR._serialized_start=69 - _PROTOBUFCOLOR._serialized_end=126 + _PROTOBUFCOLOR._serialized_start=71 + _PROTOBUFCOLOR._serialized_end=128 # @@protoc_insertion_point(module_scope) diff --git a/examples/sample_measurement/_stubs/color_pb2.pyi b/examples/sample_measurement/_stubs/color_pb2.pyi index d3b807593..02093e37c 100644 --- a/examples/sample_measurement/_stubs/color_pb2.pyi +++ b/examples/sample_measurement/_stubs/color_pb2.pyi @@ -4,6 +4,7 @@ isort:skip_file --------------------------------------------------------------------- --------------------------------------------------------------------- """ + import builtins import google.protobuf.descriptor import google.protobuf.internal.enum_type_wrapper diff --git a/examples/sample_measurement/_stubs/color_pb2_grpc.pyi b/examples/sample_measurement/_stubs/color_pb2_grpc.pyi index f99de6c86..8a5eee48d 100644 --- a/examples/sample_measurement/_stubs/color_pb2_grpc.pyi +++ b/examples/sample_measurement/_stubs/color_pb2_grpc.pyi @@ -4,3 +4,16 @@ isort:skip_file --------------------------------------------------------------------- --------------------------------------------------------------------- """ + +import abc +import collections.abc +import grpc +import grpc.aio +import typing + +_T = typing.TypeVar("_T") + +class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta): ... + +class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore[misc, type-arg] + ... diff --git a/examples/sample_measurement/pyproject.toml b/examples/sample_measurement/pyproject.toml index 248295a88..9d367c200 100644 --- a/examples/sample_measurement/pyproject.toml +++ b/examples/sample_measurement/pyproject.toml @@ -14,6 +14,8 @@ click = ">=7.1.2, !=8.1.4" # mypy fails with click 8.1.4: https://github.com/pal ni-python-styleguide = ">=0.4.1" mypy = ">=1.0" grpc-stubs = "^1.53" +grpcio-tools = "1.49.1" +mypy-protobuf = "^3.6.0" types-protobuf = "^4.21" # Uncomment to use prerelease dependencies. # ni-measurement-plugin-sdk-service = {path = "../../packages/service", develop = true} From 73a1108ea224325398a6cf77e964e34e03ee635c Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Wed, 20 Nov 2024 15:13:10 +0530 Subject: [PATCH 2/7] example: rebrand sample and simulation .env files --- examples/.env.sample | 4 ++-- examples/.env.simulation | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/.env.sample b/examples/.env.sample index 60e3be2a6..539ba0ce7 100644 --- a/examples/.env.sample +++ b/examples/.env.sample @@ -3,7 +3,7 @@ # To use it: # - Copy this file to your service's directory or one of its parent directories # (such as the root of your Git repository or `C:\ProgramData\National -# Instruments\MeasurementLink\Services` for statically registered measurement services). +# Instruments\Plug-Ins\Measurements` for statically registered measurement services). # - Rename it to `.env`. # - Uncomment and edit the options you want to change. # - Restart any affected services. @@ -58,7 +58,7 @@ # NI gRPC Device Server Configuration #---------------------------------------------------------------------- -# By default, measurement services use the MeasurementLink discovery service to +# By default, measurement services use the NI Discovery Service to # activate the NI gRPC Device Server. You probably don't want to change this, # but if you do, you can uncomment the following options to override this # behavior: diff --git a/examples/.env.simulation b/examples/.env.simulation index 989e438d6..9fadc2eb2 100644 --- a/examples/.env.simulation +++ b/examples/.env.simulation @@ -5,9 +5,9 @@ # To use it: # - Copy this file to your service's directory or one of its parent directories # (such as the root of your Git repository or `C:\ProgramData\National -# Instruments\MeasurementLink\Services` for statically registered measurement services). +# Instruments\Plug-Ins\Measurements` for statically registered measurement services). # - Rename it to `.env`. -# - Uncomment and edit the options you want to change. +# - Comment out or edit the options you want to change. # - Restart any affected services. MEASUREMENT_PLUGIN_NIDCPOWER_SIMULATE=1 From a94ce86dc2d0eb7cb51940e36866c1fcc4d6b35c Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Wed, 20 Nov 2024 15:20:08 +0530 Subject: [PATCH 3/7] github: rebrand the bug report and PR template files --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 993ff022a..c5d242f41 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -45,5 +45,5 @@ Search open/closed issues before submitting. Someone may have reported the same * OS & Device: [e.g. macOS, Windows, Linux] on [Mac, PC] * `ni-measurement-plugin-sdk-service` version [e.g. 2.0.0] -* MeasurementLink version [e.g. 23.0.0d123] +* InstrumentStudio version [e.g. 24.8.0d123] * Python version [e.g. 3.9] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1081b5ea7..223dc633d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,5 @@ -- [ ] This contribution adheres to [CONTRIBUTING.md](https://github.com/ni/measurement-services-python/blob/main/CONTRIBUTING.md). - -TODO: Check the above box with an 'x' indicating you've read and followed [CONTRIBUTING.md](https://github.com/ni/measurement-services-python/blob/main/CONTRIBUTING.md). + +- [ ] This contribution adheres to [CONTRIBUTING.md](https://github.com/ni/measurement-plugin-python/blob/main/CONTRIBUTING.md). ### What does this Pull Request accomplish? From 9070da23a3ca00fbf244701e8b96885c05a7e630 Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Wed, 20 Nov 2024 15:20:40 +0530 Subject: [PATCH 4/7] readme: remove unnecessary trailing spaces --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 856b04d01..ee4e7f4dc 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ Run the `ni-measurement-plugin-client-generator` tool. - `--module-name` and `--class-name` define the module and class names of the generated client. If not specified, they are derived from the measurement service class name. - `--directory-out` specifies the output directory for the generated files. If not specified, files are placed in the current directory. - + > **Note**: When generating multiple measurement clients, `--module-name` and `--class-name` are ignored and derived from the service class of each measurement. So, ensure that the measurement service class name adheres to proper naming conventions. 2. To create measurement clients for all registered measurements, use this command: From 01d2004696fec0edcbe5d57e67def7e66f0b1484 Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Wed, 20 Nov 2024 15:34:27 +0530 Subject: [PATCH 5/7] toml: update the repository link in the package pyproject files --- packages/generator/pyproject.toml | 2 +- packages/sdk/pyproject.toml | 2 +- packages/service/pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/generator/pyproject.toml b/packages/generator/pyproject.toml index d7428c89e..707fb1107 100644 --- a/packages/generator/pyproject.toml +++ b/packages/generator/pyproject.toml @@ -4,7 +4,7 @@ version = "2.2.0-dev0" description = "Measurement Plug-In Code Generator for Python" authors = ["NI "] readme = "README.md" -repository = "https://github.com/ni/measurementlink-python/" +repository = "https://github.com/ni/measurement-plugin-python/" license = "MIT" classifiers = [ "Development Status :: 5 - Production/Stable", diff --git a/packages/sdk/pyproject.toml b/packages/sdk/pyproject.toml index fb01712e8..32c9f3772 100644 --- a/packages/sdk/pyproject.toml +++ b/packages/sdk/pyproject.toml @@ -4,7 +4,7 @@ version = "2.2.0-dev0" description = "Measurement Plug-In SDK for Python" authors = ["NI "] readme = "README.md" -repository = "https://github.com/ni/measurementlink-python/" +repository = "https://github.com/ni/measurement-plugin-python/" license = "MIT" classifiers = [ "Development Status :: 5 - Production/Stable", diff --git a/packages/service/pyproject.toml b/packages/service/pyproject.toml index 5b781b3d2..5e664c77e 100644 --- a/packages/service/pyproject.toml +++ b/packages/service/pyproject.toml @@ -11,7 +11,7 @@ version = "2.2.0-dev0" description = "Measurement Plug-In Support for Python" authors = ["NI "] readme = "README.md" # apply the repo readme to the package as well -repository = "https://github.com/ni/measurementlink-python/" +repository = "https://github.com/ni/measurement-plugin-python/" license = "MIT" classifiers = [ "Development Status :: 5 - Production/Stable", From c8789dba91af3674eb3b3e1cf275e679bc87d9af Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Wed, 20 Nov 2024 15:57:30 +0530 Subject: [PATCH 6/7] nimg: rebrand the .measproj & .measui template files --- .../templates/measurement.measproj.mako | 32 ++++++++++---- .../plugin/templates/measurement.measui.mako | 44 ++++++++----------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measproj.mako b/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measproj.mako index 1a666f0de..e27bb15d1 100644 --- a/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measproj.mako +++ b/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measproj.mako @@ -1,20 +1,36 @@ <%page args="ui_file"/>\ \ - + - - - + + + + + + - - + + - + - + + + + + + + + + + + + + + diff --git a/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measui.mako b/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measui.mako index 9685531ab..fdbb3b725 100644 --- a/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measui.mako +++ b/packages/generator/ni_measurement_plugin_sdk_generator/plugin/templates/measurement.measui.mako @@ -1,33 +1,27 @@ <%page args="display_name, service_class"/>\ \ - + - - - - - - + + + + + + - - - - - 0x0 - - - - \ No newline at end of file From 90804dfc78fe6a240a8a9826ff240904a015917e Mon Sep 17 00:00:00 2001 From: Jayaseelan James Date: Thu, 21 Nov 2024 12:32:35 +0530 Subject: [PATCH 7/7] refactor: update the package name in color.proto --- examples/sample_measurement/_stubs/color.proto | 2 +- examples/sample_measurement/_stubs/color_pb2.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/sample_measurement/_stubs/color.proto b/examples/sample_measurement/_stubs/color.proto index 5772e3996..e38ddb09f 100644 --- a/examples/sample_measurement/_stubs/color.proto +++ b/examples/sample_measurement/_stubs/color.proto @@ -4,7 +4,7 @@ syntax = "proto3"; //--------------------------------------------------------------------- //--------------------------------------------------------------------- -package ni.measurementplugin.measurement.sample_measurement.v1; +package ni.examples; //--------------------------------------------------------------------- //--------------------------------------------------------------------- diff --git a/examples/sample_measurement/_stubs/color_pb2.py b/examples/sample_measurement/_stubs/color_pb2.py index 96082a002..594cc15d3 100644 --- a/examples/sample_measurement/_stubs/color_pb2.py +++ b/examples/sample_measurement/_stubs/color_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x63olor.proto\x12\x36ni.measurementplugin.measurement.sample_measurement.v1*9\n\rProtobufColor\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04PINK\x10\x01\x12\t\n\x05WHITE\x10\x02\x12\t\n\x05\x42LACK\x10\x03\x42\x37\xaa\x02\x34NationalInstruments.MeasurementServices.Measurementsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x63olor.proto\x12\x0bni.examples*9\n\rProtobufColor\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04PINK\x10\x01\x12\t\n\x05WHITE\x10\x02\x12\t\n\x05\x42LACK\x10\x03\x42\x37\xaa\x02\x34NationalInstruments.MeasurementServices.Measurementsb\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'color_pb2', globals()) @@ -21,6 +21,6 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\252\0024NationalInstruments.MeasurementServices.Measurements' - _PROTOBUFCOLOR._serialized_start=71 - _PROTOBUFCOLOR._serialized_end=128 + _PROTOBUFCOLOR._serialized_start=28 + _PROTOBUFCOLOR._serialized_end=85 # @@protoc_insertion_point(module_scope)