-
Notifications
You must be signed in to change notification settings - Fork 138
feature: allow extending a python package in ament_python_install_package
#587
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
base: rolling
Are you sure you want to change the base?
feature: allow extending a python package in ament_python_install_package
#587
Conversation
ament_python_isntall_package
ament_python_install_package
…tension Signed-off-by: Nadav Elkabets <[email protected]>
Signed-off-by: Nadav Elkabets <[email protected]>
d83479d
to
00311aa
Compare
Signed-off-by: Nadav Elkabets <[email protected]>
e2862ff
to
0f9b36d
Compare
Signed-off-by: Nadav Elkabets <[email protected]>
0f9b36d
to
a8419ae
Compare
While the monopackage pattern (containing both message interfaces and behavioral nodes) isn't intentionally unsupported by ROS2, it currently cannot support packages using `ament_cmake_python` to build C++ and Python code alongside `rosidl` message generation. This is a well-known and long-standing issue; see: ros2/rosidl_python#141 ament/ament_cmake#514 ament/ament_cmake#587 Accordingly, to support well-integrated inclusion of Python code in this package (i.e., by adding `run_vrx_experiments.py` to the CMake build system flow), this commit splits `virelex_msgs` out into a separate package. An argument could be made for converting `run_vrx_experiments.py` into a Python-syntax launch file, but it does a bit too much (defines a class, etc.) for that to feel like the correct option. In addition, this commit integrates the `pretrained_models` folder into the new `trained` subdirectory of `virelex`, providing a stable filesystem path to access those models during node execution (via `get_package_share_directory("virelex")`).
I've done an initial check of the code, and it generally looks good, except for one issue. As far as I can tell, you are not supporting AMENT_CMAKE_SYMLINK_INSTALL. Symlink install is probably incompatible with the concept of merging together multiple same-named python packages, but this need to merge is really rather rare, and symlink_install makes sense in the vast majority of packages that do not need this merger. It seems to me that the correct thing to do is to disable symlink install with a warning when multiple same-named packages are detected. Or did I miss something about how you supported this? I have not actually tested yet, but will soon. |
I kept the original package installation code without changes. To my knowledge, colcon changes the behavior of the |
This is the code from the original that does not have an equivalent in your PR. (I matched every line of the old code with your new code, and this is the only difference that I found). I'll test it today though to confirm whether it works or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've thoroughly checked the old code vs the new code, and confirmed that all of the old code has corresponding functionality in the new code, with one exception. I've also tested using a very simple combined msg/ directory with a python package of the same name, and everything works as I expect.
Concerning the exception code, I've compared results of the new code with old code for --symlink-install, and find that the new code works fine with the same result. As @nadavelkabets points out, the modifications to the install command are taking care of the symlinks. The only difference I could find is that in the old code, a symlink is created in the build/ directory, that is not present in the new code. But the end result in the /install directory is the same in both cases, so it is not clear to me why this symlink is needed. Trying to add that symlink would lead to a conflict between duplicate python packages and --symlink-install, so it is good that it is not needed.
But as @hidmic points out in PR #326 that created these symlinks, "There should be a Here be dragons sign in ament_cmake root README..." I'm afraid that fighting those dragons here is beyond my expertise. AFAICT that code is not needed. But perhaps @nadavelkabets you could give your own defense of why.
So with one nit, I've reviewed as thoroughly as I can and find no issues, so here's my gray checkmark.
Closes #514.
Following the suggestion from @clalancette,
calling
ament_python_install_package
now registers an environment hook and sets the parameters in environment variables, moving installation to theament_package
stage.This allows to extend an existing package and thus allows to utilize
rosidl_generate_interfaces
andament_python_install_package
at the same time.Related: