Skip to content

Add ament_mypy to quality_of_service_demo_py#793

Open
ShivamMaurya14 wants to merge 4 commits into
ros2:rollingfrom
ShivamMaurya14:add-ament-mypy-qos-demo-py
Open

Add ament_mypy to quality_of_service_demo_py#793
ShivamMaurya14 wants to merge 4 commits into
ros2:rollingfrom
ShivamMaurya14:add-ament-mypy-qos-demo-py

Conversation

@ShivamMaurya14
Copy link
Copy Markdown

Closes #769

Adds ament_mypy type-checking linter to the quality_of_service_demo_py
package, consistent with other ament_python packages in this repo.

Changes:

  • Added <test_depend>ament_mypy</test_depend> to package.xml
  • Added test/test_mypy.py with standard linter test boilerplate

Testing ouptut

ubuntu@eef4c7977591:~/workspace/ws4/demos$ colcon build --packages-select quality_of_service_demo_py --allow-overriding quality_of_service_demo_py && \
colcon test --packages-select quality_of_service_demo_py --event-handlers console_cohesion+
Starting >>> quality_of_service_demo_py
Finished <<< quality_of_service_demo_py [4.98s]          

Summary: 1 package finished [5.76s]
Starting >>> quality_of_service_demo_py
--- output: quality_of_service_demo_py                     
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0
cachedir: build/quality_of_service_demo_py/.pytest_cache
rootdir: /home/ubuntu/workspace/ws4/demos
configfile: pytest.ini
plugins: launch-testing-3.4.10, ament-copyright-0.17.5, launch-testing-ros-0.26.11, ament-lint-0.17.5, ament-flake8-0.17.5, ament-xmllint-0.17.5, ament-pep257-0.17.5, ament-mypy-0.17.5, colcon-core-0.20.1, cov-4.1.0
collecting ... 
collected 5 items                                                              

test/test_linters.py ...                                                 [ 60%]
test/test_mypy.py .                                                      [ 80%]
test/test_xmllint.py .                                                   [100%]

- generated xml file: /home/ubuntu/workspace/ws4/demos/build/quality_of_service_demo_py/pytest.xml -
============================== 5 passed in 16.60s ==============================
---
Finished <<< quality_of_service_demo_py [20.4s]
                      
Summary: 1 package finished [21.4s]

All updates done + All test and build passed successfully.

Kindly review and suggestion are highly appreciated .

Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not really match the requirement in #769, besides DCO is missing.

CC: @InvincibleRMC

@InvincibleRMC
Copy link
Copy Markdown
Contributor

Yeah I would double check the file you copied for making the test_mypy.py it seems out of date compared to the one linked in the ticket.

Closes ros2#769

Signed-off-by: Shivam Maurya <shivammmaurya14032005@gmiall.com>
@ShivamMaurya14 ShivamMaurya14 force-pushed the add-ament-mypy-qos-demo-py branch from b3363d4 to d3efa7d Compare May 22, 2026 03:58
@ShivamMaurya14
Copy link
Copy Markdown
Author

ShivamMaurya14 commented May 22, 2026

My bad , thank you for your feedbacks . I have resolved the dco missing issue . and updated the test_mypy.py as per ticket description .
I am completely new to system of open source and these are one of first commit . Do guide me what further i have do I will be very thankful to you .

Signed-off-by: Shivam Maurya <shivammaurya14032005@gmail.com>
@ShivamMaurya14 ShivamMaurya14 marked this pull request as draft May 22, 2026 06:26
@ShivamMaurya14 ShivamMaurya14 marked this pull request as ready for review May 24, 2026 06:15
@ShivamMaurya14
Copy link
Copy Markdown
Author

@InvincibleRMC hey sir , I have updated as per you request . Do guide me what further i have to do.

@InvincibleRMC
Copy link
Copy Markdown
Contributor

Pulls: #793
Gist: https://gist.githubusercontent.com/InvincibleRMC/91969acf50d0e14f8de054ccdc965ad1/raw/c51611543e7472d6fd41c51bc6043cc5d31bce89/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies quality_of_service_demo_py
TEST args: --packages-above quality_of_service_demo_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19386

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

@InvincibleRMC
Copy link
Copy Markdown
Contributor

@ShivamMaurya14 can you fix the failure?

After removing this flag for strict . Build is successful and also all test case runned normally .

Signed-off-by: Shivam Maurya <shivammaurya14032005@gmail.com>
@ShivamMaurya14
Copy link
Copy Markdown
Author

hi , @InvincibleRMC

- Updated test_mypy and Resolved the build errors .

After removing flag for strict . Build is successful and also all test case runs normally .

- Locally build and tested ouputs

Finished <<< quality_of_service_demo_py [5.62s]

Summary: 1 package finished [7.74s]
  1 package had stderr output: quality_of_service_demo_py
shivam_maurya@Shivam-Maurya:/mnt/c/Users/Shivam Maurya/Desktop/Ws4/demos$ colcon test --packages-select quality_of_service_demo_py
Starting >>> quality_of_service_demo_py
Finished <<< quality_of_service_demo_py [14.1s]            

Summary: 1 package finished [16.0s]
shivam_maurya@Shivam-Maurya:/mnt/c/Users/Shivam Maurya/Desktop/Ws4/demos$ colcon test-result --verbose
Summary: 5 tests, 0 errors, 0 failures, 0 skipped

Do correct me if did anything wrong .
Thankyou

Build Error and all test passed . And more aligned as per test_mypy.py structure earlier used in project for consistency .

Signed-off-by: Shivam Maurya <shivammaurya14032005@gmail.com>
@InvincibleRMC
Copy link
Copy Markdown
Contributor

You should run it with strict and make it pass with strict.

@ShivamMaurya14
Copy link
Copy Markdown
Author

Thanks for review,
But sir what i have found that ament_mypy parent pr #765 which have (#775 #776 #778 ) as child pr
which got merged successfully uses this format only kindly see images attached below .

Screenshot 2026-06-02 093754 Screenshot 2026-06-02 094258 Screenshot 2026-06-02 094409

All PR uses this

rc = main(argv=[]) main with empty argv[] .

Do Let me know if still i have to make changes..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ament_mypy to rclpy in quality_of_service_demo

4 participants