Skip to content

Static typing for Message, Services, and Actions #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 84 commits into
base: rolling
Choose a base branch
from

Conversation

InvincibleRMC
Copy link
Contributor

@InvincibleRMC InvincibleRMC commented Mar 15, 2024

Adds static typing to generated messages. Closes #157.

Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@InvincibleRMC InvincibleRMC marked this pull request as draft March 15, 2024 07:12
@InvincibleRMC
Copy link
Contributor Author

Still need to fix a circular import issue.

Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@InvincibleRMC InvincibleRMC marked this pull request as ready for review March 15, 2024 16:35
InvincibleRMC and others added 18 commits March 15, 2024 13:36
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@InvincibleRMC
Copy link
Contributor Author

Now that kilted is starting to wrap up friendly ping @sloretz to re-review when you get a chance.

@InvincibleRMC
Copy link
Contributor Author

Friendly ping @sloretz to finish the review when you get a chance.

Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@ros-discourse
Copy link

This pull request has been mentioned on Open Robotics Discourse. There might be relevant details there:

https://discourse.ros.org/t/python-generated-messages-with-static-type-hints/45156/1

Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@InvincibleRMC
Copy link
Contributor Author

InvincibleRMC commented Jul 19, 2025

@benjaminwp18 Thanks so much for the review! I have addressed your feedback. Please let me know if you have any other feedback.

Signed-off-by: Michael Carlstrom <[email protected]>
@InvincibleRMC
Copy link
Contributor Author

@christophebedard when you get a chance I would appreciate a ROS Maintainer review as well.

Signed-off-by: Michael Carlstrom <[email protected]>
InvincibleRMC and others added 3 commits July 22, 2025 15:04
…ces.cmake

Co-authored-by: Christophe Bedard <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Co-authored-by: Christophe Bedard <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@christophebedard
Copy link
Member

Pulls: #206
Gist: https://gist.githubusercontent.com/christophebedard/9a392164fa167b98f745f9a505a40a73/raw/1cb2fe9a7ed734bbd4a459211613e40209a97991/ros2.repos
BUILD args:
TEST args:
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/16562

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@christophebedard
Copy link
Member

I ran full CI^ so that interfaces get generated, and so that hopefully the linters (including mypy) run on the generated files as part of tests in the various interface packages. The Rpr job doesn't really test much here.

@InvincibleRMC
Copy link
Contributor Author

Thanks so much for the review!

I ran full CI^ so that interfaces get generated, and so that hopefully the linters (including mypy) run on the generated files as part of tests in the various interface packages. The Rpr job doesn't really test much here.

I was going to ask about this since I have a feeling this will expose some downstream bugs to be fixed.

Signed-off-by: Michael Carlstrom <[email protected]>
@christophebedard
Copy link
Member

Pulls: #206
Gist: https://gist.githubusercontent.com/christophebedard/23340b5f0c0b1e577396c407ded46165/raw/1cb2fe9a7ed734bbd4a459211613e40209a97991/ros2.repos
BUILD args:
TEST args:
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/16581

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@InvincibleRMC
Copy link
Contributor Author

Another old mypy bug.

import typing

class A:

    def __init__(self) -> typing.NoReturn:   # The return type of "__init__" must be None
        raise NotImplementedError()

Will add a # type: ignore for now. Cannot wait for rhel 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python type annotation
6 participants