ROS2 - Packages

Pure Python Packages

Posted by Rico's Nerd Cluster on January 11, 2025

ROSPy

for a pure ROS 2 Python package, you usually do not need a CMakeLists.txt. There are two valid ROS 2 Python package styles:

  1.  ament_python style, No CMakeLists.txt.
1
2
3
4
5
package.xml
setup.py
setup.cfg
resource/<package_name>
<package_name>/__init__.py

In package.xml:

1
2
3
4
5
<buildtool_depend>ament_python</buildtool_depend>

<export>
  <build_type>ament_python</build_type>
</export>
  1. ament_cmake + ament_cmake_python style
1
2
3
CMakeLists.txt
package.xml
<package_name>/__init__.py

This is what point_cloud_compressor does. It is still Python code, but the package is built through CMake. You need CMakeLists.txt for that style