From 0b8be8a56f0352093cc3a0a371cb6684fd9a4468 Mon Sep 17 00:00:00 2001 From: RFRIEDM-Trimble <50461358+RFRIEDM-Trimble@users.noreply.github.com> Date: Thu, 18 Aug 2022 15:00:23 -0600 Subject: [PATCH] Add warning about installing rosidl interfaces and Python packages in the same project (#2882) * Add warning as recommended in ros2/rosidl_python#141 Signed-off-by: Ryan Friedman * Move warning to after ament_python_install_package instructions Signed-off-by: Ryan Friedman (cherry picked from commit 030bc614dd2bc38b6f581e784cfdfb38afb2e46c) --- source/How-To-Guides/Ament-CMake-Python-Documentation.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/How-To-Guides/Ament-CMake-Python-Documentation.rst b/source/How-To-Guides/Ament-CMake-Python-Documentation.rst index f7c70a8aca..d5faa14c00 100644 --- a/source/How-To-Guides/Ament-CMake-Python-Documentation.rst +++ b/source/How-To-Guides/Ament-CMake-Python-Documentation.rst @@ -14,6 +14,7 @@ See the :doc:`ament_cmake user documentation ` for mo To create an ``ament_python`` package, see :doc:`Creating your first ROS 2 package <../Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package>`. ``ament_cmake_python`` should only be used in cases where that is not possible, like when mixing C/C++ and Python code. + .. contents:: Table of Contents :depth: 2 :local: @@ -59,6 +60,12 @@ The ``CMakeLists.txt`` should contain: The argument to ``ament_python_install_package()`` is the name of the directory alongside the ``CMakeLists.txt`` that contains the Python file. In this case, it is ``my_project``, or ``${PROJECT_NAME}``. +.. warning:: + + Calling ``rosidl_generate_interfaces`` and ``ament_python_install_package`` in the same CMake project does not work. + See this `Github issue `_ for more info. It is best practice to instead + separate out the message generation into a separate package. + Then, another Python package that correctly depends on ``my_project`` can use it as a normal Python module: .. code-block:: python