Open InvincibleRMC opened 3 months ago
@InvincibleRMC 1st of all, really appreciate all the contribution you have been and are making for rclpy
type check.
we expected that this feature request would come up. i think mostly your consideration describes pretty much everything like dependencies, benefits and concerns so on. (IMO, this should be integrated into CI/CD pipeline, so that we can sustain the type checking.)
i think that this will be better consistent and readable for sure, but that is gonna be the work and a long run. i also would like to hear from more opinion here.
let's keep this open to get more feedback!
Feature request
Feature description
Using
ament_mypy
to assure future code has proper typing annotations. First and foremost this change would need to wait on many pull requests as there are over 100 mypy errors still remaining on rolling. This change would also likely require any upstream dependencies to adoptament_mypy
to avoid[no-untyped-call]
error and other similar errors being raised from a new upstream function being added and called. I bring up this question now so if this feature is desired I can start getting those upstream dependencies checked withament_mypy
earlier to avoid future waiting. For CI time considerationsament_mypy
runs in about 2.4s. The benefits of this would be improved code readability, helping catch unexpected edge cases, as well remove the need for downstream dependencies who type check to suppress[no-untyped-call]
and other similar errors whenever using rclpy.Implementation considerations
For implementation currently only
ament_mypy
exists. The alternative would be perhaps creating anament_pyright
and using that instead for static type checking.If this is a feature the maintainers are willing to support I will gladly help accomplish this goal. And if anyone else wants to help test with
ament_mypy
or add type annotations torclpy
or any other ROS2 python file that would be greatly appreciated.