1

Rosanswers logo

I am currently trying to implement a pure-Python ROS 2 package with ament_python.

When building, I get the following warning:

WARNING:colcon.colcon_ros.task.ament_python.build:Package 'foobar' doesn't explicitly install a marker in the package index (colcon-ros currently does it implicitly but that fallback will be removed in the future)

Unfortunately, I wasn't able to find any information about this. What is this "marker" about and how do I install it correctly?


Originally posted by Felix Widmaier on ROS Answers with karma: 382 on 2020-12-09

Post score: 2

1 Answers1

1

Rosanswers logo

The "package index" is part of the ament resource index. It's how ROS 2 tools figure out what packages are installed. Read about the design of it is here.

Colcon currently creates this file automatically for ament_python packages, but it won't in the future. Packages will need to install a marker file themselves. This is just a blank file in share/ament_index/resource_index/packages/foobar where foobar is the name of your package.

The usual way to install this is to copy an empty file using the data_files argument. (actual example in ros2topic).

Your package layout might look like:

mypythonpkg/
├── mypythonpkg
│   └── __init__.py
├── package.xml
├── resource
│   └── mypythonpkg
└── setup.py

And your setup.py might have

package_name = 'mypythonpkg'

setup( # ... data_files=[ ('share/' + package_name, ['package.xml']), ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ], # ... )

If you're interested in why Colcon's behavior is changing, there's more info here:


Originally posted by sloretz with karma: 3061 on 2020-12-09

This answer was ACCEPTED on the original site

Post score: 2

Shane Loretz
  • 1,273
  • 1
  • 2
  • 3