Skip to content

Commit d7f1ead

Browse files
Update Static Type Checking Changelog for Kilted rclpy (#5368) (#5371)
(cherry picked from commit 24d245c) Signed-off-by: Michael Carlstrom <[email protected]> Co-authored-by: Michael Carlstrom <[email protected]>
1 parent 8e2f512 commit d7f1ead

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

source/Releases/Release-Kilted-Kaiju.rst

+36-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,42 @@ See https://github.com/ros2/rclcpp/pull/2759 for more details.
9393
Static Type Checking
9494
""""""""""""""""""""
9595

96-
Static type checking improvements to ensure that user application is using variables and functions correctly.
96+
Added static type hints to ``ActionClient`` and ``ActionServer``.
97+
98+
See https://github.com/ros2/rclpy/pull/1349 for more details.
99+
100+
Add support for `generics <https://typing.python.org/en/latest/reference/generics.html>`_ in ``pub/sub/client/server/actions``, ``Future/Task``, and ``Parameter``.
101+
102+
``Publisher``, ``Subscription``, ``Server``, ``Task``, and ``Parameter`` should need no updates to add support for generics.
103+
104+
``Client`` will need to be updated to resemble the following to get the improved type checking.
105+
106+
.. code-block:: python
107+
108+
self._get_parameter_client: Client[GetParameters.Request,
109+
GetParameters.Response] = self.node.create_client(
110+
GetParameters, '/get_parameters',
111+
qos_profile=qos_profile, callback_group=callback_group)
112+
113+
``ActionClient`` will need to be updated to resemble the following to get the improved type checking.
114+
115+
.. code-block:: python
116+
117+
ac: ActionClient[Fibonacci.Goal,
118+
Fibonacci.Result,
119+
Fibonacci.Feedback] = ActionClient(self.node, Fibonacci, 'fibonacci')
120+
121+
``Future`` will need to be updated to resemble the following to get the improved type checking.
122+
123+
.. code-block:: python
124+
125+
log_msgs_future: Future[bool] = Future()
126+
127+
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.
128+
129+
Various other small improvements and corrections have also been made throughout all of ``rclpy``.
130+
131+
Python types can be statically checked using `ament_mypy <https://github.com/ament/ament_lint/tree/kilted/ament_mypy>`_ which wraps `mypy <https://www.mypy-lang.org/>`_.
97132

98133
EventsExecutor
99134
""""""""""""""

0 commit comments

Comments
 (0)