Skip to content

Cast Sequence to list on assignment (with templates)#249

Merged
InvincibleRMC merged 11 commits intoros2:rollingfrom
InvincibleRMC:list-casting-template
Mar 2, 2026
Merged

Cast Sequence to list on assignment (with templates)#249
InvincibleRMC merged 11 commits intoros2:rollingfrom
InvincibleRMC:list-casting-template

Conversation

@InvincibleRMC
Copy link
Contributor

@InvincibleRMC InvincibleRMC commented Feb 5, 2026

Description

With templates

My proposal on what the solution for The Sequence Api discussion.
Zulip discussion here.

Is this user-facing behavior change?

Yes in the past users type would only change on receiving from a subscriber but, now the change is done on assignment to be more inline with numpy.array and array.array casts.

Did you use Generative AI?

Additional Information

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@InvincibleRMC
Copy link
Contributor Author

InvincibleRMC commented Feb 5, 2026

@christophebedard here is an implementation with straight templates. The only jankness comes not being able to apply indents to templates nicely. If there is some cleaner way I would love to know. Trying to use the empy documentation was trying.

@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/92aa793f18157212d6b107cf5bb51435/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18129

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

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/eb456bb5d936910bdad666e94a74882c/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18136

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

@InvincibleRMC
Copy link
Contributor Author

@christophebedard does this templated solution work for you?

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/b0c3076a986b5ed3385f650072dbb017/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18226

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

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/f009723ba7dbc9651448212d430a3eed/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18227

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

@christophebedard
Copy link
Member

I'm reviewing this now. Just to make sure I understand, this replaces #247 and #246.

Can you summarize the discussion we had on Zulip/in PMC meetings in the PR description?

Copy link
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

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

Some comments and suggestions. I really had to look at the output, because this is just so 😵

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/5250b2325d47ef516b09d556af3f9ca3/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18340

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

@InvincibleRMC
Copy link
Contributor Author

InvincibleRMC commented Feb 28, 2026

Hmmm. Pytest seems to be missing in this rhel job? It also has happend in my last 3 rhel CI jobs across repos. But others seem fine. I'll rerun but, 3 for 3 is sus.

@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/a381ef6dd88d17c5d393f2b1c580bef7/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18341

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

@christophebedard
Copy link
Member

christophebedard commented Feb 28, 2026

LGTM with green CI. We'll have to wait for ros2/launch#944 to be fixed

@InvincibleRMC
Copy link
Contributor Author

InvincibleRMC commented Feb 28, 2026

LGTM with green CI. We'll have to wait for ros2/launch#944 to be fixed

I have a fear that the launch stuff might be unrelated. Since it cant find pytest at all which shouldn't be in any way related but, will re-run stuff after a fix is merged.

@christophebedard
Copy link
Member

Where are you saying that error about pytest? It's not very clear if you just click on the test failures in the list under the CI job page, but all test failures are basically this:

11:29:37   File "/home/jenkins-agent/workspace/ci_linux-rhel/ws/install/launch/lib/python3.9/site-packages/launch/actions/declare_boolean_launch_argument.py", line 60, in DeclareBooleanLaunchArgument
11:29:37     default_value: Optional[SomeSubstitutionsType | bool] = None,
11:29:37 TypeError: unsupported operand type(s) for |: '_UnionGenericAlias' and 'type'

@InvincibleRMC
Copy link
Contributor Author

InvincibleRMC commented Feb 28, 2026

image

Its being hidden within the launch stuff but looking at several packages I'm seeing the following.

From rosbag2_py console log for example

CMake Warning at /home/jenkins-agent/workspace/ci_linux-rhel/ws/install/ament_cmake_pytest/share/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake:82 (message):
02:09:47   The Python module 'pytest' was not found, pytests cannot be run.  On Linux,
02:09:47   install the 'python3-pytest' package.  On other platforms, install 'pytest'
02:09:47   using pip.
02:09:47 Call Stack (most recent call first):
02:09:47   CMakeLists.txt:190 (ament_add_pytest_test

@christophebedard
Copy link
Member

ah! So some tests are just not getting run. There may be an issue with the way we detect pytest: https://github.com/ament/ament_cmake/blob/d4781cd07fd083c202feeaf1bfa5ddec860d5120/ament_cmake_pytest/cmake/ament_has_pytest.cmake#L40-L47

@InvincibleRMC
Copy link
Contributor Author

ah! So some tests are just not getting run. There may be an issue with the way we detect pytest: https://github.com/ament/ament_cmake/blob/d4781cd07fd083c202feeaf1bfa5ddec860d5120/ament_cmake_pytest/cmake/ament_has_pytest.cmake#L40-L47

But like the last edit was 5 years ago? And it only started it like 1 or 2 days ago in job #7968. And its still in ros2/ci for rhel.

@christophebedard
Copy link
Member

I believe we've had issues with finding or getting the right Python interpreter in the past on RHEL. Maybe something changed? I know Humble/RHEL 8 needed an explicit -DPYTHON_EXECUTABLE=... CMake arg. We should start by opening an issue under github.com/ros2/ci

@InvincibleRMC
Copy link
Contributor Author

InvincibleRMC commented Feb 28, 2026

I believe we've had issues with finding or getting the right Python interpreter in the past on RHEL. Maybe something changed? I know Humble/RHEL 8 needed an explicit -DPYTHON_EXECUTABLE=... CMake arg. We should start by opening an issue under github.com/ros2/ci

Ok. The pytest stuff did also effect the nightly. But it was fine just the day prior.

@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/6196f11c483ca331d7726cfa02c51c83/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18346

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

@InvincibleRMC InvincibleRMC merged commit 3c3bd8d into ros2:rolling Mar 2, 2026
2 of 3 checks passed
@InvincibleRMC
Copy link
Contributor Author

Pulls: #249
Gist: https://gist.githubusercontent.com/InvincibleRMC/3c5f98d23db92cffeb34684454a0406a/raw/fed5b0c61dd10d8e464ffc8711c11964bb7461ca/ros2.repos
BUILD args: --continue-on-error --packages-above-and-dependencies rosidl_generator_py
TEST args: --packages-above rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18353

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

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.

3 participants