Unit 07 · lesson

`setup.py`, `setup.cfg`, and Entry Points

setup.py, setup.cfg, and Entry Points

A Python file existing in your source tree does not automatically make this work:

ros2 run robotnix_pubsub talker

The package must install an executable entry point.

setup.cfg

The generated file tells setuptools where package executables should be installed. The official tutorial notes that ros2 run looks for them under the package's lib install location.

Inspect:

cat setup.cfg

setup.py

Open setup.py and find:

entry_points={
    'console_scripts': [
    ],
}

Later you will add:

'talker = robotnix_pubsub.talker:main',
'listener = robotnix_pubsub.listener:main',

Read the mapping:

CLI executable name
  = Python module path : function

Metadata consistency

The official tutorial instructs Python packages to keep name/version/maintainer/description/license metadata consistent between package.xml and setup.py where those fields overlap.

Checkpoint

Predict what happens if:

  • talker.py exists;
  • the package builds;
  • but no talker = ...:main entry point is installed.

The likely failure is executable discovery, not topic communication.