From 6fbcd4ad1e306452f2738e6288c2a7e11fb1f94c Mon Sep 17 00:00:00 2001 From: Simone Orru Date: Wed, 28 Aug 2024 09:22:20 +0200 Subject: [PATCH 1/2] Update grpc plugin Signed-off-by: Simone Orru --- .github/workflows/python-code-generation.yaml | 4 +- .../astarteplatform/msghub/config_pb2_grpc.py | 19 +++- .../msghub/message_hub_service_pb2_grpc.py | 91 +++++++++++++++---- scripts/python_codegen.sh | 2 +- 4 files changed, 89 insertions(+), 27 deletions(-) diff --git a/.github/workflows/python-code-generation.yaml b/.github/workflows/python-code-generation.yaml index d4be0be..fed8aff 100644 --- a/.github/workflows/python-code-generation.yaml +++ b/.github/workflows/python-code-generation.yaml @@ -45,11 +45,11 @@ jobs: uses: actions/cache/restore@v4 with: path: ./grpc/grpc_python_plugin - key: grpc-python-plugin-v1.58.1 + key: grpc-python-plugin-v1.66.1 - name: Compile from source the grpc_python_plugin if: steps.cache-grpc-python-plugin-restore.outputs.cache-hit != 'true' run: | - git clone -b v1.58.1 https://github.com/grpc/grpc + git clone -b v1.66.1 https://github.com/grpc/grpc cd grpc git submodule update --init cmake . diff --git a/python/astarteplatform/msghub/config_pb2_grpc.py b/python/astarteplatform/msghub/config_pb2_grpc.py index 8adbc32..77f1133 100644 --- a/python/astarteplatform/msghub/config_pb2_grpc.py +++ b/python/astarteplatform/msghub/config_pb2_grpc.py @@ -19,7 +19,7 @@ def __init__(self, channel): '/astarteplatform.msghub.MessageHubConfig/SetConfig', request_serializer=astarteplatform_dot_msghub_dot_config__pb2.ConfigMessage.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) class MessageHubConfigServicer(object): @@ -44,6 +44,7 @@ def add_MessageHubConfigServicer_to_server(servicer, server): generic_handler = grpc.method_handlers_generic_handler( 'astarteplatform.msghub.MessageHubConfig', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('astarteplatform.msghub.MessageHubConfig', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. @@ -61,8 +62,18 @@ def SetConfig(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHubConfig/SetConfig', + return grpc.experimental.unary_unary( + request, + target, + '/astarteplatform.msghub.MessageHubConfig/SetConfig', astarteplatform_dot_msghub_dot_config__pb2.ConfigMessage.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/python/astarteplatform/msghub/message_hub_service_pb2_grpc.py b/python/astarteplatform/msghub/message_hub_service_pb2_grpc.py index 51b4b3b..b0afc90 100644 --- a/python/astarteplatform/msghub/message_hub_service_pb2_grpc.py +++ b/python/astarteplatform/msghub/message_hub_service_pb2_grpc.py @@ -21,27 +21,27 @@ def __init__(self, channel): '/astarteplatform.msghub.MessageHub/Attach', request_serializer=astarteplatform_dot_msghub_dot_node__pb2.Node.SerializeToString, response_deserializer=astarteplatform_dot_msghub_dot_astarte__message__pb2.MessageHubEvent.FromString, - ) + _registered_method=True) self.Send = channel.unary_unary( '/astarteplatform.msghub.MessageHub/Send', request_serializer=astarteplatform_dot_msghub_dot_astarte__message__pb2.AstarteMessage.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) self.Detach = channel.unary_unary( '/astarteplatform.msghub.MessageHub/Detach', request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) self.AddInterfaces = channel.unary_unary( '/astarteplatform.msghub.MessageHub/AddInterfaces', request_serializer=astarteplatform_dot_msghub_dot_interface__pb2.InterfacesJson.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) self.RemoveInterfaces = channel.unary_unary( '/astarteplatform.msghub.MessageHub/RemoveInterfaces', request_serializer=astarteplatform_dot_msghub_dot_interface__pb2.InterfacesName.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) class MessageHubServicer(object): @@ -115,6 +115,7 @@ def add_MessageHubServicer_to_server(servicer, server): generic_handler = grpc.method_handlers_generic_handler( 'astarteplatform.msghub.MessageHub', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('astarteplatform.msghub.MessageHub', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. @@ -132,11 +133,21 @@ def Attach(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/astarteplatform.msghub.MessageHub/Attach', + return grpc.experimental.unary_stream( + request, + target, + '/astarteplatform.msghub.MessageHub/Attach', astarteplatform_dot_msghub_dot_node__pb2.Node.SerializeToString, astarteplatform_dot_msghub_dot_astarte__message__pb2.MessageHubEvent.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Send(request, @@ -149,11 +160,21 @@ def Send(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/Send', + return grpc.experimental.unary_unary( + request, + target, + '/astarteplatform.msghub.MessageHub/Send', astarteplatform_dot_msghub_dot_astarte__message__pb2.AstarteMessage.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Detach(request, @@ -166,11 +187,21 @@ def Detach(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/Detach', + return grpc.experimental.unary_unary( + request, + target, + '/astarteplatform.msghub.MessageHub/Detach', google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def AddInterfaces(request, @@ -183,11 +214,21 @@ def AddInterfaces(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/AddInterfaces', + return grpc.experimental.unary_unary( + request, + target, + '/astarteplatform.msghub.MessageHub/AddInterfaces', astarteplatform_dot_msghub_dot_interface__pb2.InterfacesJson.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def RemoveInterfaces(request, @@ -200,8 +241,18 @@ def RemoveInterfaces(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/RemoveInterfaces', + return grpc.experimental.unary_unary( + request, + target, + '/astarteplatform.msghub.MessageHub/RemoveInterfaces', astarteplatform_dot_msghub_dot_interface__pb2.InterfacesName.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/scripts/python_codegen.sh b/scripts/python_codegen.sh index d7eb35b..474a88a 100755 --- a/scripts/python_codegen.sh +++ b/scripts/python_codegen.sh @@ -18,7 +18,7 @@ codegen () { if [ ! -d "$DL_DIR/grpc" ]; then cd "$DL_DIR" - git clone -b v1.58.1 https://github.com/grpc/grpc + git clone -b v1.66.1 https://github.com/grpc/grpc cd grpc git submodule update --init fi From 956a5211639970a5f8c6f3191a031b487c759d83 Mon Sep 17 00:00:00 2001 From: rgallor Date: Thu, 30 May 2024 15:28:32 +0200 Subject: [PATCH 2/2] Prepare release 0.7 Signed-off-by: rgallor Signed-off-by: Riccardo Gallo --- CHANGELOG.md | 16 ++++++++++------ python/pyproject.toml | 2 +- rust/Cargo.lock | 2 +- rust/astarte-message-hub-proto/Cargo.toml | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a4b81e..a0c3ea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,19 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.7.0] - 2024-09-02 ### Added -- Dynamic introspection API. -- Add `grpc_socket_host` optional field to the `ConfigMessage` to configure the server IP to bind. +- Dynamic introspection API. [#46](https://github.com/astarte-platform/astarte-message-hub-proto/pull/46) +- Add `grpc_socket_host` optional field to the `ConfigMessage` to configure the server IP to bind. [#57] ### Changed -- Send Empty parameter instead of Node in the detach rpc. +- Send Empty parameter instead of Node in the Detach rpc. [#54](https://github.com/astarte-platform/astarte-message-hub-proto/pull/54) - Make the `grpc_socket_port` field optional for the `ConfigMessage`, the default port will be - `50051` on the server. -- The Attach rpc now returns a `MessageHubEvent`, which can either be an error or an Astarte message. + `50051` on the server. [#57] +- The Attach rpc now returns a `MessageHubEvent`, which can either be an error or an Astarte message. [#56](https://github.com/astarte-platform/astarte-message-hub-proto/pull/56) +- The information about the Node sent in an Attach rpc now contains only the node introspection, since + the Node ID is sent inside the rpc metadata. [#58](https://github.com/astarte-platform/astarte-message-hub-proto/pull/58) + +[#57]: https://github.com/astarte-platform/astarte-message-hub-proto/pull/57 ## [0.6.2] - 2024-04-23 diff --git a/python/pyproject.toml b/python/pyproject.toml index df4cd98..a2bf504 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -23,7 +23,7 @@ build-backend = "setuptools.build_meta" [project] name = "astarte_message_hub_proto" description="Astarte message hub protocol buffers for Python" -version = "0.6.2" +version = "0.7.0" authors = [ { name = "Simone Orru", email = "simone.orru@secomind.com" } ] diff --git a/rust/Cargo.lock b/rust/Cargo.lock index fd45e75..500f597 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -127,7 +127,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "astarte-message-hub-proto" -version = "0.6.2" +version = "0.7.0" dependencies = [ "chrono", "clap", diff --git a/rust/astarte-message-hub-proto/Cargo.toml b/rust/astarte-message-hub-proto/Cargo.toml index bf77b6f..de98d5d 100644 --- a/rust/astarte-message-hub-proto/Cargo.toml +++ b/rust/astarte-message-hub-proto/Cargo.toml @@ -6,7 +6,7 @@ [package] name = "astarte-message-hub-proto" -version = "0.6.2" +version = "0.7.0" documentation = "https://docs.rs/astarte-message-hub-proto" edition = { workspace = true } homepage = "https://astarte.cloud/"