From 0ef7d089e50f7f8c355def0682c928dd0bce6dcc Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Fri, 25 Apr 2025 16:56:42 -0400 Subject: [PATCH 1/3] write rclpy typing changelog Signed-off-by: Michael Carlstrom --- source/Releases/Release-Kilted-Kaiju.rst | 35 +++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/source/Releases/Release-Kilted-Kaiju.rst b/source/Releases/Release-Kilted-Kaiju.rst index 61e8583afc..052e7b4b83 100644 --- a/source/Releases/Release-Kilted-Kaiju.rst +++ b/source/Releases/Release-Kilted-Kaiju.rst @@ -93,7 +93,40 @@ See https://github.com/ros2/rclcpp/pull/2759 for more details. Static Type Checking """""""""""""""""""" -Static type checking improvements to ensure that user application is using variables and functions correctly. +Added static type hints to `ActionClient` and `ActionServer`, + +See https://github.com/ros2/rclpy/pull/1349 for more details. + +Add support for generics in `pub/sub/client/server/actions`, `Future/Task`, and `Parameter`. + +`Publisher`, `Subscription`, `Server`, `Task`, and `Parameter` should need no updates to add support for generics. + +`Client` will need to be updated to resemble the following to get the improved type checking. + +.. code-block:: python + + self._get_parameter_client: Client[GetParameters.Request, + GetParameters.Response] = self.node.create_client( + GetParameters, '/get_parameters', + qos_profile=qos_profile, callback_group=callback_group) + +`ActionClient` will need to be updated to resemble the following to get the improved type checking. + +.. code-block:: python + + ac: ActionClient[Fibonacci.Goal, + Fibonacci.Result, + Fibonacci.Feedback] = ActionClient(self.node, Fibonacci, 'fibonacci') + +`Future` will need to be updated to resemble the following to get the improved type checking. + +.. code-block:: python + + log_msgs_future: Future[bool] = Future() + +See https://github.com/ros2/rclpy/pull/1239, https://github.com/ros2/rclpy/pull/1275, https://github.com/ros2/rclpy/pull/1246, and https://github.com/ros2/rclpy/pull/1254/files for more details. + +Various other small improvements and corrections have also been made throughout all of `rclpy`. EventsExecutor """""""""""""" From 94603ad9b73151939d8d01b2cf63707f10a1ba25 Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Fri, 25 Apr 2025 16:57:49 -0400 Subject: [PATCH 2/3] Fix comma Signed-off-by: Michael Carlstrom --- source/Releases/Release-Kilted-Kaiju.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Releases/Release-Kilted-Kaiju.rst b/source/Releases/Release-Kilted-Kaiju.rst index 052e7b4b83..88eca04f33 100644 --- a/source/Releases/Release-Kilted-Kaiju.rst +++ b/source/Releases/Release-Kilted-Kaiju.rst @@ -93,7 +93,7 @@ See https://github.com/ros2/rclcpp/pull/2759 for more details. Static Type Checking """""""""""""""""""" -Added static type hints to `ActionClient` and `ActionServer`, +Added static type hints to `ActionClient` and `ActionServer`. See https://github.com/ros2/rclpy/pull/1349 for more details. From 03ed93ed7e2a87cfdbb2690f44a4d6a4d05c6f4b Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Fri, 25 Apr 2025 18:01:25 -0400 Subject: [PATCH 3/3] Adress comments Signed-off-by: Michael Carlstrom --- source/Releases/Release-Kilted-Kaiju.rst | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/source/Releases/Release-Kilted-Kaiju.rst b/source/Releases/Release-Kilted-Kaiju.rst index 88eca04f33..a39d5280b0 100644 --- a/source/Releases/Release-Kilted-Kaiju.rst +++ b/source/Releases/Release-Kilted-Kaiju.rst @@ -93,24 +93,24 @@ See https://github.com/ros2/rclcpp/pull/2759 for more details. Static Type Checking """""""""""""""""""" -Added static type hints to `ActionClient` and `ActionServer`. +Added static type hints to ``ActionClient`` and ``ActionServer``. See https://github.com/ros2/rclpy/pull/1349 for more details. -Add support for generics in `pub/sub/client/server/actions`, `Future/Task`, and `Parameter`. +Add support for `generics `_ in ``pub/sub/client/server/actions``, ``Future/Task``, and ``Parameter``. -`Publisher`, `Subscription`, `Server`, `Task`, and `Parameter` should need no updates to add support for generics. +``Publisher``, ``Subscription``, ``Server``, ``Task``, and ``Parameter`` should need no updates to add support for generics. -`Client` will need to be updated to resemble the following to get the improved type checking. +``Client`` will need to be updated to resemble the following to get the improved type checking. .. code-block:: python - self._get_parameter_client: Client[GetParameters.Request, - GetParameters.Response] = self.node.create_client( + self._get_parameter_client: Client[GetParameters.Request, + GetParameters.Response] = self.node.create_client( GetParameters, '/get_parameters', qos_profile=qos_profile, callback_group=callback_group) -`ActionClient` will need to be updated to resemble the following to get the improved type checking. +``ActionClient`` will need to be updated to resemble the following to get the improved type checking. .. code-block:: python @@ -118,7 +118,7 @@ Add support for generics in `pub/sub/client/server/actions`, `Future/Task`, and Fibonacci.Result, Fibonacci.Feedback] = ActionClient(self.node, Fibonacci, 'fibonacci') -`Future` will need to be updated to resemble the following to get the improved type checking. +``Future`` will need to be updated to resemble the following to get the improved type checking. .. code-block:: python @@ -126,7 +126,9 @@ Add support for generics in `pub/sub/client/server/actions`, `Future/Task`, and See https://github.com/ros2/rclpy/pull/1239, https://github.com/ros2/rclpy/pull/1275, https://github.com/ros2/rclpy/pull/1246, and https://github.com/ros2/rclpy/pull/1254/files for more details. -Various other small improvements and corrections have also been made throughout all of `rclpy`. +Various other small improvements and corrections have also been made throughout all of ``rclpy``. + +Python types can be statically checked using `ament_mypy `_ which wraps `mypy `_. EventsExecutor """"""""""""""