You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supersedes the dependency-type reshuffle in #354. Bloom puts exec_depend, build_export_depend and buildtool_export_depend all into a deb's Depends: (bloom), so retagging dependencies inside generate_parameter_library cannot keep the generator off a robot. Like rosidl_default_generators / rosidl_default_runtime (and NoDL's nodl_runtime_py), this splits what generated code needs at runtime into separate packages:
generate_parameter_library_runtime_cpp (new, C++): manifest-only package with what the generated header links (fmt, rclcpp, rclcpp_lifecycle, rsl) and the header-only libs the generated CMake target exports (tcb_span, libexpected-dev).
generate_parameter_library_runtime_py (new, Python): ParameterValidators moves here from generate_parameter_library_py (resolves the TODO in python_validators.py), plus rclpy and rcl_interfaces. Generated modules and generate_parameter_library_validate import it from here. generate_parameter_library_py.python_validators stays as a re-export.
generate_parameter_library now depends on both runtime packages instead of listing their contents, so <depend>generate_parameter_library</depend> keeps working unchanged.
The examples use the lean pattern, documented in the README:
CI pip-installs and tests the new Python package. A new Lean Runtime workflow builds the examples, then runs them in a fresh ros-core container that only has the exec dependencies of the runtime packages and examples, without the generator.
A new test checks that generated Python modules import only the runtime package, rclpy, rcl_interfaces and the standard library.
Behaviour change for a plain <depend>generate_parameter_library</depend>: since #440 that no longer pulled in rclpy. It does again now, via generate_parameter_library_py → generate_parameter_library_runtime_py → rclpy and rcl_interfaces, because the validate CLI imports the moved validators. C++-only packages that want neither the generator nor rclpy at runtime should switch to the pattern above.
Custom validation modules that import generate_parameter_library_py.python_validators should switch to generate_parameter_library_runtime_py.python_validators; the old path only works where the generator is installed.
Release note: both new packages have to be added to the rosdistro release.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Generated modules can fail when the new runtime package is absent, and the isolation check can miss a generator installed in the sourced ROS environment.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Source the ROS environment before checking generator imports
.github/workflows/lean-runtime.yaml:98
The Python check runs before sourcing the ROS underlay or the extracted install space, so it cannot see a generator installed in either location. For example, an accidental runtime dependency on generate_parameter_library_py can install it under /opt/ros, yet this check still passes and the subsequent sourced examples can use it. Source the same environment as the examples before checking the import.
Add a legacy validator fallback for older generator deployments
A downstream Python package rebuilt with this template can still be deployed with the previous generator release, since its existing unversioned generate_parameter_library dependency does not require an upgrade. The new runtime package may then be absent, causing the generated module to fail with ModuleNotFoundError. Add a guarded fallback to the legacy validator import when the runtime package is absent, and adjust the import-isolation test to allow that fallback.
Source the ROS environment before checking generator imports: agreed. Container steps don't source /opt/ros, so an apt-installed generate_parameter_library_py would not have been found. Fixed in da49451: the check now runs after source install/setup.bash and uses ros2 pkg prefix for both generator packages, which covers /opt/ros and the install space.
Legacy validator fallback for older generator deployments: not adding this. The failure needs a partial upgrade, where a downstream package rebuilt against the new generator is installed next to an old generate_parameter_library. ROS binary packages are synced and meant to be upgraded together. Any downstream rebuilt against a newer dependency breaks the same way on a partial upgrade, e.g. generated C++ code calling a new rsl function. A try/except import of generate_parameter_library_py in every generated module would bring back the generator import this PR removes, and the lean pattern declares the runtime package directly anyway.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A missing legacy import fallback and missing Python generator version constraints can cause generated modules to fail to import on existing installations and lean deployments.
No open issues 🎉
4 previously missed issues
In code that hasn't changed since last review
Require a Python generator version with the updated template
example_python/package.xml:14
These lean Python manifests accept an older Python generator that still emits imports from generate_parameter_library_py, so those modules fail to import on a generator-free target. Require a version of the actual Python generator containing the updated template, including through the CMake dependency route. Same issue in example_cmake_python/package.xml:15 and the Python recipes in README.md:67–73.
Newly generated modules fail to import on targets that satisfy an existing unversioned <depend>generate_parameter_library</depend> with an older generator, because that installation does not pull in the new runtime package. Keep the legacy validator import as a fallback when the runtime package is absent, and adjust the import test to allow only that fallback.
Check runtime dependencies before packing the install space
.github/workflows/lean-runtime.yaml:55
The archive retains the runtime packages even if an example omits its runtime dependency, so this workflow can miss a broken deployment manifest. Validate each example's runtime declaration before packing the install space.
Require nodes to remain running until the timeout
.github/workflows/lean-runtime.yaml:108
This helper also succeeds when the command exits with status 0 before the timeout, so a node that exits without starting can make the lean-runtime check pass. Require the timeout status explicitly so both examples must remain running for the full check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes the dependency-type reshuffle in #354. Bloom puts
exec_depend,build_export_dependandbuildtool_export_dependall into a deb'sDepends:(bloom), so retagging dependencies insidegenerate_parameter_librarycannot keep the generator off a robot. Likerosidl_default_generators/rosidl_default_runtime(and NoDL'snodl_runtime_py), this splits what generated code needs at runtime into separate packages:generate_parameter_library_runtime_cpp(new, C++): manifest-only package with what the generated header links (fmt, rclcpp, rclcpp_lifecycle, rsl) and the header-only libs the generated CMake target exports (tcb_span, libexpected-dev).generate_parameter_library_runtime_py(new, Python):ParameterValidatorsmoves here fromgenerate_parameter_library_py(resolves the TODO inpython_validators.py), plus rclpy and rcl_interfaces. Generated modules andgenerate_parameter_library_validateimport it from here.generate_parameter_library_py.python_validatorsstays as a re-export.generate_parameter_librarynow depends on both runtime packages instead of listing their contents, so<depend>generate_parameter_library</depend>keeps working unchanged.The examples use the lean pattern, documented in the README:
CI pip-installs and tests the new Python package. A new
Lean Runtimeworkflow builds the examples, then runs them in a freshros-corecontainer that only has the exec dependencies of the runtime packages and examples, without the generator.A new test checks that generated Python modules import only the runtime package, rclpy, rcl_interfaces and the standard library.
Behaviour change for a plain
<depend>generate_parameter_library</depend>: since #440 that no longer pulled in rclpy. It does again now, viagenerate_parameter_library_py→generate_parameter_library_runtime_py→ rclpy and rcl_interfaces, because the validate CLI imports the moved validators. C++-only packages that want neither the generator nor rclpy at runtime should switch to the pattern above.Custom validation modules that import
generate_parameter_library_py.python_validatorsshould switch togenerate_parameter_library_runtime_py.python_validators; the old path only works where the generator is installed.Release note: both new packages have to be added to the rosdistro release.
🤖 Generated with Claude Code